emacs: various exwm tweaks
authorAmin Bandali <bandali@gnu.org>
Thu, 5 Sep 2019 20:20:13 +0000 (16:20 -0400)
committerAmin Bandali <bandali@gnu.org>
Thu, 5 Sep 2019 20:20:30 +0000 (16:20 -0400)
TODO: fix/improve key bindings

.emacs.d/init.el

index f1f4b1f..d4baa88 100644 (file)
@@ -642,6 +642,35 @@ needed."
 
   (exwm-input-set-key (kbd "M-s-SPC") #'counsel-linux-app)
 
+  (exwm-input-set-key
+   (kbd "s-<return>") (lambda ()
+                        (interactive)
+                        (b/start-process "urxvt")))
+
+  (exwm-input-set-key
+   (kbd "s-t")
+   (lambda ()
+     (interactive)
+     (exwm-floating-toggle-floating)))
+
+  (exwm-input-set-key
+   (kbd "s-f")
+   (lambda ()
+     (interactive)
+     (exwm-layout-toggle-fullscreen)))
+
+  (exwm-input-set-key
+   (kbd "s-w")
+   (lambda ()
+     (interactive)
+     (kill-buffer (current-buffer))))
+
+  (exwm-input-set-key
+   (kbd "s-q")
+   (lambda ()
+     (interactive)
+     (exwm-manage--kill-client)))
+
   ;; Shorten 'C-c C-q' to 'C-q'
   (define-key exwm-mode-map [?\C-q] #'exwm-input-send-next-key)
 
@@ -659,13 +688,17 @@ needed."
       ([?\M-v] . [prior])
       ([?\C-v] . [next])
       ([?\C-d] . [delete])
-      ([?\C-k] . [S-end delete])
+      ([?\C-k] . [S-end ?\C-x])
       ;; cut/copy/paste
-      ;; ([?\C-w] . [?\C-x])
+      ([?\C-w] . [?\C-x])
       ([?\M-w] . [?\C-c])
       ([?\C-y] . [?\C-v])
+      ([?\M-d] . [C-S-right ?\C-x])
+      ([?\M-\d] . [C-S-left ?\C-x])
       ;; search
-      ([?\C-s] . [?\C-f])))
+      ([?\C-s] . [?\C-f])
+      ;; escape
+      ([?\C-g] . [escape])))
 
   ;; Enable EXWM
   (exwm-enable)
@@ -678,12 +711,6 @@ needed."
   (require 'exwm-randr)
   (exwm-randr-enable)
 
-  ;; (exwm-input-set-key
-  ;;  (kbd "s-<return>")
-  ;;  (lambda ()
-  ;;    (interactive)
-  ;;    (start-process "urxvt" nil "urxvt")))
-
   ;; (exwm-input-set-key
   ;;  (kbd "s-SPC")  ;; rofi doesn't properly launch programs when started from emacs
   ;;  (lambda ()
@@ -702,23 +729,23 @@ needed."
   ;;    (interactive)
   ;;    (start-process "rofi-pass" nil "rofi-pass")))
 
-  ;; (exwm-input-set-key
-  ;;  (kbd "<XF86AudioMute>")
-  ;;  (lambda ()
-  ;;    (interactive)
-  ;;    (start-process-shell-command "pamixer" nil "pamixer --toggle-mute")))
+  (exwm-input-set-key
+   (kbd "<XF86AudioMute>")
+   (lambda ()
+     (interactive)
+     (start-process-shell-command "pamixer" nil "pamixer --toggle-mute")))
 
-  ;; (exwm-input-set-key
-  ;;  (kbd "<XF86AudioLowerVolume>")
-  ;;  (lambda ()
-  ;;    (interactive)
-  ;;    (start-process-shell-command "pamixer" nil "pamixer --allow-boost --decrease 5")))
+  (exwm-input-set-key
+   (kbd "<XF86AudioLowerVolume>")
+   (lambda ()
+     (interactive)
+     (start-process-shell-command "pamixer" nil "pamixer --allow-boost --decrease 5")))
 
-  ;; (exwm-input-set-key
-  ;;  (kbd "<XF86AudioRaiseVolume>")
-  ;;  (lambda ()
-  ;;    (interactive)
-  ;;    (start-process-shell-command "pamixer" nil "pamixer --allow-boost --increase 5")))
+  (exwm-input-set-key
+   (kbd "<XF86AudioRaiseVolume>")
+   (lambda ()
+     (interactive)
+     (start-process-shell-command "pamixer" nil "pamixer --allow-boost --increase 5")))
 
   ;; (exwm-input-set-key
   ;;  (kbd "<XF86AudioPlay>")
@@ -738,16 +765,15 @@ needed."
   ;;    (interactive)
   ;;    (start-process-shell-command "mpc" nil "mpv next")))
 
-  (comment
-    (defun b/exwm-pasystray ()
-      "A command used to start pasystray."
-      (interactive)
-      (if (executable-find "pasystray")
-          (progn
-            (message "EXWM: starting pasystray ...")
-            (start-process-shell-command "pasystray" nil "pasystray --notify=all"))
-        (message "EXWM: pasystray is not installed, abort!")))
-    (add-hook 'exwm-init-hook #'b/exwm-pasystray))
+  (defun b/exwm-pasystray ()
+    "A command used to start pasystray."
+    (interactive)
+    (if (executable-find "pasystray")
+        (progn
+          (message "EXWM: starting pasystray ...")
+          (start-process-shell-command "pasystray" nil "pasystray --notify=all"))
+      (message "EXWM: pasystray is not installed, abort!")))
+  ;; (add-hook 'exwm-init-hook #'b/exwm-pasystray)
 
   (defun b/exwm-nm-applet ()
     "A command used to start nm-applet."
@@ -757,31 +783,18 @@ needed."
           (message "EXWM: starting nm-applet ...")
           (start-process-shell-command "nm-applet" nil "nm-applet"))
       (message "EXWM: nm-applet is not installed, abort!")))
-  (add-hook 'exwm-init-hook #'b/exwm-nm-applet)
-
-  (exwm-input-set-key
-   (kbd "s-t")
-   (lambda ()
-     (interactive)
-     (exwm-floating-toggle-floating)))
+  ;; (add-hook 'exwm-init-hook #'b/exwm-nm-applet)
 
-  (exwm-input-set-key
-   (kbd "s-f")
-   (lambda ()
-     (interactive)
-     (exwm-layout-toggle-fullscreen)))
-
-  (exwm-input-set-key
-   (kbd "s-w")
-   (lambda ()
-     (interactive)
-     (kill-buffer (current-buffer))))
-
-  (exwm-input-set-key
-   (kbd "s-q")
-   (lambda ()
-     (interactive)
-     (exwm-manage--kill-client))))
+  (defun b/exwm-light-locker ()
+    "Start light-locker to make `dm-tool lock' actually work."
+    (interactive)
+    (if (executable-find "light-locker")
+        (progn
+          (message "EXWM: starting light-locker ...")
+          (start-process-shell-command "light-locker" nil "light-locker --lock-on-suspend"))
+      (message "EXWM: light-locker is not installed, abort!")))
+  ;;(add-hook 'exwm-init-hook #'b/exwm-light-locker)
+  )
 
 ;; use the org-plus-contrib package to get the whole deal
 (use-package org-plus-contrib)