Monitor size is calculated wrongly when scaled #117

Closed
opened 2026-01-05 14:48:25 +01:00 by adam · 2 comments
Owner

Originally created by @markgeejw on GitHub (Jul 16, 2022).

Hi! Thanks for this great project!

I noted that you had implemented cross-monitor focus/move with #165, but it wasn't working for me, which seems to be due to scaling.

Setup:

  • Left monitor is 4k scaled at 225%
  • Right monitor is 1440p scaled at 150%

After digging into the code a little, it seems that the condition for monitor_index_in_direction was not being met due to the monitor sizes not lining up. Using komorebic state, I noted that my left monitor was reporting {left: -2560, right: 1707} and my right monitor {left: 0, right: 1707}. If I set both monitors scaling to 100%, everything works great, with the monitor sizes being reported correctly and cross-monitor focus working. Seems to be something to do with how Windows is reporting monitor size information.

I tried digging into the Windows API a little but couldn't find the problem.

Originally created by @markgeejw on GitHub (Jul 16, 2022). Hi! Thanks for this great project! I noted that you had implemented cross-monitor focus/move with #165, but it wasn't working for me, which seems to be due to scaling. Setup: - Left monitor is 4k scaled at 225% - Right monitor is 1440p scaled at 150% After digging into the code a little, it seems that the condition for `monitor_index_in_direction` was not being met due to the monitor sizes not lining up. Using `komorebic state`, I noted that my left monitor was reporting `{left: -2560, right: 1707}` and my right monitor `{left: 0, right: 1707}`. If I set both monitors scaling to 100%, everything works great, with the monitor sizes being reported correctly and cross-monitor focus working. Seems to be something to do with how Windows is reporting monitor size information. I tried digging into the Windows API a little but couldn't find the problem.
adam closed this issue 2026-01-05 14:48:25 +01:00
Author
Owner

@LGUG2Z commented on GitHub (Jul 16, 2022):

I have just tested this with two monitors at different scaling percentages between 100 and 200 on both monitors and I was able to both focus and move across monitor boundaries. I typically have 125% on my main monitor and 150% on my secondary monitor and I haven't noticed this before.

Running komorebic state | jq '.monitors.elements[].size' I get the following output:

{
  "left": 0,
  "top": 0,
  "right": 3072,
  "bottom": 1728
}
{
  "left": 3840,
  "top": 427,
  "right": 1916,
  "bottom": 1332
}

Which matches up with what I see in my display settings (with the array ordering matching the numerical order given in the settings UI):

image

Using komorebic state, I noted that my left monitor was reporting {left: -2560, right: 1707} and my right monitor {left: 0, right: 1707}

From reading this, it seems like your left monitor is not being recognized in the display arrangement settings as being the left-most monitor, because left is not 0.

Can you report back with the output of the above command which uses jq to extract the monitor sizes in order and the numerical order and layout given by Windows in the display settings UI?

@LGUG2Z commented on GitHub (Jul 16, 2022): I have just tested this with two monitors at different scaling percentages between 100 and 200 on both monitors and I was able to both `focus` and `move` across monitor boundaries. I typically have 125% on my main monitor and 150% on my secondary monitor and I haven't noticed this before. Running `komorebic state | jq '.monitors.elements[].size'` I get the following output: ```json { "left": 0, "top": 0, "right": 3072, "bottom": 1728 } { "left": 3840, "top": 427, "right": 1916, "bottom": 1332 } ``` Which matches up with what I see in my display settings (with the array ordering matching the numerical order given in the settings UI): ![image](https://user-images.githubusercontent.com/13164844/179365535-0ea671d1-ab54-47c4-b54f-f10163e6565e.png) > Using `komorebic state`, I noted that my left monitor was reporting `{left: -2560, right: 1707}` and my right monitor `{left: 0, right: 1707}` From reading this, it seems like your left monitor is not being recognized in the display arrangement settings as being the left-most monitor, because `left` is not `0`. Can you report back with the output of the above command which uses `jq` to extract the monitor sizes in order and the numerical order and layout given by Windows in the display settings UI?
Author
Owner

@markgeejw commented on GitHub (Jul 17, 2022):

I think it's because I use my right monitor as my main display.

Can you report back with the output of the above command which uses jq to extract the monitor sizes in order

{
  "left": 0,
  "top": 0,
  "right": 1707,
  "bottom": 960
}
{
  "left": -2560,
  "top": -271,
  "right": 1707,
  "bottom": 960
}

and the numerical order and layout given by Windows in the display settings UI?
image

But even when I switch the main display to the left monitor it still doesn't work.

@markgeejw commented on GitHub (Jul 17, 2022): I think it's because I use my right monitor as my main display. > Can you report back with the output of the above command which uses jq to extract the monitor sizes in order ``` { "left": 0, "top": 0, "right": 1707, "bottom": 960 } { "left": -2560, "top": -271, "right": 1707, "bottom": 960 } ``` > and the numerical order and layout given by Windows in the display settings UI? <img width="731" alt="image" src="https://user-images.githubusercontent.com/19712422/179381533-ca1907d3-39b5-42b1-ae7c-f3eb0814a903.png"> But even when I switch the main display to the left monitor it still doesn't work.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/komorebi#117