From 00113ef0d43bc88673cd514b54f431ea132f2708 Mon Sep 17 00:00:00 2001 From: andsy10 Date: Thu, 7 May 2026 00:38:00 +0800 Subject: [PATCH] Config: install xdg-launcher for exwm --- lisp/init-exwm.el | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/lisp/init-exwm.el b/lisp/init-exwm.el index fa49120..cb0fc2a 100644 --- a/lisp/init-exwm.el +++ b/lisp/init-exwm.el @@ -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)