Config: install xdg-launcher for exwm

This commit is contained in:
2026-05-07 00:38:00 +08:00
parent c45c46d8f3
commit 00113ef0d4

View File

@@ -15,23 +15,34 @@
'((".*" . (display-buffer-no-window . nil)))))
(async-shell-command command))))
(defun restart-fcitx5 ()
"Kill and restart fcitx5, to fix random issues in exwm."
(interactive)
(if (zerop (shell-command "pgrep fcitx5"))
(progn
(eshell-command "pkill fcitx5")
(eshell-command "fcitx5 -d"))
(eshell-command "fcitx5 -d")))
(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"))))
(exwm-workspace-switch target)))
(defun my-exwm-next-workspace ()
"Switch to next exwm workspace."
(interactive)
(my--exwm-switch-to-workspace 1))
(my--exwm-switch-to-workspace 1)
(if (= 1 (length exwm-workspace--list))
(message "No next workspace")))
(defun my-exwm-previous-workspace ()
"Switch to previous exwm workspace."
(interactive)
(my--exwm-switch-to-workspace -1))
(my--exwm-switch-to-workspace -1)
(if (= 1 (length exwm-workspace--list))
(message "No previous workspace")))
(global-set-key (kbd "s-]") 'my-exwm-next-workspace)
(global-set-key (kbd "s-[") 'my-exwm-previous-workspace)
@@ -52,6 +63,7 @@
?\M-]
?\s-[
?\s-]
?\s-
XF86AudioLowerVolume
XF86AudioRaiseVolume
XF86AudioMute
@@ -110,6 +122,16 @@
(start-process-shell-command "mihomo" nil "mihomo -d ~/.config/mihomo/"))
(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")))
(use-package xdg-launcher
:straight (xdg-launcher :type git
:host github
:repo "emacs-exwm/xdg-launcher")
:bind (("s-SPC" . xdg-launcher-run-app))
:init (with-eval-after-load 'consult
(unless (memq 'xdg-launcher-consult-source consult-buffer-sources)
(setq consult-buffer-sources
(append consult-buffer-sources '(xdg-launcher-consult-source))))))
)
(provide 'init-exwm)