summary refs log tree commit diff
path: root/nixos/modules/services/audio
diff options
context:
space:
mode:
authorRobin Stumm <dermetfan@users.noreply.github.com>2017-01-01 11:44:07 +0100
committerJörg Thalheim <joerg@higgsboson.tk>2017-01-01 11:44:07 +0100
commit11fe837758d87cea8865159486cb0dcd34870436 (patch)
treec8d33d1276feb377bdc4fa8f374c8002f486d560 /nixos/modules/services/audio
parent84a50084c33635a91aebd3bece4d3b71293341de (diff)
downloadnixlib-11fe837758d87cea8865159486cb0dcd34870436.tar
nixlib-11fe837758d87cea8865159486cb0dcd34870436.tar.gz
nixlib-11fe837758d87cea8865159486cb0dcd34870436.tar.bz2
nixlib-11fe837758d87cea8865159486cb0dcd34870436.tar.lz
nixlib-11fe837758d87cea8865159486cb0dcd34870436.tar.xz
nixlib-11fe837758d87cea8865159486cb0dcd34870436.tar.zst
nixlib-11fe837758d87cea8865159486cb0dcd34870436.zip
rename sound.enableMediaKeys to sound.mediaKeys.enable and add volumeStep
Diffstat (limited to 'nixos/modules/services/audio')
-rw-r--r--nixos/modules/services/audio/alsa.nix41
1 files changed, 28 insertions, 13 deletions
diff --git a/nixos/modules/services/audio/alsa.nix b/nixos/modules/services/audio/alsa.nix
index c63f4dc8d7f1..53786dbc6270 100644
--- a/nixos/modules/services/audio/alsa.nix
+++ b/nixos/modules/services/audio/alsa.nix
@@ -33,16 +33,6 @@ 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 = "";
@@ -54,6 +44,31 @@ in
         '';
       };
 
+      mediaKeys = {
+
+        enable = 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>.
+          '';
+        };
+
+        volumeStep = mkOption {
+          type = types.string;
+          default = "1";
+          example = "1%";
+          description = ''
+            The value by which to increment/decrement volume on media keys.
+
+            See amixer(1) for allowed values.
+          '';
+        };
+
+      };
+
     };
 
   };
@@ -90,17 +105,17 @@ in
         };
       };
 
-    services.actkbd = mkIf config.sound.enableMediaKeys {
+    services.actkbd = mkIf config.sound.mediaKeys.enable {
       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"; }
+        { keys = [ 114 ]; events = [ "key" "rep" ]; command = "${alsaUtils}/bin/amixer -q set Master ${config.sound.mediaKeys.volumeStep}- unmute"; }
 
         # "Raise Volume" media key
-        { keys = [ 115 ]; events = [ "key" "rep" ]; command = "${alsaUtils}/bin/amixer -q set Master 1+ unmute"; }
+        { keys = [ 115 ]; events = [ "key" "rep" ]; command = "${alsaUtils}/bin/amixer -q set Master ${config.sound.mediaKeys.volumeStep}+ unmute"; }
 
         # "Mic Mute" media key
         { keys = [ 190 ]; events = [ "key" ];       command = "${alsaUtils}/bin/amixer -q set Capture toggle"; }