aboutsummaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authorAkshay <[email protected]>2023-09-23 17:20:03 +0100
committerAkshay <[email protected]>2023-09-23 17:20:03 +0100
commit1f5297bf737560fa2dd886fbb8cb94331cccf93a (patch)
tree032e6873f750ac27b7e2d4d34e73439842ad837b /services
parente38658ec1c69821680b82ba3de57b8a4783aba19 (diff)
notify on brightness and volume change
Diffstat (limited to 'services')
-rw-r--r--services/dunst.nix11
-rw-r--r--services/sxhkd.nix29
2 files changed, 30 insertions, 10 deletions
diff --git a/services/dunst.nix b/services/dunst.nix
index 0d05889..407820f 100644
--- a/services/dunst.nix
+++ b/services/dunst.nix
@@ -41,27 +41,30 @@ with theme;
41 mouse_left_click = "close_current"; 41 mouse_left_click = "close_current";
42 mouse_middle_click = "do_action, close_current"; 42 mouse_middle_click = "do_action, close_current";
43 mouse_right_click = "close_all"; 43 mouse_right_click = "close_all";
44 gap_size = 12;
45 progress_bar_height = 4;
46 progress_bar_corner_radius = 4;
44 }; 47 };
45 48
46 urgency_normal = { 49 urgency_normal = {
47 background = base00; 50 background = base00;
48 foreground = base05; 51 foreground = base05;
49 frame_color = base01; 52 frame_color = base01;
50 timeout = 10; 53 timeout = 5;
51 }; 54 };
52 55
53 urgency_low = { 56 urgency_low = {
54 background = base00; 57 background = base00;
55 foreground = base05; 58 foreground = base05;
56 frame_color = base01; 59 frame_color = base01;
57 timeout = 2; 60 timeout = 3;
58 }; 61 };
59 62
60 urgency_critical = { 63 urgency_critical = {
61 background = base0C; 64 background = base0C;
62 foreground = base00; 65 foreground = base00;
63 frame_color = base00; 66 frame_color = base0C;
64 timeout = 0; 67 timeout = 5;
65 }; 68 };
66 }; 69 };
67 }; 70 };
diff --git a/services/sxhkd.nix b/services/sxhkd.nix
index 19d6917..3bb3da8 100644
--- a/services/sxhkd.nix
+++ b/services/sxhkd.nix
@@ -4,17 +4,34 @@
4, ... 4, ...
5}: 5}:
6 6
7let
8 progress = text: value:
9 ''
10 ${pkgs.libnotify}/bin/notify-send ${text} -h int:value:${value} -h string:synchronous:volume -h string:hlcolor:"${theme.base0C}"
11 '';
12 brightness = pkgs.writeScriptBin "brightness" ''
13 ${pkgs.light}/bin/light $@
14 v=$(${pkgs.light}/bin/light -G)
15 ${progress "brightness" "$v"}
16 '';
17 volume = pkgs.writeScriptBin "volume" ''
18 ${pkgs.alsaUtils}/bin/amixer $@
19 v=$(${pkgs.alsaUtils}/bin/amixer sget Master | ${pkgs.gawk}/bin/awk -F"[][%]" '/Left:/ {print $2}')
20 ${progress "volume" "$v"}
21 '';
22
23in
7{ 24{
8 services.sxhkd = { 25 services.sxhkd = {
9 enable = true; 26 enable = true;
10 keybindings = { 27 keybindings = {
11 "super + slash" = "${pkgs.light}/bin/light -A 5"; 28 "super + slash" = "${brightness}/bin/brightness -A 2";
12 "super + shift + slash" = "${pkgs.light}/bin/light -U 5"; 29 "super + shift + slash" = "${brightness}/bin/brightness -U 2";
13 "super + semicolon" = "${pkgs.alsaUtils}/bin/amixer sset Master 2%+"; 30 "super + semicolon" = "${volume}/bin/volume sset Master 2%+";
14 "super + shift + semicolon" = "${pkgs.alsaUtils}/bin/amixer sset Master 2%-"; 31 "super + shift + semicolon" = "${volume}/bin/volume sset Master 2%-";
15 "super + space" = "${pkgs.dunst}/bin/dunstctl close"; 32 "super + ctrl + space" = "${pkgs.dunst}/bin/dunstctl close";
16 "super + ctrl + space" = "${pkgs.dunst}/bin/dunstctl close-all";
17 "super + shift + space" = "${pkgs.dunst}/bin/dunstctl history-pop"; 33 "super + shift + space" = "${pkgs.dunst}/bin/dunstctl history-pop";
34 "super + ctrl + shift + space" = "${pkgs.dunst}/bin/dunstctl close-all";
18 }; 35 };
19 }; 36 };
20} 37}