dotfiles/modules/nixos/graphical/keybinds.nix
2023-08-09 21:32:38 -04:00

52 lines
1.7 KiB
Nix

{ config, pkgs, ... }: {
home-manager.users.${config.user} = {
services.sxhkd = {
enable = true;
keybindings = {
# Adjust screen brightness (TODO: replace with pkgs.light?)
"shift + {F11,F12}" = ''
${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 {- 30,+ 30} && sleep 1; \\
${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 {- 30,+ 30}
'';
"XF86MonBrightness{Down,Up}" = ''
${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 {- 30,+ 30} && sleep 1; \\
${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 {- 30,+ 30}
'';
# Media controls
"XF86Audio{Play,Stop,Next,Prev}" =
"${pkgs.playerctl}/bin/playerctl {play-pause,stop,next,previous}";
# Toggle bar
"super + b" = config.toggleBarCommand;
# Launchers
"super + space" = config.launcherCommand;
"super + shift + s" = config.systemdSearch;
"super + shift + a" = config.audioSwitchCommand;
"alt + Tab" = config.altTabCommand;
"super + shift + period" = config.powerCommand;
"super + shift + m" = config.brightnessCommand;
"super + c" = config.calculatorCommand;
"super + shift + x" = config.lockScreenCommand;
"super + alt + h" =
"${config.terminal} sh -c '${pkgs.home-manager}/bin/home-manager switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
"super + alt + r" =
"${config.terminal} sh -c 'doas nixos-rebuild switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
};
};
xsession.windowManager.i3.config.startup = [{
command = "pkill sxhkd; sxhkd";
always = true;
notification = false;
}];
};
}