toggle-DND (1159B)
1 #!/usr/bin/env -S guile -e '(toggle-dnd)' -s 2 !# 3 4 (define-library (toggle-dnd) 5 (import (guile) 6 (ice-9 match) 7 (ice-9 popen) 8 (ice-9 rdelim) 9 (ice-9 textual-ports)) 10 (export main) 11 12 (begin 13 (define (main args) 14 (with-input-from-port 15 (open-pipe* OPEN_READ 16 "gsettings" 17 "get" 18 "org.gnome.desktop.notifications" 19 "show-banners") 20 (lambda () 21 (match (read-line) 22 ("true" 23 (format #t "DND turn on.~%") 24 (system* "gsettings" 25 "set" 26 "org.gnome.desktop.notifications" 27 "show-banners" 28 "false")) 29 ("false" 30 (format #t "DND turn off.~%") 31 (system* "gsettings" 32 "set" 33 "org.gnome.desktop.notifications" 34 "show-banners" 35 "true")) 36 (else 37 (format #t "Something's wrong! Not a valid answer: ~A\n" current-show-banners-status))) )))))