AlexisBRENON / ewmh_m2m

EWMH-compliant move to monitor utility
https://pypi.org/project/ewmh-m2m/
MIT License
90 stars 5 forks source link

"No sibling screen found" for vertical alignment #26

Closed baztian closed 1 year ago

baztian commented 1 year ago
Traceback (most recent call last):
  File "/home/bbowe/Software/ewmh-m2m/bin/move-to-monitor", line 8, in <module>
    sys.exit(main())
  File "/home/bbowe/Software/ewmh-m2m/lib/python3.10/site-packages/ewmh_m2m/__main__.py", line 65, in main
    move_to_screen(args)
  File "/home/bbowe/Software/ewmh-m2m/lib/python3.10/site-packages/ewmh_m2m/__main__.py", line 36, in move_to_screen
    raise ValueError("No sibling screen found")
ValueError: No sibling screen found

image

Even https://github.com/AlexisBRENON/ewmh_m2m/pull/25 doesn't seem to fix the issue

AlexisBRENON commented 1 year ago

Hey. Thanks for reporting this issue. Can you run the same command with debug flags activated: move-to-monitor -vvv ... Please share the command line as well as the output. I’ll try to add a unit test to check that setup and provide and fix.

25 does not intend to address such kind of setup.

baztian commented 1 year ago
$ move-to-monitor -vvv
DEBUG:ewmh_m2m.__main__:Detected screens: {Geometry(320, 1440, 1920, 1080), Geometry(0, 0, 2560, 1440)}
DEBUG:ewmh_m2m.__main__:Containing screen: Geometry(0, 0, 2560, 1440)
Traceback (most recent call last):
  File "/tmp/ewmh-m2m/bin/move-to-monitor", line 8, in <module>
    sys.exit(main())
  File "/tmp/ewmh-m2m/lib/python3.10/site-packages/ewmh_m2m/__main__.py", line 65, in main
    move_to_screen(args)
  File "/tmp/ewmh-m2m/lib/python3.10/site-packages/ewmh_m2m/__main__.py", line 36, in move_to_screen
    raise ValueError("No sibling screen found")
ValueError: No sibling screen found

But I found out that NORTH and SOUTH directions work.

$ move-to-monitor -vvv -d SOUTH
DEBUG:ewmh_m2m.__main__:Detected screens: {Geometry(320, 1440, 1920, 1080), Geometry(0, 0, 2560, 1440)}
DEBUG:ewmh_m2m.__main__:Containing screen: Geometry(0, 0, 2560, 1440)
DEBUG:ewmh_m2m.__main__:New window geometry: Geometry(320, 1440, 810, 372)
AlexisBRENON commented 1 year ago

The default move direction is EAST. But you don’t have any screen in the East direction (or west, as direction cycles), so it’s expected that the default call move-to-monitor fails.

As you found, you must pass a vertical direction (SOUTH or NORTH) to make the script consider the bottom or top screen a candidate to move to.

If your screen setup often changes from vertical setup to horizontal one, I suggest you to use 2 calls, as suggested in #20: move-to-monitor || move-to-monitor -d SOUTH This way, it tries to move horizontally and fallback on moving vertically if no horizontal screen is found.

I close this issue as you found the right way to fix it. 😉