Files
sydnix/modules/home/users/crumb/waybar/src/cycle_notifications.clj
Madeleine Sydney c48a93ad10 feat: Add host sydpc
My, this is a lot TwT.  Much work was batched as part of the transition from
guix-rebound to nixos-testbed/sydpc.

- Discord/Vesktop module & config.
- Syncthing setup.
- Assorted Emacs changes.
- Waybar config.
- Niri config.
- Steam config.
- Some MPD.
- Stylix config.
- Files/Impermanence things.
- Enable Ghostty.
- God knows what else.
2025-03-20 09:02:25 -06:00

32 lines
720 B
Clojure

#!/usr/bin/env bb
(ns cycle-notifications
(:require [babashka.process :as p]
[clojure.string :as str]
[cheshire.core :as json]))
(defn get-mode []
(case (:out (p/shell {:out :string} "swaync-client -D"))
"true" :dnd
"false" :default))
#_
(get-mode)
(defn toggle! []
(p/shell {:out nil} "swaync-client -d")
;; Update Waybar.
(p/shell "pkill -SIGRTMIN+2 waybar"))
(defn status []
(-> (case (:out (p/shell {:out :string} "swaync-client -D"))
"false" {:text "" :tooltip "Notify"}
"true" {:text "" :tooltip "Do not disturb"})
json/generate-string
println))
(defn -main [& args]
(case (first args)
"toggle" (toggle!)
nil (status)))