Files
exwm-init-el/exwm-init.el
2026-03-26 01:11:50 -07:00

107 lines
3.6 KiB
EmacsLisp

(require 'emms)
(emms-all)
(setq emms-player-list '(emms-player-mpv))
(require 'exwm)
(require 'exwm-config)
;; (exwm-config-default)
;; (server-start)
(setq exwm-workspace-number 5)
(add-hook 'exwm-update-class-hook
(lambda ()
(unless (or (string-prefix-p "sun-awt-X11-" exwm-instance-name)
(string= "gimp" exwm-instance-name))
(exwm-workspace-rename-buffer exwm-class-name))))
(add-hook 'exwm-update-title-hook
(lambda ()
(when (or (not exwm-instance-name)
(string-prefix-p "sun-awt-X11-" exwm-instance-name)
(string= "gimp" exwm-instance-name))
(exwm-workspace-rename-buffer exwm-title))))
;; Global keybindings can be defined with `exwm-input-global-keys'.
;; Here are a few examples:
(setq exwm-input-global-keys
`(
;; Bind "s-r" to exit char-mode and fullscreen mode.
([?\s-r] . exwm-reset)
;; Bind "s-w" to switch workspace interactively.
([?\s-w] . exwm-workspace-switch)
;; Bind "s-0" to "s-9" to switch to a workspace by its index.
([?\s-W] . exwm-workspace-move-window)
,@(mapcar (lambda (i)
`(,(kbd (format "s-%d" i)) .
(lambda ()
(interactive)
(exwm-workspace-switch-create ,i))))
(append (number-sequence 1 9) '(0)))
;; Bind "s-&" to launch applications ('M-&' also works if the output
;; buffer does not bother you).
([?\s-&] . (lambda (command)
(interactive (list (read-shell-command "$ ")))
(start-process-shell-command command nil command)))
([?\s-p] . (lambda (command)
(interactive (list (read-shell-command "$ ")))
(let ((warning-minimum-level :emergency))
(start-process-shell-command command nil command))))
;; ([?\s-P] . password-store-copy)
))
(defun vol-up () (interactive) (start-process-shell-command "sound" nil "sound up"))
(defun vol-down () (interactive) (start-process-shell-command "sound" nil "sound down"))
(defun vol-mute () (interactive) (start-process-shell-command "sound" nil "sound toggle"))
(exwm-input-set-key [?\s-f] 'exwm-layout-toggle-fullscreen)
(exwm-input-set-key (kbd "<XF86AudioRaiseVolume>")
'vol-up)
(exwm-input-set-key (kbd "<XF86AudioLowerVolume>")
'vol-down)
(exwm-input-set-key (kbd "<XF86AudioMute>")
'vol-mute)
(exwm-input-set-key (kbd "C-~") 'cb-stream-list)
(exwm-input-set-key (kbd "C-\`") 'transparency-toggle)
(exwm-input-set-key (kbd "<s-escape>") 'cb-kill)
(exwm-input-set-key (kbd "s-\`") 'cb-screenshot)
(exwm-input-set-key [?\s-s] 'multi-vterm)
(exwm-input-set-key [?\s-P] 'password-store-copy)
;; (exwm-input-set-key [?\M-x] 'counsel-M-x)
(defun xprop-set-alpha ()
"set a windows opacity"
(interactive)
(shell-command "xprop -format _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY 0x7FFFFFFF" nil nil))
;; (setq exwm-input-simulation-keys
;; '(
;; ;; movement
;; ;; ([?\C-b] . [left])
;; ;; ([?\M-b] . [C-left])
;; ;; ([?\C-f] . [right])
;; ;; ([?\M-f] . [C-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])
;; ([?\C-m] . [enter])
;; ;; cut/paste.
;; ;; ([?\C-w] . [?\C-x])
;; ;; ([?\M-w] . [?\C-c])
;; ;; ([?\C-y] . [?\C-v])
;; ;; search
;; ([?\C-s] . [?\C-f])))
(exwm-enable)
(provide 'exwm-init)