diff options
author | Vincent Ambo <tazjin@gmail.com> | 2017-11-15T16·35+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@gmail.com> | 2017-11-15T16·35+0100 |
commit | 4e1661604d78d1a72c6a5203d0015c82c8ba684c (patch) | |
tree | 99cd39dc9ac4e9e2316e2fbbfc3a050738c444e9 /init/nixos.el | |
parent | 6225c1891424414a06f4b5a3a5a4c30312e24ace (diff) |
feat(nixos): Add initial NixOS & EXWM configuration
Adds configuratio for using Emacs as a window manager, because clear that is an extremely sane thing to do.
Diffstat (limited to 'init/nixos.el')
-rw-r--r-- | init/nixos.el | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/init/nixos.el b/init/nixos.el new file mode 100644 index 000000000000..ab62f81909df --- /dev/null +++ b/init/nixos.el @@ -0,0 +1,57 @@ +;; Configure additional settings if this is one of my NixOS machines +;; (i.e. if ExWM is required) +;; -*- lexical-binding: t; -*- + +(require 's) +(require 'f) + +(defvar is-nixos + (let ((os-f "/etc/os-release")) + (s-contains? + "NixOS" (if (f-file? os-f) (f-read os-f))))) + +(if is-nixos + (progn + (message "Running on NixOS, configuring ExWM.") + (require 'exwm) + (require 'exwm-config) + + ;; Start with one workspace (make more as needed) + (setq exwm-workspace-number 1) + ;; Make class name the buffer name + (add-hook 'exwm-update-class-hook + (lambda () + (exwm-workspace-rename-buffer exwm-class-name))) + + ;; 's-r': Reset + (exwm-input-set-key (kbd "s-r") #'exwm-reset) + ;; 's-w': Switch workspace + (exwm-input-set-key (kbd "s-w") #'exwm-workspace-switch) + ;; 's-N': Switch to certain workspace + (dotimes (i 10) + (exwm-input-set-key (kbd (format "s-%d" i)) + `(lambda () + (interactive) + (exwm-workspace-switch-create ,i)))) + + ;; Launch applications with completion (dmenu style!) + (exwm-input-set-key (kbd "s-p") #'helm-run-external-command) + + ;; Line-editing shortcuts + (exwm-input-set-simulation-keys + '(([?\C-b] . left) + ([?\C-f] . right) + ([?\C-p] . up) + ([?\C-n] . down) + ([?\C-a] . home) + ([?\C-e] . end) + ([?\M-v] . prior) + ([?\C-v] . next) + ([?\C-d] . delete) + ([?\C-k] . (S-end delete)))) + + ;; Enable EXWM + (exwm-enable) + (fringe-mode 1))) + +(provide 'nixos) |