darkstego / Mudeer

KDE Plasma Screen Splitting Shortcuts ideal for Ultrawide and Super-Ultrawide Monitors
MIT License
157 stars 13 forks source link

Mudeer for huge 4k monitor #7

Closed jobidon closed 1 year ago

jobidon commented 1 year ago

I'm looking for a tiling window manager that can help me with my setup. Let let me know if/how you think mudeer could be applied to the following scenario.

I have a single huge flat (not curved) 4k monitor. The monitor is so big that I barely look at the top left/right corners and in fact spend most of my time looking at the bottom center of the screen where I swap windows in/out of that area as I work on them. I'd like to separate the display in 6 different zones (1..6) where the master zone where I focus my work is zone 5.

    25%             50%            25%
 _______________________________________
|          |                   |         |
|     1    |         2         |    3    |
|   Dash   |    Live Charts    |   IM    |     50%
|          |                   |         |
|__________|___________________|_________|
|          |                   |         |
|    4     |         5         |    6    |
|   Spawn  |      Master       |  Tasks  |     50%
|          |                   |         |
 __________|___________________|_________|

Column 1 (zone 1 and 4) takes up 25% of the width of the screen. Same thing for column 3 (zone 3 and 6), leaving the middle section with 50% of the screen. The status/menu bar is at the bottom of the screen, below all zones.

Most tiling manager have a way to make that grid layout work fine, but the next part is where things get tricky.

I currently have to manually move a window to zone 5 when I want to focus on it for more than a few seconds. I currently do that with the mouse and have to resize as best I can. And when I'm done, I have to move it back to where it was before the focus occured. I'd like to create a shortcut to move/resize a window to zone 5 and at the same time move the window currently in zone 5 to another zone (I could use zone 4 as a place to spawn new window and temporarily place unfocused windows).

So is this something mudeer can be customized to do? What are your suggestions regarding how to do this?

thanks for your input!

darkstego commented 1 year ago

So currently the way I swap focus with the zones uses 3 hotkeys. I have my main work window in the middle and my other window on the left. So with the focus on the main window I move it to the left, then Alt-Tab to get the next window (the one I want to move to the middle), then move that with a shortcut to the middle. So in my example the combo would be [Super-a, Alt-Tab, Super-s]. The main problem with this method is that the window I want to drag in has to be below the current window in the Alt-Tab order list otherwise I have to do this long dance of finding the window I want to move to the main area. Also, the steps that are needed require getting used to shuffling the windows around in this method which isn't as intuitive as something like a swap shortcut.

I had thought about adding a shortcut to riffle through the windows in each zone (like Alt-tab but restricted to the zone of the current active window). This would solve the biggest problem with shuffling windows around and make finding things in a tiled system much easier, but last time I checked KDE didn't expose enough information about the windows to the kwin-scripts to be able to implement that. My preliminary guess is that a swap shortcut would have the same issue in implementation.

I will look into zone swapping. If it isn't too much of an issue to implement I might add a swap zones prefix shortcut that will swap current window with the content of the destination zone. Until then, see if the windows swapping method works for you, I am interested to see what works and what doesn't with the users.

jobidon commented 1 year ago

Thanks for your input! Sounds like this could work, and since I have a large work area, most windows are already visible, so looking for a specific window shouldn't be too bad. So Super-a to move it to another zone, select the new window and Super-S to move that to the master area. Maybe the Super-A could also ensure that the window could be resized to, say, 100x100 so it would take up less space and be easily accessible when it needs to be swapped back into focus? Perhaps based on the window title, Super-A could also send windows to another zone as well (instead of always sending stuff to the spawn area)? Not sure how much flexibility KDE (or KWin) provides in that regards. I just looked at the repository, and it looks like I would just need to modify mudeer.js to create a 6-zone profile (in addition to the 3- and 4-zone layouts already defined), and create shortcuts for each one. Anything else I need to be aware of?

darkstego commented 1 year ago

You do not need to modify it. Each zone has a top and bottom half modifier key. I split it by width 3 way, and use the configuration menu to modify the middle zone in the triple wide setup to be as large as you want. The remained will be left to the remaining two zones. Then just hold either ALT or CTRL along with the zone you want to specify the bottom or top half respectively. Whenever you move a window to a zone it gets resized to fit that zone, so you don't have to worry about that.

The README is a bit long but there is a section there is a visualization for how the shortcuts work. I would suggest taking a look at it before modifying anything in the script.

The shortcuts take a little bit to learn, but I set them up to make sense, once you are used to them moving windows around to different zones is very quick.

jobidon commented 1 year ago

I was able to install the script and had to overwrite/create some of the shortcuts. Overall it seems to work except for the Meta-Alt-S shortcut. For some reason that specific key sequence does not register. I remapped it to Meta-Alt-J and it works fine. Even Meta-Ctrl-S works, but not with the Alt modifier. Since I couldn't make it work, I simply remapped all shortcuts to Meta+[ASDZXC] for the top and bottom sections of the screen, and it appears to be working fine now.

I also tried to increase the middle third by an extra 100px, but it does not have any effect on the layout. My hope was that the middle zone was going to be widened by 100px (50px to the left and 50px to the right) but it doesn't appear to work like that out of the box. The "gap" setting does not appear to do anything either, despite clicking Apply. Perhaps they both require a restart of KWin?

A separate tiling window manager would definitely help rearranging windows in the case there is already one in that section of the screen (instead of covering it outright), and keep window sizes as they are moved around the screen, but for now these shortcuts do help quite a bit. I still have to use the mouse to select the correct window to focus (Alt-Tab is not convenient when there are too many windows, and it forces me to look at another section of the screen to look for a window) on but that's still quite an improvement: Thanks again for sharing your script!

darkstego commented 1 year ago

Overall it seems to work except for the Meta-Alt-S shortcut.

Odd. Do you have another language keyboard setup on KDE by any chance? I did come across the problem where KDE would remap keys of other languages even if they are not active. So for example if a secondary language has a symbol on one of the secondary levels of the key (for example ` as a secondary level of key with letter S) then it will remap the key if any of the KDE shortcuts use that symbol, even when the keyboard layout is not active. One way to fix it was find the symbols attached on that letter and find any KDE shortcut that uses that and disable it.

The "gap" setting does not appear to do anything either, despite clicking Apply.

Unfortunately, the entire KDE scripting side is very buggy and sometimes things don't work until you restart Kwin. I went through a bunch of such issues when developing the script that make debugging very tough.