ssokolow / quicktile

Adds window-tiling hotkeys to any X11 desktop. (An analogue to WinSplit Revolution for people who don't want to use Compiz Grid)
https://ssokolow.com/quicktile/
GNU General Public License v2.0
869 stars 78 forks source link

While using "right" or "center" command on with external monitor, the windows switch to the next monitor #124

Closed vitoindelicato closed 1 year ago

vitoindelicato commented 3 years ago

I tried quicktile with an external monitor, and when I've used "center" and "right" to tile my window, it switched to the other monitor. The most bothering thing was that I wasn't able to put the window in the first monitor with my default os shortcut, to make it work I have to manually move the window around and then switch it.

Edit: I've noticed that even with the "Right" command it happen.

ssokolow commented 3 years ago

Please copy-paste what quicktile --debug prints to the terminal.

(It'll dump everything relevant to how QuickTile understands the shape of the usable area of your desktop.)

vitoindelicato commented 3 years ago

Please copy-paste what quicktile --debug prints to the terminal.

(It'll dump everything relevant to how QuickTile understands the shape of the usable area of your desktop.)

DEBUG: Loaded monitor geometry: [Rectangle(x=0, y=0, width=1920, height=1080), Rectangle(x=1920, y=0, width=1920, height=1080)] DEBUG: Gathered _NET_WM_STRUT_PARTIAL value: [StrutPartial(left=1920, right=0, top=0, bottom=0, left_start_y=0, left_end_y=29, right_start_y=0, right_end_y=0, top_start_x=0, top_end_x=0, bottom_start_x=0, bottom_end_x=0)] DEBUG: Gathered _NET_WM_STRUT_PARTIAL value: [StrutPartial(left=1920, right=0, top=0, bottom=0, left_start_y=0, left_end_y=29, right_start_y=0, right_end_y=0, top_start_x=0, top_end_x=0, bottom_start_x=0, bottom_end_x=0), StrutPartial(left=0, right=0, top=0, bottom=0, left_start_y=0, left_end_y=0, right_start_y=0, right_end_y=0, top_start_x=0, top_end_x=0, bottom_start_x=0, bottom_end_x=0)] DEBUG: Usable desktop region calculated as: Region(<Monitors=[Rectangle(x=0, y=0, width=1920, height=1080), Rectangle(x=1920, y=0, width=1920, height=1080)], Struts=[StrutPartial(left=1920, right=0, top=0, bottom=0, left_start_y=0, left_end_y=29, right_start_y=0, right_end_y=0, top_start_x=0, top_end_x=0, bottom_start_x=0, bottom_end_x=0), StrutPartial(left=0, right=0, top=0, bottom=0, left_start_y=0, left_end_y=0, right_start_y=0, right_end_y=0, top_start_x=0, top_end_x=0, bottom_start_x=0, bottom_end_x=0)]>)

ssokolow commented 3 years ago

OK, QuickTile sees two 1920x1080 monitors side-by-side, but your panel reservations look odd.

Am I correct in interpreting that you've got an auto-hiding panel with no reservations on each monitor?

If I'm reading this correctly, it says you've got:

Also, what DE are you running? There are known bugs I haven't had time to fix, caused by some DEs not following the specs properly when they expose information about panel reservations. (eg #118 and #117)

vitoindelicato commented 3 years ago

Am I correct in interpreting that you've got an auto-hiding panel with no reservations on each monitor

Sincerely I'm not able to respond at it, sorry.

Also, what DE are you running?

I'm running Pantheon

ssokolow commented 3 years ago

I'm running Pantheon

elementaryOS?

vitoindelicato commented 3 years ago

I'm running Pantheon

elementaryOS?

Yup. I don't know if it's a relevant detail, but on single monitor everything works very well.

ssokolow commented 3 years ago

*nod* Your problem sounds like something I thought I'd fixed, where QuickTile misinterpreted a panel reservation on the left edge of the right monitor or the right edge of the left monitor as reserving an entire monitor because the spec was unclear.

  1. Is it the left monitor or the right monitor QuickTile refuses to tile things to?
  2. Which version of QuickTile are you running and how did you install it?
vitoindelicato commented 3 years ago
  • Is it the left monitor or the right monitor QuickTile refuses to tile things to?

The problem is on the primary monitor, the left one, when I use that commands the window goes to the second and right monitor, I tried all the commands in the second monitor and there they are working correctly.

2. Which version of QuickTile are you running and how did you install it?

I'm running quicktile v0.4.1, I've installed it with pip3.

ssokolow commented 3 years ago

Yep, that sounds like I didn't fully fix that bug.

If it's interpreting that StrutPartial(left=1920, right=0, top=0, bottom=0, left_start_y=0, left_end_y=29, right_start_y=0, right_end_y=0, top_start_x=0, top_end_x=0, bottom_start_x=0, bottom_end_x=0) as a reservation of the entire left monitor, rather than a zero-width reservation on the left edge of the right monitor, that'd do it.

I'm too tired and burned out do do anything right now, but I'll make a note to test my suspicion about the cause of the bug as soon as I'm feeling better.

(I suspect that it's an off-by-one error where I was too clever and wrote QuickTile to assume that left=1920 means "reserve the entire left monitor and nothing more" rather than "make an empty reservation on the left edge of the right monitor")

vitoindelicato commented 3 years ago

I'm too tired and burned out do do anything right now, but I'll make a note to test my suspicion about the cause of the bug as soon as I'm feeling better.

Don't worry man, maybe notify me on this thread when you fix it. Thank you so much for your availability :) Passing above this problem, quicktile, at least for me, is a game-changer, gg!

ssokolow commented 3 years ago

Don't worry man, maybe notify me on this thread when you fix it.

No worries. I always do.

mikewebbdev commented 3 years ago

I'm seeing similar behaviour.. DEBUG: Loaded monitor geometry: [Rectangle(x=1920, y=0, width=2560, height=1440), Rectangle(x=0, y=98, width=1920, height=1080)] DEBUG: Usable desktop region calculated as: Region(<Monitors=[Rectangle(x=1920, y=0, width=2560, height=1440), Rectangle(x=0, y=98, width=1920, height=1080)], Struts=[]>) When I tile a window on my Primary (larger screen physically on the right) to the left, it swaps monitor to the Secondary (smaller screen physically on the left). Move-to-left still functions correctly on Primary, so can resolve the issue manually with monitor-switch -> move-to-left -> vertical-maximize

mashtonian commented 2 years ago

Hi,

I also have this issue, on Elementary OS 6.0

DEBUG: Loaded monitor geometry: [Rectangle(x=1920, y=0, width=1920, height=1080), Rectangle(x=0, y=0, width=1920, height=1080)] DEBUG: Gathered _NET_WM_STRUT_PARTIAL value: [StrutPartial(left=0, right=1920, top=0, bottom=0, left_start_y=0, left_end_y=0, right_start_y=0, right_end_y=29, top_start_x=0, top_end_x=0, bottom_start_x=0, bottom_end_x=0)] DEBUG: Gathered _NET_WM_STRUT_PARTIAL value: [StrutPartial(left=0, right=1920, top=0, bottom=0, left_start_y=0, left_end_y=0, right_start_y=0, right_end_y=29, top_start_x=0, top_end_x=0, bottom_start_x=0, bottom_end_x=0), StrutPartial(left=0, right=0, top=0, bottom=0, left_start_y=0, left_end_y=0, right_start_y=0, right_end_y=0, top_start_x=0, top_end_x=0, bottom_start_x=0, bottom_end_x=0)] DEBUG: Usable desktop region calculated as: Region(<Monitors=[Rectangle(x=1920, y=0, width=1920, height=1080), Rectangle(x=0, y=0, width=1920, height=1080)], Struts=[StrutPartial(left=0, right=1920, top=0, bottom=0, left_start_y=0, left_end_y=0, right_start_y=0, right_end_y=29, top_start_x=0, top_end_x=0, bottom_start_x=0, bottom_end_x=0), StrutPartial(left=0, right=0, top=0, bottom=0, left_start_y=0, left_end_y=0, right_start_y=0, right_end_y=0, top_start_x=0, top_end_x=0, bottom_start_x=0, bottom_end_x=0)]>)

WillMeakin commented 2 years ago

Hacky fix: Let A=the monitor the windows always switch to, and B=the other monitor I noticed when A was set as the primary monitor I had no issues, and the issues only occured when B was primary. I also noticed Ubuntu (X11?) always set A to monitor 1 and B to monitor 2. I.e. I suspect setting the primary monitor to monitor 2 is the issue. Solution: Try different ports on your GPU/MoBo until the primary monitor is set to #1 For me my Nvidia GPU always set the HDMI port to 1, and the Display Port as 2. So I put my primary as using HDMI and it fixed it.

I'm running Ubuntu

ssokolow commented 2 years ago

I got your original message in the e-mail and you really should keep this information.

quicktile --debug before the port switch: DEBUG: Loaded monitor geometry: [Rectangle(x=1920, y=0, width=3440, height=1440), Rectangle(x=0, y=232, width=1920, height=1080)] DEBUG: Usable desktop region calculated as: Region(<Monitors=[Rectangle(x=1920, y=0, width=3440, height=1440), Rectangle(x=0, y=232, width=1920, height=1080)], Struts=[]>)

quicktile --debug after the port switch: DEBUG: Loaded monitor geometry: [Rectangle(x=0, y=0, width=1920, height=1080), Rectangle(x=1920, y=0, width=3440, height=1440)] DEBUG: Usable desktop region calculated as: Region(<Monitors=[Rectangle(x=0, y=0, width=1920, height=1080), Rectangle(x=1920, y=0, width=3440, height=1440)], Struts=[]>)

I'm still trying to get my life in order enough to properly maintain QuickTile, but, given the monitor swapping changed the behaviour, I'll see if I can find time within the next few days to roll what's been posted in this thread into some unit tests and try to at least rule out that the problem is something completely internal to QuickTile, rather than a weird interaction with window managers I haven't had time to spin up a VM of yet.

WillMeakin commented 2 years ago

Sorry about the original message. Turns out that didn't help; I didn't realise changing ports also changed the primary to #1, which solved the issue but meant it was set to the wrong primary, and changing the primary back to #2 still caused the issue. My hacky fix still works though.

ssokolow commented 2 years ago

That's also useful information to have on file though. Could you throw up a copy of the quicktile --debug output with the ports swapped and the primary changed back, just in case I can pull something useful out of it?

ssokolow commented 2 years ago

Also, when you say you're running Ubuntu, which version are we talking about and are you running the default GNOME Shell-based desktop?

...because, if so, I'd also like to see what this spits out:

xprop -root | grep _GTK_WORKAREAS_

(GNOME Shell doesn't expose panel reservations the standard way and, if you're running into this, then you're probably running into another symptom of #117 and I really should try to make time to get a VM set up to test and fix that.)

WillMeakin commented 2 years ago

Okay so it seems my "fix" doesn't actually work. I'm still getting issues despite what number each monitor is assigned. However it's still interesting that if Monitor A is set as primary it doesn't have the issue, no matter what ports either is plugged into or numbers they're assigned.

Outputs with monitor B as primary (issue exists)

$ quicktile --debug
DEBUG: Loaded monitor geometry: [Rectangle(x=1920, y=0, width=3440, height=1440), Rectangle(x=0, y=188, width=1920, height=1080)]
DEBUG: Usable desktop region calculated as: Region(<Monitors=[Rectangle(x=1920, y=0, width=3440, height=1440), Rectangle(x=0, y=188, width=1920, height=1080)], Struts=[]>)

Outputs with monitor B as primary (issue doesn't exist)

$ quicktile --debug
DEBUG: Loaded monitor geometry: [Rectangle(x=0, y=188, width=1920, height=1080), Rectangle(x=1920, y=0, width=3440, height=1440)]
DEBUG: Usable desktop region calculated as: Region(<Monitors=[Rectangle(x=0, y=188, width=1920, height=1080), Rectangle(x=1920, y=0, width=3440, height=1440)], Struts=[]>)

I want Monitor B (the 3440x1440 in HDMI-0) to be primary.

$ xrandr --current
Screen 0: minimum 8 x 8, current 5360 x 1440, maximum 32767 x 32767
DP-0 connected primary 1920x1080+0+188 (normal left inverted right x axis y axis) 544mm x 303mm
   1920x1080     74.97*+  60.00    59.94    50.00  
   1680x1050     59.95  
   1440x900      59.89  
   1280x1024     60.02  
   1280x800      59.81  
   1280x720      60.00    59.94    50.00  
   1152x864      75.00  
   1024x768      70.07    60.00  
   800x600       60.32    56.25  
   720x576       50.00  
   720x480       59.94  
   640x480       59.94    59.93  
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
HDMI-0 connected 3440x1440+1920+0 (normal left inverted right x axis y axis) 797mm x 334mm
   3440x1440     60.00*+ 100.00  
   3840x2160     59.94    50.00    29.97  
   2560x1440    120.00  
   1920x1080    119.88    60.00    59.94    50.00  
   1720x1440     60.00  
   1680x1050     59.95  
   1600x1200     60.00  
   1440x900      59.89  
   1280x1024     75.02    60.02  
   1280x960      60.00  
   1280x720      60.00    59.94    50.00  
   1152x864      75.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    72.81    59.94    59.93  
DP-4 disconnected (normal left inverted right x axis y axis)
DP-5 disconnected (normal left inverted right x axis y axis)

Other relevant outputs

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04 LTS
Release:    22.04
Codename:   jammy

$ gnome-shell --version
GNOME Shell 42.1

$ xprop -root | grep _GTK_WORKAREAS_
_GTK_WORKAREAS_D1(CARDINAL) = 0, 215, 1920, 1053, 1920, 0, 3440, 1440
_GTK_WORKAREAS_D0(CARDINAL) = 0, 215, 1920, 1053, 1920, 0, 3440, 1440

I don't know what the y=188 is. I thought maybe the Ubuntu dock (which I have autohiding at the bottom), but even if I change it to only appear on monitor B it's still y=188 on monitor A

ssokolow commented 2 years ago

I don't know what the y=188 is. I thought maybe the Ubuntu dock (which I have autohiding at the bottom), but even if I change it to only appear on monitor B it's still y=188 on monitor A

Is your shorter monitor vertically centered in the virtual desktop space relative to your taller monitor? 188 is only 8 pixels larger than exactly half the difference between the height of the two monitors.

EDIT: Just checked the xrandr output and that's it. 1920x1080+0+188

That output says that your DP-0 monitor occupies a 1920x1080 rectangle with its top-left corner in the virtual space positioned at (0, 188).

It also says HDMI-0 connected 3440x1440+1920+0 meaning that your HDMI-0 monitor occupies a 3440x1440 rectangle with its top-left corner positioned at (1920,0).

ssokolow commented 1 year ago

OK. Sorry for taking so long. That commit should give you basic support under GNOME Shell on X11, comparable to what you get on other WMs.

It unconditionally queries _GTK_WORKAREAS_D0 because QuickTile currently has no concept of different workspaces/virtual desktops having different panel reservations.

I only did very minimal testing on GNOME because GNOME Shell performs so poorly inside VirtualBox, so please give it some exercise and let me know if you encounter any issues.