about summary refs log tree commit diff
path: root/init/nixos.el
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2017-11-18T22·19+0100
committerVincent Ambo <tazjin@gmail.com>2017-11-18T22·19+0100
commit06cf685a88df067bd5812f06f1a60da9ed63e21a (patch)
treebecbbebdcbf970a6ffcd01ada6553fbeebbb1259 /init/nixos.el
parentf18e578c4b0caf241345a205d9a89d4151ccc85b (diff)
feat(nixos): Configure pulseaudio volume keys
Diffstat (limited to 'init/nixos.el')
-rw-r--r--init/nixos.el19
1 files changed, 17 insertions, 2 deletions
diff --git a/init/nixos.el b/init/nixos.el
index edeeca49d2..1c874dacdc 100644
--- a/init/nixos.el
+++ b/init/nixos.el
@@ -10,13 +10,23 @@
     (s-contains?
      "NixOS" (if (f-file? os-f) (f-read os-f)))))
 
+(defun pulseaudio-ctl (cmd)
+  (shell-command (concat "pulseaudio-ctl " cmd))
+  (message "Volume command: %s" cmd))
+
+(defun volume-mute () (interactive) (pulseaudio-ctl "mute"))
+(defun volume-up () (interactive) (pulseaudio-ctl "up"))
+(defun volume-down () (interactive) (pulseaudio-ctl "down"))
+
 (defun brightness-up ()
   (interactive)
-  (shell-command "exec light -A 10"))
+  (shell-command "exec light -A 10")
+  (message "Brightness increased"))
 
 (defun brightness-down ()
   (interactive)
-  (shell-command "exec light -U 10"))
+  (shell-command "exec light -U 10")
+  (message "Brightness decreased"))
 
 (defun lock-screen ()
   (interactive)
@@ -54,6 +64,11 @@
       ;; Toggle between line-mode / char-mode
       (exwm-input-set-key (kbd "C-c C-t C-t") #'exwm-input-toggle-keyboard)
 
+      ;; Volume keys
+      (exwm-input-set-key (kbd "<XF86AudioMute>") #'volume-mute)
+      (exwm-input-set-key (kbd "<XF86AudioRaiseVolume>") #'volume-up)
+      (exwm-input-set-key (kbd "<XF86AudioLowerVolume>") #'volume-down)
+
       ;; Brightness keys
       (exwm-input-set-key (kbd "<XF86MonBrightnessDown>") #'brightness-down)
       (exwm-input-set-key (kbd "<XF86MonBrightnessUp>") #'brightness-up)