mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-10 11:13:04 +03:00
feat(desktop): improve window switching
This commit is contained in:
parent
fcca97d554
commit
aff8463412
4 changed files with 48 additions and 26 deletions
1
.condarc
1
.condarc
|
|
@ -3,3 +3,4 @@ channels:
|
||||||
- defaults
|
- defaults
|
||||||
channel_priority: strict
|
channel_priority: strict
|
||||||
changeps1: false
|
changeps1: false
|
||||||
|
auto_activate_base: false
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
# [[file:../Desktop.org::*MIME][MIME:1]]
|
||||||
[Default Applications]
|
[Default Applications]
|
||||||
text/html=firefox.desktop
|
text/html=firefox.desktop
|
||||||
x-scheme-handler/http=firefox.desktop
|
x-scheme-handler/http=firefox.desktop
|
||||||
|
|
@ -11,3 +12,4 @@ image/jpeg=feh.desktop
|
||||||
|
|
||||||
[Added Associations]
|
[Added Associations]
|
||||||
x-scheme-handler/tg=userapp-Telegram Desktop-7PVWF1.desktop;
|
x-scheme-handler/tg=userapp-Telegram Desktop-7PVWF1.desktop;
|
||||||
|
# MIME:1 ends here
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,7 @@ DIR is either 'left or 'right."
|
||||||
"Switch to another monitor."
|
"Switch to another monitor."
|
||||||
(interactive)
|
(interactive)
|
||||||
(my/exwm-last-workspaces-clear)
|
(my/exwm-last-workspaces-clear)
|
||||||
|
(let ((mouse-autoselect-window nil))
|
||||||
(exwm-workspace-switch
|
(exwm-workspace-switch
|
||||||
(cl-loop with other-monitor = (my/exwm-get-other-monitor (or dir 'right))
|
(cl-loop with other-monitor = (my/exwm-get-other-monitor (or dir 'right))
|
||||||
for i in (append my/exwm-last-workspaces
|
for i in (append my/exwm-last-workspaces
|
||||||
|
|
@ -212,7 +213,7 @@ DIR is either 'left or 'right."
|
||||||
(string-equal (plist-get exwm-randr-workspace-output-plist i)
|
(string-equal (plist-get exwm-randr-workspace-output-plist i)
|
||||||
other-monitor)
|
other-monitor)
|
||||||
(not (plist-get exwm-randr-workspace-output-plist i)))
|
(not (plist-get exwm-randr-workspace-output-plist i)))
|
||||||
return i)))
|
return i))))
|
||||||
|
|
||||||
(defun my/exwm-workspace-switch-monitor ()
|
(defun my/exwm-workspace-switch-monitor ()
|
||||||
"Move the current workspace to another monitor."
|
"Move the current workspace to another monitor."
|
||||||
|
|
@ -245,10 +246,17 @@ DIR is either 'left or 'right."
|
||||||
('right 'left))))
|
('right 'left))))
|
||||||
(if other-window
|
(if other-window
|
||||||
(windmove-do-window-select dir)
|
(windmove-do-window-select dir)
|
||||||
(my/exwm-switch-to-other-monitor dir)
|
(let ((mouse-autoselect-window nil))
|
||||||
|
(my/exwm-switch-to-other-monitor dir))
|
||||||
(cl-loop while (windmove-find-other-window opposite-dir)
|
(cl-loop while (windmove-find-other-window opposite-dir)
|
||||||
do (windmove-do-window-select opposite-dir))))))
|
do (windmove-do-window-select opposite-dir))))))
|
||||||
|
|
||||||
|
(defun my/exwm-quit ()
|
||||||
|
(interactive)
|
||||||
|
(when (or (not (eq (selected-window) (next-window)))
|
||||||
|
(y-or-n-p "This is the last window. Are you sure?"))
|
||||||
|
(evil-quit)))
|
||||||
|
|
||||||
(defun my/exwm-update-global-keys ()
|
(defun my/exwm-update-global-keys ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(setq exwm-input--global-keys nil)
|
(setq exwm-input--global-keys nil)
|
||||||
|
|
@ -362,7 +370,7 @@ _d_: Discord
|
||||||
(,(kbd "s-F") . exwm-floating-toggle-floating)
|
(,(kbd "s-F") . exwm-floating-toggle-floating)
|
||||||
|
|
||||||
;; Quit
|
;; Quit
|
||||||
(,(kbd "s-Q") . evil-quit)
|
(,(kbd "s-Q") . my/exwm-quit)
|
||||||
|
|
||||||
;; Split windows
|
;; Split windows
|
||||||
(,(kbd "s-s") . evil-window-vsplit)
|
(,(kbd "s-s") . evil-window-vsplit)
|
||||||
|
|
|
||||||
17
Desktop.org
17
Desktop.org
|
|
@ -648,6 +648,7 @@ One caveat here is that on the startup the =my/exwm-last-workspaces= variable wo
|
||||||
"Switch to another monitor."
|
"Switch to another monitor."
|
||||||
(interactive)
|
(interactive)
|
||||||
(my/exwm-last-workspaces-clear)
|
(my/exwm-last-workspaces-clear)
|
||||||
|
(let ((mouse-autoselect-window nil))
|
||||||
(exwm-workspace-switch
|
(exwm-workspace-switch
|
||||||
(cl-loop with other-monitor = (my/exwm-get-other-monitor (or dir 'right))
|
(cl-loop with other-monitor = (my/exwm-get-other-monitor (or dir 'right))
|
||||||
for i in (append my/exwm-last-workspaces
|
for i in (append my/exwm-last-workspaces
|
||||||
|
|
@ -658,7 +659,7 @@ One caveat here is that on the startup the =my/exwm-last-workspaces= variable wo
|
||||||
(string-equal (plist-get exwm-randr-workspace-output-plist i)
|
(string-equal (plist-get exwm-randr-workspace-output-plist i)
|
||||||
other-monitor)
|
other-monitor)
|
||||||
(not (plist-get exwm-randr-workspace-output-plist i)))
|
(not (plist-get exwm-randr-workspace-output-plist i)))
|
||||||
return i)))
|
return i))))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
I bind this function to =s-q=, as I'm used from i3.
|
I bind this function to =s-q=, as I'm used from i3.
|
||||||
|
|
@ -705,7 +706,8 @@ So here is my implementation of that. It always does =windmove-do-select-window=
|
||||||
('right 'left))))
|
('right 'left))))
|
||||||
(if other-window
|
(if other-window
|
||||||
(windmove-do-window-select dir)
|
(windmove-do-window-select dir)
|
||||||
(my/exwm-switch-to-other-monitor dir)
|
(let ((mouse-autoselect-window nil))
|
||||||
|
(my/exwm-switch-to-other-monitor dir))
|
||||||
(cl-loop while (windmove-find-other-window opposite-dir)
|
(cl-loop while (windmove-find-other-window opposite-dir)
|
||||||
do (windmove-do-window-select opposite-dir))))))
|
do (windmove-do-window-select opposite-dir))))))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
@ -743,6 +745,15 @@ Simulation keys.
|
||||||
(,(kbd "M-c") . ,(kbd "C-c"))))
|
(,(kbd "M-c") . ,(kbd "C-c"))))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
A quit function with a confirmation.
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(defun my/exwm-quit ()
|
||||||
|
(interactive)
|
||||||
|
(when (or (not (eq (selected-window) (next-window)))
|
||||||
|
(y-or-n-p "This is the last window. Are you sure?"))
|
||||||
|
(evil-quit)))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
And keybindings that are available in both =char-mode= and =line-mode=:
|
And keybindings that are available in both =char-mode= and =line-mode=:
|
||||||
#+begin_src emacs-lisp :tangle no :noweb-ref exwm-keybindings
|
#+begin_src emacs-lisp :tangle no :noweb-ref exwm-keybindings
|
||||||
(setq exwm-input-global-keys
|
(setq exwm-input-global-keys
|
||||||
|
|
@ -772,7 +783,7 @@ And keybindings that are available in both =char-mode= and =line-mode=:
|
||||||
(,(kbd "s-F") . exwm-floating-toggle-floating)
|
(,(kbd "s-F") . exwm-floating-toggle-floating)
|
||||||
|
|
||||||
;; Quit
|
;; Quit
|
||||||
(,(kbd "s-Q") . evil-quit)
|
(,(kbd "s-Q") . my/exwm-quit)
|
||||||
|
|
||||||
;; Split windows
|
;; Split windows
|
||||||
(,(kbd "s-s") . evil-window-vsplit)
|
(,(kbd "s-s") . evil-window-vsplit)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue