Global switch windows - move to **visually** closest window
Overview
I use paperWM with multiple monitors, but have always struggled with the hotkeys for movement. I've memorized them out of necessity, but…
…let's be honest, they make no sense.
-
<Super>withLeftandRightarrows, orcomma/period, are the hotkeys for switching windows. Ok. - Add either
ShiftorCtrlto comma/period to drag the window instead. Great. - For arrows,
Ctrlworks the same way, but shift suddenly moves the focus between monitors. ??? - Okay so to move the current window to a different monitor, now I use
<Super><Ctrl><Shift>Left. That's a lot of keys but I guess once I understand that<Shift>Leftis moving monitors then adding control grabs the window. -
<Ctrl><Alt>Leftmoves the entire workspace. Why does a less common, larger action, require fewer modifiers than moving just one window? Why doesn't it use<Meta>like all other PaperWM "Window manager" hotkeys?
I can go on, but I think my point is made.
Recently I saw the new actions added in https://github.com/paperwm/PaperWM/pull/775, and it was a serious :bulb: :exploding_head: revelation for me. Obviously this is how PaperWM is supposed to work. If you are switching left and you reach the end of one monitor, the same hotkey just keeps going left.
Well, kinda. There were a few things missing, which I have added in three separate PRs:
- #1076 « :pushpin: YOU ARE HERE
- #1081
- #1082
This PR
Intuitively, I expected that "keep going left" would focus the window that I already see active when looking at the monitor to the left. If I'm only using the keyboard it works great, but if I have the windows like this:
Two workspaces; each letter is a window; uppercase means focused.
[A b c d] [e f g h]
And each window is 50% size, so they're currently visible on two monitors like this:
[A b] [e f]
If I use my mouse to select E
[a b] [E f]
And then use the keyboard shortcut to move left, I get whiplash as the left monitor whisks everything away to focus D.
[c D] [e f]
This PR changes it to just activate the closest visible window on the monitor.
[a B] [e f]
@dawsers Can you play around with this and tell me what you think of it?
Thanks for your contribution! We don't accept pull requests to the release branch. I have rebased your pull request onto develop, check for any conflicts.
This branch name is foreshadowing… after polishing a bit, I think we should make this the default hotkey for movement.
@dawsers Can you play around with this and tell me what you think of it?
Sorry, I am no longer using PaperWM, I ended up writing my own thing, scroll.
I don't remember how it works, but if what you say is what happens, then you are totally right, the more intuitive behavior would be to focus on the closest window on the other monitor that can be seen.
No worries. Thank you for the inspiration!