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
|
||||
channel_priority: strict
|
||||
changeps1: false
|
||||
auto_activate_base: false
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
# [[file:../Desktop.org::*MIME][MIME:1]]
|
||||
[Default Applications]
|
||||
text/html=firefox.desktop
|
||||
x-scheme-handler/http=firefox.desktop
|
||||
|
|
@ -11,3 +12,4 @@ image/jpeg=feh.desktop
|
|||
|
||||
[Added Associations]
|
||||
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."
|
||||
(interactive)
|
||||
(my/exwm-last-workspaces-clear)
|
||||
(let ((mouse-autoselect-window nil))
|
||||
(exwm-workspace-switch
|
||||
(cl-loop with other-monitor = (my/exwm-get-other-monitor (or dir 'right))
|
||||
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)
|
||||
other-monitor)
|
||||
(not (plist-get exwm-randr-workspace-output-plist i)))
|
||||
return i)))
|
||||
return i))))
|
||||
|
||||
(defun my/exwm-workspace-switch-monitor ()
|
||||
"Move the current workspace to another monitor."
|
||||
|
|
@ -245,10 +246,17 @@ DIR is either 'left or 'right."
|
|||
('right 'left))))
|
||||
(if other-window
|
||||
(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)
|
||||
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 ()
|
||||
(interactive)
|
||||
(setq exwm-input--global-keys nil)
|
||||
|
|
@ -362,7 +370,7 @@ _d_: Discord
|
|||
(,(kbd "s-F") . exwm-floating-toggle-floating)
|
||||
|
||||
;; Quit
|
||||
(,(kbd "s-Q") . evil-quit)
|
||||
(,(kbd "s-Q") . my/exwm-quit)
|
||||
|
||||
;; Split windows
|
||||
(,(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."
|
||||
(interactive)
|
||||
(my/exwm-last-workspaces-clear)
|
||||
(let ((mouse-autoselect-window nil))
|
||||
(exwm-workspace-switch
|
||||
(cl-loop with other-monitor = (my/exwm-get-other-monitor (or dir 'right))
|
||||
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)
|
||||
other-monitor)
|
||||
(not (plist-get exwm-randr-workspace-output-plist i)))
|
||||
return i)))
|
||||
return i))))
|
||||
#+end_src
|
||||
|
||||
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))))
|
||||
(if other-window
|
||||
(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)
|
||||
do (windmove-do-window-select opposite-dir))))))
|
||||
#+end_src
|
||||
|
|
@ -743,6 +745,15 @@ Simulation keys.
|
|||
(,(kbd "M-c") . ,(kbd "C-c"))))
|
||||
#+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=:
|
||||
#+begin_src emacs-lisp :tangle no :noweb-ref exwm-keybindings
|
||||
(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)
|
||||
|
||||
;; Quit
|
||||
(,(kbd "s-Q") . evil-quit)
|
||||
(,(kbd "s-Q") . my/exwm-quit)
|
||||
|
||||
;; Split windows
|
||||
(,(kbd "s-s") . evil-window-vsplit)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue