* .emacs.d/init.el: Show system volumes in mode-line.
[~bandali/configs] / .emacs.d / lisp / bandali-exwm.el
index 92f9b31..4cd2d1c 100644 (file)
@@ -27,8 +27,7 @@
 (add-to-list 'load-path (b/lisp "xelb"))
 (add-to-list 'load-path (b/lisp "exwm"))
 (require 'exwm)
-(setq ;; exwm-replace t
-      exwm-workspace-show-all-buffers t)
+;; (setq exwm-replace t)
 ;; make class name the buffer name, truncating beyond 60 characters
 (defun b/exwm-rename-buffer ()
   (interactive)
@@ -90,30 +89,26 @@ around if needed."
  exwm-workspace-number 10
  exwm-input-global-keys
  `(([?\s-R] . exwm-reset)
-   ([?\s-b] . exwm-workspace-switch-to-buffer)
-   ([?\s-\\] . exwm-workspace-switch)
+   ;; ([?\s-b] . exwm-workspace-switch-to-buffer)
+   ([?\s-/] . exwm-workspace-switch)
    ([?\s-\s] . dmenu)
-   ;; ([?\s-\s] . (lambda ()
-   ;;               (interactive)
-   ;;               (start-process-shell-command
-   ;;                "rofi" nil "rofi -show run")))
-   ([?\S-\s-\s] . (lambda (command)    ; doesn't work in X windows
+   ([?\s-\\] . (lambda ()
+                 (interactive)
+                 (start-process-shell-command
+                  "passmenu" nil "passmenu --type")))
+   ([?\S-\s-\s] . (lambda (command)
                     (interactive
                      (list (read-shell-command "➜ ")))
                     (start-process-shell-command
                      command nil command)))
    ([s-return] . (lambda ()
                    (interactive)
-                   (start-process "" nil "urxvt")))
+                   (start-process "" nil "xterm")))
    ([S-s-return] . (lambda ()
                      (interactive)
-                     (start-process "" nil "urxvt"
+                     (start-process "" nil "xterm"
                                     "-name" "floating")))
    ([?\C-\s-\s] . counsel-linux-app)
-   ([?\M-\s-\s] . (lambda ()
-                    (interactive)
-                    (start-process-shell-command
-                     "rofi-pass" nil "rofi-pass")))
    ([?\s-h] . windmove-left)
    ([?\s-j] . windmove-down)
    ([?\s-k] . windmove-up)
@@ -171,7 +166,7 @@ around if needed."
             (interactive)
             (exwm-workspace-move-window ,i))))
       (number-sequence 0 (1- exwm-workspace-number)))
-   ([?\s-F] . exwm-floating-toggle-floating)
+   ([?\s-.] . exwm-floating-toggle-floating)
    ([?\s-f] . exwm-layout-toggle-fullscreen)
    ([?\s-W] . (lambda ()
                 (interactive)
@@ -182,30 +177,67 @@ around if needed."
    ([?\s-\'] . (lambda ()
                  (interactive)
                  (start-process-shell-command
-                  "rofi-light" nil "rofi-light")))
+                  "dmneu-light" nil "dmenu-light")))
+   ([?\s-\;] . (lambda ()
+                 (interactive)
+                 (start-process-shell-command
+                  "dmneu-pamixer" nil "dmenu-pamixer")
+                 (b/set-volume-level (b/get-volume-level))
+                 (force-mode-line-update)))
    ([XF86AudioMute] .             ; borken on my X200 :-(
     (lambda ()
       (interactive)
-      (start-process "" nil "pamixer" "--toggle-mute")))
+      (start-process "" nil "pamixer" "--toggle-mute")
+      (b/set-volume-mute (b/get-volume-mute))
+      (force-mode-line-update)))
+   ([\s-XF86AudioMute] .            ; toggle mic mute
+    (lambda ()
+      (interactive)
+      (start-process
+       "" nil "pamixer" "--default-source" "--toggle-mute")
+      (b/set-volume-mute (b/get-volume-mute 'mic) 'mic)
+      (force-mode-line-update)))
    ([XF86Launch1] .
     (lambda ()
       (interactive)
-      (start-process "" nil "pamixer" "--toggle-mute")))
+      (start-process "" nil "pamixer" "--toggle-mute")
+      (b/set-volume-mute (b/get-volume-mute))
+      (force-mode-line-update)))
    ([\s-XF86Launch1] .            ; toggle mic mute
     (lambda ()
       (interactive)
       (start-process
-       "" nil "pamixer" "--default-source" "--toggle-mute")))
+       "" nil "pamixer" "--default-source" "--toggle-mute")
+      (b/set-volume-mute (b/get-volume-mute 'mic) 'mic)
+      (force-mode-line-update)))
    ([XF86AudioLowerVolume] .
     (lambda ()
       (interactive)
       (start-process
-       "" nil "pamixer" "--allow-boost" "--decrease" "5")))
+       "" nil "pamixer" "--allow-boost" "--decrease" "5")
+      (b/set-volume-level (b/get-volume-level))
+      (force-mode-line-update)))
    ([XF86AudioRaiseVolume] .
     (lambda ()
       (interactive)
       (start-process
-       "" nil "pamixer" "--allow-boost" "--increase" "5")))
+       "" nil "pamixer" "--allow-boost" "--increase" "5")
+      (b/set-volume-level (b/get-volume-level))
+      (force-mode-line-update)))
+   ([\s-XF86AudioLowerVolume] .
+    (lambda ()
+      (interactive)
+      (start-process
+       "" nil "pamixer" "--default-source" "--decrease" "5")
+      (b/set-volume-level (b/get-volume-level 'mic) 'mic)
+      (force-mode-line-update)))
+   ([\s-XF86AudioRaiseVolume] .
+    (lambda ()
+      (interactive)
+      (start-process
+       "" nil "pamixer" "--default-source" "--increase" "5")
+      (b/set-volume-level (b/get-volume-level 'mic) 'mic)
+      (force-mode-line-update)))
    ([XF86AudioPlay] .
     (lambda ()
       (interactive)
@@ -228,8 +260,8 @@ around if needed."
       (start-process "" nil "light" "-A" "5")))
    ([XF86ScreenSaver] .
     (lambda ()
-         (interactive)
-         (start-process "" nil "dm-tool" "lock")))
+      (interactive)
+      (start-process "" nil "dm-tool" "lock")))
    ([\s-XF86Back] . previous-buffer)
    ([\s-XF86Forward] . next-buffer)))
 
@@ -262,8 +294,10 @@ around if needed."
    ([?\s-q] . [?\C-q])
    ;; misc
    ([?\C-s] . [?\C-f])
+   ([?\s-g] . [?\C-g])
    ([?\s-s] . [?\C-s])
-   ([?\C-g] . [escape])))
+   ([?\C-g] . [escape])
+   ([?\C-/] . [?\C-z])))
 
 (require 'exwm-manage)
 (setq
@@ -279,7 +313,7 @@ around if needed."
                 (exwm-input-set-local-simulation-keys
                  `(,@exwm-input-simulation-keys
                    ([?\C-\S-d] . [?\C-d]))))
-               ((member exwm-class-name '("URxvt" "Mate-terminal"))
+               ((member exwm-class-name '("XTerm" "Mate-terminal"))
                 (exwm-input-set-local-simulation-keys
                  '(([?\C-c ?\C-c] . [?\C-c])
                    ([?\C-c ?\C-u] . [?\C-u]))))
@@ -309,5 +343,19 @@ around if needed."
 (add-to-list 'load-path (b/lisp "exwm-edit"))
 (require 'exwm-edit)
 
+(with-eval-after-load 'exwm-workspace
+  (setq exwm-workspace-show-all-buffers t)
+  (setq-default
+   mode-line-format
+   (append
+    mode-line-format
+    '((:eval
+       (format
+        " [%s]" (number-to-string
+                 exwm-workspace-current-index)))))))
+
+(with-eval-after-load 'exwm-layout
+  (setq exwm-layout-show-all-buffers t))
+
 (provide 'bandali-exwm)
 ;;; bandali-exwm.el ends here