{ pkgs, ... }: let wpctl = "${pkgs.wireplumber}/bin/wpctl"; xbindkeysrc = pkgs.writeText "xbindkeysrc" '' "${wpctl} set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%+" XF86AudioRaiseVolume "${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 5%-" XF86AudioLowerVolume "${wpctl} set-mute @DEFAULT_AUDIO_SINK@ toggle" XF86AudioMute ''; in { systemd.user.services.xbindkeys = { Unit = { Description = "xbindkeys"; PartOf = [ "graphical-session.target" ]; After = [ "graphical-session.target" ]; }; Service = { # -n keeps it in the foreground so systemd can supervise it ExecStart = "${pkgs.xbindkeys}/bin/xbindkeys -n -f ${xbindkeysrc}"; Restart = "on-failure"; }; Install.WantedBy = [ "graphical-session.target" ]; }; }