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.
This commit is contained in:
31
modules/home/users/crumb/waybar/src/cycle_notifications.clj
Normal file
31
modules/home/users/crumb/waybar/src/cycle_notifications.clj
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/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)))
|
||||
Reference in New Issue
Block a user