mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-10 19:23:03 +03:00
feat(exwm): floating windows & auto-assign
This commit is contained in:
parent
dcdb7d0109
commit
5ae655b39c
2 changed files with 60 additions and 10 deletions
|
|
@ -123,9 +123,7 @@ _v_: VK
|
|||
_s_: Slack
|
||||
_d_: Discord
|
||||
"
|
||||
("t" (lambda () (interactive)
|
||||
(persp-switch "term")
|
||||
(my/run-in-background "alacritty")))
|
||||
("t" (lambda () (interactive) (my/run-in-background "alacritty")))
|
||||
("b" (lambda () (interactive) (my/run-in-background "firefox")))
|
||||
("v" (lambda () (interactive) (my/run-in-background "vk")))
|
||||
("s" (lambda () (interactive) (my/run-in-background "slack-wrapper")))
|
||||
|
|
@ -135,6 +133,23 @@ _d_: Discord
|
|||
(interactive)
|
||||
(my/run-in-background "i3lock -f -i /home/pavel/Pictures/lock-wallpaper.png"))
|
||||
|
||||
(defun my/exwm-configure-window ()
|
||||
(interactive)
|
||||
(pcase exwm-class-name
|
||||
((or "Firefox" "Nightly")
|
||||
(perspective-exwm-assign-window
|
||||
:workspace-index 2
|
||||
:persp-name "browser"))
|
||||
("Alacritty"
|
||||
(perspective-exwm-assign-window
|
||||
:persp-name "term"))
|
||||
((or "VK" "Slack" "Discord" "TelegramDesktop")
|
||||
(perspective-exwm-assign-window
|
||||
:workspace-index 3
|
||||
:persp-name "comms"))))
|
||||
|
||||
(add-hook 'exwm-manage-finish-hook #'my/exwm-configure-window)
|
||||
|
||||
(defun my/exwm-update-global-keys ()
|
||||
(interactive)
|
||||
(setq exwm-input--global-keys nil)
|
||||
|
|
@ -143,6 +158,13 @@ _d_: Discord
|
|||
(when exwm--connection
|
||||
(exwm-input--update-global-prefix-keys)))
|
||||
|
||||
(defun my/fix-exwm-floating-windows ()
|
||||
(setq-local exwm-workspace-warp-cursor nil)
|
||||
(setq-local mouse-autoselect-window nil)
|
||||
(setq-local focus-follows-mouse nil))
|
||||
|
||||
(add-hook 'exwm-floating-setup-hook #'my/fix-exwm-floating-windows)
|
||||
|
||||
(defun my/exwm-init ()
|
||||
(exwm-workspace-switch 1)
|
||||
|
||||
|
|
@ -206,11 +228,11 @@ _d_: Discord
|
|||
|
||||
(general-define-key
|
||||
:keymaps '(exwm-mode-map)
|
||||
"C-q" 'exwm-input-send-next-key
|
||||
"C-q" #'exwm-input-send-next-key
|
||||
"<print>" (my/app-command "flameshot gui")
|
||||
"<mode-line> s-<mouse-4>" 'perspective-exwm-cycle-exwm-buffers-backward
|
||||
"<mode-line> s-<mouse-5>" 'perspective-exwm-cycle-exwm-buffers-forward
|
||||
"M-x" 'counsel-M-x
|
||||
"<mode-line> s-<mouse-4>" #'perspective-exwm-cycle-exwm-buffers-backward
|
||||
"<mode-line> s-<mouse-5>" #'perspective-exwm-cycle-exwm-buffers-forward
|
||||
"M-x" #'counsel-M-x
|
||||
"M-SPC" (general-key "SPC"))
|
||||
(setq exwm-input-simulation-keys `((,(kbd "M-w") . ,(kbd "C-w"))
|
||||
(,(kbd "M-c") . ,(kbd "C-c"))))
|
||||
|
|
|
|||
34
Desktop.org
34
Desktop.org
|
|
@ -527,9 +527,7 @@ _v_: VK
|
|||
_s_: Slack
|
||||
_d_: Discord
|
||||
"
|
||||
("t" (lambda () (interactive)
|
||||
(persp-switch "term")
|
||||
(my/run-in-background "alacritty")))
|
||||
("t" (lambda () (interactive) (my/run-in-background "alacritty")))
|
||||
("b" (lambda () (interactive) (my/run-in-background "firefox")))
|
||||
("v" (lambda () (interactive) (my/run-in-background "vk")))
|
||||
("s" (lambda () (interactive) (my/run-in-background "slack-wrapper")))
|
||||
|
|
@ -543,6 +541,27 @@ Run i3lock.
|
|||
(interactive)
|
||||
(my/run-in-background "i3lock -f -i /home/pavel/Pictures/lock-wallpaper.png"))
|
||||
#+end_src
|
||||
*** Auto-assign apps
|
||||
A function to automatially assign an app to its designated workspace and perspective.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defun my/exwm-configure-window ()
|
||||
(interactive)
|
||||
(pcase exwm-class-name
|
||||
((or "Firefox" "Nightly")
|
||||
(perspective-exwm-assign-window
|
||||
:workspace-index 2
|
||||
:persp-name "browser"))
|
||||
("Alacritty"
|
||||
(perspective-exwm-assign-window
|
||||
:persp-name "term"))
|
||||
((or "VK" "Slack" "Discord" "TelegramDesktop")
|
||||
(perspective-exwm-assign-window
|
||||
:workspace-index 3
|
||||
:persp-name "comms"))))
|
||||
|
||||
(add-hook 'exwm-manage-finish-hook #'my/exwm-configure-window)
|
||||
#+end_src
|
||||
** Keybindings
|
||||
Setting keybindings for EXWM. This actually has to be in the =:config= block of the =use-package= form, that is it has to be run after EXWM is loaded, so I use noweb to put this block in the correct place.
|
||||
|
||||
|
|
@ -693,6 +712,15 @@ A function to apply changes to =exwm-input-global-keys=.
|
|||
(backtrace)
|
||||
(buffer-string))))))
|
||||
#+end_src
|
||||
*** Improve floating windows behavior
|
||||
#+begin_src emacs-lisp
|
||||
(defun my/fix-exwm-floating-windows ()
|
||||
(setq-local exwm-workspace-warp-cursor nil)
|
||||
(setq-local mouse-autoselect-window nil)
|
||||
(setq-local focus-follows-mouse nil))
|
||||
|
||||
(add-hook 'exwm-floating-setup-hook #'my/fix-exwm-floating-windows)
|
||||
#+end_src
|
||||
** EXWM config
|
||||
And the EXWM config itself.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue