aboutsummaryrefslogtreecommitdiff
path: root/services/sxhkd.nix
blob: d8678af1e1a3a6f6460b178fc6b0abfb27d652f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{ config
, pkgs
, theme
, ...
}:

let
  progress = text: value:
    ''
      ${pkgs.libnotify}/bin/notify-send ${text} -h int:value:${value} -h string:synchronous:volume -h string:hlcolor:"${theme.base0C}"
    '';
  volume = pkgs.writeScriptBin "volume" ''
    ${pkgs.alsaUtils}/bin/amixer $@
    v=$(${pkgs.alsaUtils}/bin/amixer sget Master | ${pkgs.gawk}/bin/awk -F"[][%]" '/Left:/ {print $2}')
    ${progress "volume" "$v"}
  '';

in
{
  services.sxhkd = {
    enable = true;
    keybindings = {
      "super + slash" = "${pkgs.light}/bin/light -A 2";
      "super + shift + slash" = "${pkgs.light}/bin/light -U 2";
      "super + semicolon" = "${volume}/bin/volume sset Master 2%+";
      "super + shift + semicolon" = "${volume}/bin/volume sset Master 2%-";
      "super + ctrl  + space" = "${pkgs.dunst}/bin/dunstctl close";
      "super + shift + space" = "${pkgs.dunst}/bin/dunstctl history-pop";
      "super + ctrl  + shift + space" = "${pkgs.dunst}/bin/dunstctl close-all";
    };
  };
}