i3 icon indicating copy to clipboard operation
i3 copied to clipboard

`move position` is treated globally rather than relative to the current output

Open prosoitos opened this issue 6 years ago • 14 comments

I'm submitting a…

[x] Bug
[ ] Feature Request
[ ] Documentation Request
[ ] Other (Please describe in detail)

Current Behavior

In a dual-monitor setting, whenever I launch a floating window which has its position set, it opens in my external monitor.

Expected Behavior

I expect the floating window to open in the current workspace.

Reproduction Instructions

I have 2 situations in which the position of a floating window is set and the problem occurs in both of them (while I have no problem with floating windows which are free to open in the default center position).

1st situation: floating window position set by i3:

for_window [title="qalc"] floating enable, move position 1125 878, resize set 800 200

If I don't set the position (for_window [title="qalc"] floating enable, resize set 800 200), the "qalc" window opens in the correct workspace.

2nd situation: floating window position set through yad (--geometry flag): (I created this clumsy and ugly hack to get info on my backlight level when I adjust it)

bindsym XF86MonBrightnessUp exec --no-startup-id "xbacklight -inc 10 && xbacklight -get | xargs printf \\"%.*f\n\\" 0 | yad --text-info --sticky --no-buttons --undecorated --timeout 1 --geometry 10x10-10+3"

Same behaviour in both cases: when I am in a workspace on the external monitor, things work as expected. But when I am in a workspace on my primary monitor (laptop screen), the floating window still opens in the visible workspace of the external monitor (and the focus is thus now on that workspace).

Environment

Output of i3 --moreversion 2>&-:

i3 version: 4.17.1O
- Linux Distribution & Version: Arch Linux (5.4.10-arch1-1)
- Are you using a compositor (e.g., xcompmgr or compton): no

prosoitos avatar Jan 11 '20 21:01 prosoitos

I don’t see a link to logs.i3wm.org. Did you follow https://i3wm.org/docs/debugging.html? (In case you actually provided a link to a logfile, please ignore me.)

i3bot avatar Jan 11 '20 21:01 i3bot

I don't think that it is relevant, but in case, here is the result of xrandr:

Screen 0: minimum 8 x 8, current 2560 x 2520, maximum 32767 x 32767
eDP1 connected primary 1920x1080+0+1440 (normal left inverted right x axis y axis) 310mm x 170mm
   1920x1080     60.00*+  59.93    48.00  
   1680x1050     59.95    59.88  
   1400x1050     59.98  
   1600x900      60.00    59.95    59.82  
   1280x1024     60.02  
   1400x900      59.96    59.88  
   1280x960      60.00  
   1368x768      60.00    59.88    59.85  
   1280x800      59.81    59.91  
   1280x720      59.86    60.00    59.74  
   1024x768      60.00  
   1024x576      60.00    59.90    59.82  
   960x540       60.00    59.63    59.82  
   800x600       60.32    56.25  
   864x486       60.00    59.92    59.57  
   640x480       59.94  
   720x405       59.51    60.00    58.99  
   640x360       59.84    59.32    60.00  
DP1 disconnected (normal left inverted right x axis y axis)
DP2 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 550mm x 310mm
   2560x1440     59.95*+
   2048x1080     60.00    24.00  
   1920x1080     60.00    50.00    59.94  
   1920x1080i    60.00    50.00    59.94  
   1600x1200     60.00  
   1280x1024     75.02    60.02  
   1152x864      75.00  
   1280x720      60.00    50.00    59.94  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       75.00    60.00    59.94  
   720x400       70.08  
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

prosoitos avatar Jan 11 '20 21:01 prosoitos

I don't think that there is anything in my settings that could be causing this (particularly since the problem is not there when I don't force floating windows in a particular position), but of course if you can't reproduce, I will share my config file.

prosoitos avatar Jan 11 '20 21:01 prosoitos

Thanks!!! And thank you for an absolutely amazing wm! I totally love it :slightly_smiling_face:

prosoitos avatar Jan 11 '20 21:01 prosoitos

Can you please post a log file (or two, for the two different cases) as described in the link given by i3bot? Then we can check why i3 places the window on the output it places it on. There are several factors playing into the placement decision.

Airblader avatar Jan 12 '20 09:01 Airblader

Done (https://logs.i3wm.org/logs/5742321840685056.bz2).

Sorry for not doing this right away.

I uploaded one log file, but I opened my qalc window several times (from my primary monitor), starting (I think) at/near line 15544, then I increased and decreased the backlight several times (again, from my primary monitor), starting at/near line 23508.

Thanks!

prosoitos avatar Jan 12 '20 10:01 prosoitos

I think the issue here is that move position doesn't care about "absolute" being set or not (the parser only allows it for syntactical reasons) and always treats the position as global rather than relative to the current output. I have only briefly looked at it, though.

Airblader avatar Jan 12 '20 12:01 Airblader

Right. That would make sense.

I did not mention it, but my xrandr setup is to have the external monitor above my primary monitor. So what you are describing would indeed lead to the observed behaviour.

prosoitos avatar Jan 12 '20 20:01 prosoitos

If so, I imagine that you can reproduce it?

prosoitos avatar Jan 12 '20 20:01 prosoitos

I think the issue here is that move position doesn't care about "absolute" being set or not (the parser only allows it for syntactical reasons) and always treats the position as global rather than relative to the current output. I have only briefly looked at it, though.

I think that you are right :slightly_smiling_face:

As a little test, I set my external monitor below my primary and, as expected, now my floating windows with move position are all being launched on my primary, no matter what the active workspace is.

prosoitos avatar Jan 12 '20 20:01 prosoitos

If so, I imagine that you can reproduce it?

I haven't reproduced it yet, no, I just read the code. :-)

Airblader avatar Jan 13 '20 11:01 Airblader

Context: https://github.com/i3/i3/pull/3185

orestisfl avatar Apr 11 '20 10:04 orestisfl

Temporary fix for those who want to move window to the position relative to the current monitor: https://gist.github.com/Enr1g/f953a939805b06427bcad33b45d937f9. This program moves Guake to the top left corner but the principle can be used for any program and position:

  1. xdotool getmouselocation - getting coordinates of mouse cursor.
  2. xrandr --current | grep ' connected ' - get top left corners and sizes of all monitors.
  3. Check if mouse coordinates inside of any monitor.
  4. Calculate desired absolute coordinates from relative.
  5. Send i3-msg to move window.

Enr1g avatar Sep 24 '23 20:09 Enr1g

I had a similar problem with KDE panel popup menus, where the move position setting I had had moved them to an undesirable position in certain display setups. I solved it by using move up by a value I saw fit according to the regular startup position of the window, which in my case was a little lower than I wanted (and this startup position was consistent across different display setups).

Here is the setting in case anyone has a similar problem:

for_window [class="plasmashell" window_type="popup"] floating enable, border none, move up 23px

mito010 avatar Jan 20 '24 13:01 mito010