commit 3e342a4f318455bd5b8cabdcccd1acc7d70b0e1b parent 8647be31c1da6086ac546a028060ff1d2d790326 Author: Yuval Langer <yuval.langer@gmail.com> Date: Fri, 29 Mar 2024 23:03:42 +0300 Add a screen brightness changing script using gdbus. Diffstat:
A | bin/brightness | | | 54 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 54 insertions(+), 0 deletions(-)
diff --git a/bin/brightness b/bin/brightness @@ -0,0 +1,54 @@ +#!/usr/bin/env -S guile -e main -s +!# + +(use-modules (ice-9 match)) + +(define* (display-help-message #:key (self #f)) + (define (make-help-message self) + (format #t "Usage: + ~a up + ~a down +" + self + self)) + (if self + (make-help-message self) + (make-help-message "brightness"))) + +(define (main args) + (match args + ((self "get") + (system* "gdbus" + "call" + "--session" + "--dest" + "org.gnome.SettingsDaemon.Power" + "--object-path" + "/org/gnome/SettingsDaemon/Power" + "--method" + "org.gnome.SettingsDaemon.Power.Screen.StepUp" + )) + ((self "up") + (system* "gdbus" + "call" + "--session" + "--dest" + "org.gnome.SettingsDaemon.Power" + "--object-path" + "/org/gnome/SettingsDaemon/Power" + "--method" + "org.gnome.SettingsDaemon.Power.Screen.StepUp" + )) + ((self "down") + (system* "gdbus" + "call" + "--session" + "--dest" + "org.gnome.SettingsDaemon.Power" + "--object-path" + "/org/gnome/SettingsDaemon/Power" + "--method" + "org.gnome.SettingsDaemon.Power.Screen.StepDown" + )) + ((self . rest) + (display-help-message #:self self))))