about summary refs log tree commit diff
path: root/init/nixos.el
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2017-11-17T15·12+0100
committerVincent Ambo <tazjin@gmail.com>2017-11-17T15·12+0100
commit051c1116465141e0f5a9cf71bb0b08de06f7d874 (patch)
tree907a6cfce12677459c71204f55f761517875aee6 /init/nixos.el
parent78f65fbc183556a98a23a7ed319f3384ae8b76db (diff)
feat(nixos): Map brightness keys to light command
Diffstat (limited to 'init/nixos.el')
-rw-r--r--init/nixos.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/init/nixos.el b/init/nixos.el
index b84624aa7d9c..28b5f7fcb84d 100644
--- a/init/nixos.el
+++ b/init/nixos.el
@@ -10,6 +10,14 @@
     (s-contains?
      "NixOS" (if (f-file? os-f) (f-read os-f)))))
 
+(defun brightness-up ()
+  (interactive)
+  (shell-command "exec light -A 10"))
+
+(defun brightness-down ()
+  (interactive)
+  (shell-command "exec light -U 10"))
+
 (if is-nixos
     (progn
       (message "Running on NixOS, configuring ExWM.")
@@ -42,6 +50,10 @@
       ;; Toggle between line-mode / char-mode
       (exwm-input-set-key (kbd "C-c C-t C-t") #'exwm-input-toggle-keyboard)
 
+      ;; Brightness keys
+      (exwm-input-set-key (kbd "<XF86MonBrightnessDown>") #'brightness-down)
+      (exwm-input-set-key (kbd "<XF86MonBrightnessUp>") #'brightness-up)
+
       ;; Line-editing shortcuts
       (exwm-input-set-simulation-keys
        '(([?\C-d] . delete)