diff options
author | Jan Malakhovski <oxij@oxij.org> | 2015-04-15 17:48:38 +0000 |
---|---|---|
committer | Jan Malakhovski <oxij@oxij.org> | 2015-04-20 17:11:19 +0000 |
commit | 57ab189e7807ade1432a5c02599ed11a7ee9cc37 (patch) | |
tree | 74aee967ccdb36ffbf0680655444ee7622b45889 /nixos/modules/services/audio | |
parent | bba9d17e943540413fe4d1b47ede03ac7f74da04 (diff) | |
download | nixlib-57ab189e7807ade1432a5c02599ed11a7ee9cc37.tar nixlib-57ab189e7807ade1432a5c02599ed11a7ee9cc37.tar.gz nixlib-57ab189e7807ade1432a5c02599ed11a7ee9cc37.tar.bz2 nixlib-57ab189e7807ade1432a5c02599ed11a7ee9cc37.tar.lz nixlib-57ab189e7807ade1432a5c02599ed11a7ee9cc37.tar.xz nixlib-57ab189e7807ade1432a5c02599ed11a7ee9cc37.tar.zst nixlib-57ab189e7807ade1432a5c02599ed11a7ee9cc37.zip |
nixos: add actkbd module and sound.enableMediaKeys option
Diffstat (limited to 'nixos/modules/services/audio')
-rw-r--r-- | nixos/modules/services/audio/alsa.nix | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/nixos/modules/services/audio/alsa.nix b/nixos/modules/services/audio/alsa.nix index 653c0ed5d70b..c63f4dc8d7f1 100644 --- a/nixos/modules/services/audio/alsa.nix +++ b/nixos/modules/services/audio/alsa.nix @@ -33,6 +33,16 @@ in ''; }; + enableMediaKeys = mkOption { + type = types.bool; + default = false; + description = '' + Whether to enable volume and capture control with keyboard media keys. + + Enabling this will turn on <option>services.actkbd</option>. + ''; + }; + extraConfig = mkOption { type = types.lines; default = ""; @@ -80,6 +90,23 @@ in }; }; + services.actkbd = mkIf config.sound.enableMediaKeys { + enable = true; + bindings = [ + # "Mute" media key + { keys = [ 113 ]; events = [ "key" ]; command = "${alsaUtils}/bin/amixer -q set Master toggle"; } + + # "Lower Volume" media key + { keys = [ 114 ]; events = [ "key" "rep" ]; command = "${alsaUtils}/bin/amixer -q set Master 1- unmute"; } + + # "Raise Volume" media key + { keys = [ 115 ]; events = [ "key" "rep" ]; command = "${alsaUtils}/bin/amixer -q set Master 1+ unmute"; } + + # "Mic Mute" media key + { keys = [ 190 ]; events = [ "key" ]; command = "${alsaUtils}/bin/amixer -q set Capture toggle"; } + ]; + }; + }; } |