86 lines
2.8 KiB
EmacsLisp
86 lines
2.8 KiB
EmacsLisp
;;; init-exwm.el --- exwm config -*- lexical-binding: t -*-
|
|
|
|
;;; Commentary:
|
|
|
|
;;; Code:
|
|
|
|
(when *is-linux*
|
|
(use-package exwm
|
|
:config
|
|
(setq exwm-workspace-number 5)
|
|
(exwm-input-set-key (kbd "s-&")
|
|
(lambda (command)
|
|
(interactive (list (read-shell-command "$ ")))
|
|
(let ((display-buffer-alist
|
|
'((".*" . (display-buffer-no-window . nil)))))
|
|
(async-shell-command command))))
|
|
|
|
(setq exwm-input-prefix-keys
|
|
'(?\C-x
|
|
?\C-u
|
|
?\C-c
|
|
?\C-h
|
|
?\M-x
|
|
?\M-o
|
|
?\M-]
|
|
?\M-[
|
|
XF86AudioLowerVolume
|
|
XF86AudioRaiseVolume
|
|
XF86AudioMute
|
|
))
|
|
|
|
(define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)
|
|
|
|
(setq exwm-input-global-keys
|
|
`(([?\s-r] . exwm-reset)
|
|
([?\s-b] . windmove-left)
|
|
([?\s-f] . windmove-right)
|
|
([?\s-p] . windmove-up)
|
|
([?\s-n] . windmove-down)
|
|
([?\s-S] . desktop-environment-screenshot)
|
|
([?\s-s] . desktop-environment-screenshot-part)
|
|
([?\s-w] . exwm-workspace-switch)
|
|
([?\s-`] . (lambda () (interactive) (exwm-workspace-switch-create 0)))
|
|
,@(mapcar (lambda (i)
|
|
`(,(kbd(format "s-%d" i)) .
|
|
(lambda ()
|
|
(interactive)
|
|
(exwm-workspace-switch-create ,i))))
|
|
(number-sequence 0 9))))
|
|
|
|
(defun my/exwm-update-class ()
|
|
(exwm-workspace-rename-buffer exwm-class-name))
|
|
|
|
(add-hook 'exwm-update-class-hook #'my/exwm-update-class)
|
|
|
|
(require 'exwm-xim)
|
|
(exwm-xim-mode)
|
|
|
|
(exwm-wm-mode))
|
|
|
|
(use-package desktop-environment
|
|
:config
|
|
(desktop-environment-mode)
|
|
(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"))
|
|
|
|
(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.")))
|
|
)
|
|
|
|
(provide 'init-exwm)
|
|
|
|
;;; init-exwm.el ends here
|