summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorRobin Gloster <mail@glob.in>2016-01-17 21:57:58 +0100
committerRobin Gloster <mail@glob.in>2016-01-17 21:57:58 +0100
commit101125d1844ba2dbc8e21c546a0ec77ea5db02ce (patch)
tree592ee76897486f2e1853fb1a44df8b4fb873a179 /nixos
parent0ef8fa011f6a16ee1bf33ed5b7ce386290ec91df (diff)
parent93279824861d6a8eab9babab04dec503c854225e (diff)
downloadnixpkgs-101125d1844ba2dbc8e21c546a0ec77ea5db02ce.tar
nixpkgs-101125d1844ba2dbc8e21c546a0ec77ea5db02ce.tar.gz
nixpkgs-101125d1844ba2dbc8e21c546a0ec77ea5db02ce.tar.bz2
nixpkgs-101125d1844ba2dbc8e21c546a0ec77ea5db02ce.tar.lz
nixpkgs-101125d1844ba2dbc8e21c546a0ec77ea5db02ce.tar.xz
nixpkgs-101125d1844ba2dbc8e21c546a0ec77ea5db02ce.tar.zst
nixpkgs-101125d1844ba2dbc8e21c546a0ec77ea5db02ce.zip
Merge pull request #12441 from k0ral/acpid
Add volume and cd events to acpid configuration
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/hardware/acpid.nix93
1 files changed, 92 insertions, 1 deletions
diff --git a/nixos/modules/services/hardware/acpid.nix b/nixos/modules/services/hardware/acpid.nix
index e3421899d36..48b2b6be09e 100644
--- a/nixos/modules/services/hardware/acpid.nix
+++ b/nixos/modules/services/hardware/acpid.nix
@@ -20,7 +20,7 @@ let
       }
     '';
 
-  events = [powerEvent lidEvent acEvent];
+  events = [powerEvent lidEvent acEvent muteEvent volumeDownEvent volumeUpEvent cdPlayEvent cdNextEvent cdPrevEvent];
 
   # Called when the power button is pressed.
   powerEvent =
@@ -55,6 +55,61 @@ let
         '';
     };
 
+  muteEvent = {
+    name = "mute";
+    event = "button/mute.*";
+    action = ''
+      #! ${pkgs.bash}/bin/sh
+      ${config.services.acpid.muteCommands}
+    '';
+  };
+
+  volumeDownEvent = {
+    name = "volume-down";
+    event = "button/volumedown.*";
+    action = ''
+      #! ${pkgs.bash}/bin/sh
+      ${config.services.acpid.volumeDownEventCommands}
+    '';
+  };
+
+  volumeUpEvent = {
+    name = "volume-up";
+    event = "button/volumeup.*";
+    action = ''
+      #! ${pkgs.bash}/bin/sh
+      ${config.services.acpid.volumeUpEventCommands}
+    '';
+  };
+
+  cdPlayEvent = {
+    name = "cd-play";
+    event = "cd/play.*";
+    action = ''
+      #! ${pkgs.bash}/bin/sh
+      ${config.services.acpid.cdPlayEventCommands}
+    '';
+  };
+
+  cdNextEvent = {
+    name = "cd-next";
+    event = "cd/next.*";
+    action = ''
+      #! ${pkgs.bash}/bin/sh
+      ${config.services.acpid.cdNextEventCommands}
+    '';
+  };
+
+  cdPrevEvent = {
+    name = "cd-prev";
+    event = "cd/prev.*";
+    action = ''
+      #! ${pkgs.bash}/bin/sh
+      ${config.services.acpid.cdPrevEventCommands}
+    '';
+  };
+
+
 in
 
 {
@@ -89,6 +144,42 @@ in
         description = "Shell commands to execute on an ac_adapter.* event.";
       };
 
+      muteCommands = mkOption {
+        type = types.lines;
+        default = "";
+        description = "Shell commands to execute on an button/mute.* event.";
+      };
+
+      volumeDownEventCommands = mkOption {
+        type = types.lines;
+        default = "";
+        description = "Shell commands to execute on an button/volumedown.* event.";
+      };
+
+      volumeUpEventCommands = mkOption {
+        type = types.lines;
+        default = "";
+        description = "Shell commands to execute on an button/volumeup.* event.";
+      };
+
+      cdPlayEventCommands = mkOption {
+        type = types.lines;
+        default = "";
+        description = "Shell commands to execute on an cd/play.* event.";
+      };
+
+      cdNextEventCommands = mkOption {
+        type = types.lines;
+        default = "";
+        description = "Shell commands to execute on an cd/next.* event.";
+      };
+
+      cdPrevEventCommands = mkOption {
+        type = types.lines;
+        default = "";
+        description = "Shell commands to execute on an cd/prev.* event.";
+      };
+
     };
 
   };