duncs / clusterssh

Cluster SSH - Cluster Admin Via SSH
https://github.com/duncs/clusterssh/wiki
896 stars 79 forks source link

Don't place windows across two physical displays #68

Open cqexbesd opened 8 years ago

cqexbesd commented 8 years ago

I have two monitors and clusterssh lays windows half on one screen and half on the other. This is quite annoying as the gap between my monitors is decent.

I was going to supply a patch but I have run out of time for now and I'm not sure when I will get back to it. Instead I open this issue to record as far as I have got and maybe someone would like to do the last steps...?

I have the code, as is, in a test script available here:

https://github.com/cqexbesd/clusterssh/blob/new_tiling/window_tiling.pl

You can run the script with a number as the sole argument. It will open that many windows (not ssh sessions, just windows for testing) and tile them. It will resize windows to the preferred size (https://github.com/cqexbesd/clusterssh/blob/new_tiling/window_tiling.pl#L474) or smaller if needed to fit everything on. It can tile across or down so should help with https://github.com/duncs/clusterssh/issues/40. It supports preferring one display over the other so helps towards https://github.com/duncs/clusterssh/issues/31 - currently it prefers the display holding the cursor when you run it.

It is only a first draft and has had very little testing. It still needs integrating with the rest of the cssh code base: 1) find preferred terminal size - this is already done somewhere and just needs passing in 2) add trace logging 3) don't call die if something bad happens 4) fall back to a basic system if, e.g. no Xinerama support 5) compare with existing behaviour when there isn't enough room

I have only tested it on one machine, with one window manager and one monitor configuration (but 2 monitors).

towster commented 8 years ago

This sounds nice. Hope it gets integrated. I would ask if there could be a config option though to not prefer the display holding the cursor.

Not sure if this would be possible but it would also be nice if there was a "retile" button. Frequently I find myself discovering I need to close a window or two and then I have ugly holes.

cqexbesd commented 8 years ago

I would ask if there could be a config option though to not prefer the display holding the cursor.

That wasn't intended to be a feature in cssh per se - just an easy way to test the function that preferred particular monitors. Working out if, and if so which, monitor to prefer is for a future PR. It's not a feature I am likely to use so I may just provide the infrastructure and leave the interface to someone else.

Not sure if this would be possible but it would also be nice if there was a "retile" button.

There is already a retile menu option...

oioki commented 7 years ago

I was stuck into this issue also. I have two monitors: left 1600x900 and right 1920x1080. As I spawn cssh only on right monitor, I use the temporary solution. Just add this into ~/.clusterssh/config screen_reserve_left=1600