Config: optimize exwm config.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
;;; init-exwm.el --- exwm config -*- lexical-binding: t -*-
|
||||
;;; init-exwm.el --- exwm config -*- lexical-binding: t -*-
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
(when *is-linux*
|
||||
(use-package exwm
|
||||
:config
|
||||
(setq exwm-workspace-number 5)
|
||||
(setq exwm-workspace-number 1)
|
||||
(exwm-input-set-key (kbd "s-&")
|
||||
(lambda (command)
|
||||
(interactive (list (read-shell-command "$ ")))
|
||||
@@ -15,6 +15,32 @@
|
||||
'((".*" . (display-buffer-no-window . nil)))))
|
||||
(async-shell-command command))))
|
||||
|
||||
(defun my--exwm-switch-to-workspace (delta)
|
||||
(let ((target
|
||||
(mod (+ exwm-workspace-current-index delta)
|
||||
(length exwm-workspace--list))))
|
||||
(exwm-workspace-switch target)
|
||||
(if (= 1 (length exwm-workspace--list))
|
||||
(message "Single workspace active"))))
|
||||
|
||||
(defun my-exwm-next-workspace ()
|
||||
"Switch to next exwm workspace."
|
||||
(interactive)
|
||||
(my--exwm-switch-to-workspace 1))
|
||||
|
||||
(defun my-exwm-previous-workspace ()
|
||||
"Switch to previous exwm workspace."
|
||||
(interactive)
|
||||
(my--exwm-switch-to-workspace -1))
|
||||
|
||||
(global-set-key (kbd "s-]") 'my-exwm-next-workspace)
|
||||
(global-set-key (kbd "s-[") 'my-exwm-previous-workspace)
|
||||
|
||||
(add-to-list 'global-mode-string
|
||||
'(:eval (propertize (format " WS:%d " exwm-workspace-current-index)
|
||||
'face 'mode-line-emphasis))
|
||||
t)
|
||||
|
||||
(setq exwm-input-prefix-keys
|
||||
'(?\C-x
|
||||
?\C-u
|
||||
@@ -22,12 +48,14 @@
|
||||
?\C-h
|
||||
?\M-x
|
||||
?\M-o
|
||||
?\M-]
|
||||
?\M-[
|
||||
XF86AudioLowerVolume
|
||||
XF86AudioRaiseVolume
|
||||
XF86AudioMute
|
||||
))
|
||||
?\M-[
|
||||
?\M-]
|
||||
?\s-[
|
||||
?\s-]
|
||||
XF86AudioLowerVolume
|
||||
XF86AudioRaiseVolume
|
||||
XF86AudioMute
|
||||
))
|
||||
|
||||
(define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)
|
||||
|
||||
@@ -40,6 +68,7 @@
|
||||
([?\s-S] . desktop-environment-screenshot)
|
||||
([?\s-s] . desktop-environment-screenshot-part)
|
||||
([?\s-w] . exwm-workspace-switch)
|
||||
([?\s-o] . other-window)
|
||||
([?\s-`] . (lambda () (interactive) (exwm-workspace-switch-create 0)))
|
||||
,@(mapcar (lambda (i)
|
||||
`(,(kbd(format "s-%d" i)) .
|
||||
@@ -59,25 +88,43 @@
|
||||
(exwm-wm-mode))
|
||||
|
||||
(use-package desktop-environment
|
||||
:config
|
||||
:init
|
||||
(desktop-environment-mode)
|
||||
:config
|
||||
(advice-add 'desktop-environment-screenshot :after
|
||||
(lambda (&rest _) (message "Saved fullscreen screenshot.")))
|
||||
(advice-add 'desktop-environment-screenshot-part :after
|
||||
(lambda (&rest _) (message "Saved partial screenshot.")))
|
||||
|
||||
:custom
|
||||
(desktop-environment-screenshot-command
|
||||
"import -window root ~/Pictures/screenshot-$(date +%Y%m%d-%H%M%S).png")
|
||||
(desktop-environment-screenshot-partial-command
|
||||
"import ~/Pictures/screenshot-$(date +%Y%m%d-%H%M%S).png"))
|
||||
|
||||
(defun vscodium ()
|
||||
"Run VSCodium via shell command asynchronously."
|
||||
(interactive)
|
||||
(start-process-shell-command "vscodium" nil "flatpak run com.vscodium.codium"))
|
||||
|
||||
(defun localsend ()
|
||||
"Run localsend via shell command asynchronously."
|
||||
(interactive)
|
||||
(start-process-shell-command "localsend" nil "flatpak run org.localsend.localsend_app"))
|
||||
|
||||
(defun steam ()
|
||||
"Run Steam via shell command asynchronously."
|
||||
(interactive)
|
||||
(start-process-shell-command "steam" nil "flatpak run com.valvesoftware.Steam"))
|
||||
|
||||
(add-hook 'exwm-init-hook
|
||||
(lambda ()
|
||||
(unless (zerop (shell-command "pgrep -x fcitx5"))
|
||||
(start-process-shell-command "fcitx5" nil "fcitx5 -d"))
|
||||
(unless (zerop (shell-command "pgrep -x mihomo"))
|
||||
(start-process-shell-command "mihomo" nil "mihomo -d ~/.config/mihomo/"))
|
||||
(message "fcitx5 enable.")))
|
||||
(start-process-shell-command "xrandr-refresh" nil "xrandr --output DP-4 --mode 2560x1440 --rate 165.00")
|
||||
(start-process-shell-command "xinput" nil "xinput set-prop 12 'libinput Accel Speed' -0.45")))
|
||||
)
|
||||
|
||||
(provide 'init-exwm)
|
||||
|
||||
Reference in New Issue
Block a user