From ccde2fea4f1b3befd7ba05bd4e75e3dc48cc91e6 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 12 Aug 2024 16:01:18 +0200 Subject: ... --- accounts/gkleen@sif/default.nix | 19 ++++++++++++++++--- accounts/gkleen@sif/dunstrc.d/10-brightness.conf | 5 +++++ 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 accounts/gkleen@sif/dunstrc.d/10-brightness.conf (limited to 'accounts/gkleen@sif') diff --git a/accounts/gkleen@sif/default.nix b/accounts/gkleen@sif/default.nix index 7ff0afc6..b66db697 100644 --- a/accounts/gkleen@sif/default.nix +++ b/accounts/gkleen@sif/default.nix @@ -419,12 +419,25 @@ in { format = "{icon}"; format-icons = { activated = "󰈈"; deactivated = "󰈉"; }; }; - backlight = { + backlight = let + brightnessNotify = '' + max=$(brightnessctl m -m) + curr=$(brightnessctl g -m) + perc=$((curr * 100 / max)) + pgrep dunstify || dunstify -u low -a brightness "Brightness ''${perc}" "" -h int:value:''${perc} + ''; + in { format = "{icon}"; tooltip-format = "{percent}%"; format-icons = ["󰃚" "󰃛" "󰃜" "󰃝" "󰃞" "󰃟" "󰃠"]; - on-scroll-up = "brightnessctl s +1"; - on-scroll-down = "brightnessctl s 1-"; + on-scroll-up = pkgs.writeShellScript "brightness-up" '' + brightnessctl s +1 + ${brightnessNotify} + ''; + on-scroll-down = pkgs.writeShellScript "brightness-down" '' + brightnessctl s 1- + ${brightnessNotify} + ''; }; } { diff --git a/accounts/gkleen@sif/dunstrc.d/10-brightness.conf b/accounts/gkleen@sif/dunstrc.d/10-brightness.conf new file mode 100644 index 00000000..c54595ab --- /dev/null +++ b/accounts/gkleen@sif/dunstrc.d/10-brightness.conf @@ -0,0 +1,5 @@ +[brightness] +appname="brightness" +set_stack_tag="brightness" +set_transient=yes +history_ignore=yes -- cgit v1.2.3