Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non aligned screens #25

Merged
merged 7 commits into from
Jul 24, 2024
Merged

Non aligned screens #25

merged 7 commits into from
Jul 24, 2024

Conversation

AlexisBRENON
Copy link
Owner

@semihalf-barnas-michal Here is an attempt at using more ordinal points.
Can you test if it match your needs or not ?
Thanks.

@AlexisBRENON
Copy link
Owner Author

@glolsh can you test this?

Here are the steps to install this development version.

  1. Clone the repository
  2. Uninstall your current move-to-monitor command
  3. Checkout the feature branch
  4. Build and install the local move-to-monitor command
git clone git@github.com:AlexisBRENON/ewmh_m2m.git && cd ewmh_m2m
pip uninstall ewmh-m2m
git checkout non_aligned_screens
pip install .

@glolsh
Copy link

glolsh commented Jul 22, 2024

So here I am.
image

I made script with move-to-monitor -d SOUTH_WEST || move-to-monitor -d SOUTH_EAST || move-to-monitor -d NORTH that is called when I use shortcut.
(but I used pipx since manjaro I'm using don't like to use pip)
image
Anyway here is behavior:

  1. Window is placed on screen 2 manually, using shortcut - it is moving nowhere, it just blinks.
  2. Windows is placed on screen 3 manually, using shortcut - it is moving to screen 1. When using shortcut again - it is moving on screen 3.

@AlexisBRENON
Copy link
Owner Author

Thank you for this unvaluable feedback.
May I ask you to manually run the command (place your terminal on the screen and run the command in your terminal) in debug mode (add -vvv option to each call)? This way, it will display the computed coordinates and I should be able to understand why it doesn't act as expected.

@glolsh
Copy link

glolsh commented Jul 22, 2024

Strange, looks like it can't work with new keys, I reinstalled it (when uninstalled - it's not working so it should be the one you've provided me with), and it still works like this.
1.

Traceback (most recent call last):
  File "/home/shar/.local/bin/move-to-monitor", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/shar/.local/share/pipx/venvs/ewmh-m2m/lib/python3.12/site-packages/ewmh_m2m/__main__.py", line 65, in main
    args = arg_parser.parse_args()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 1896, in parse_args
    args, argv = self.parse_known_args(args, namespace)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 1929, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 2150, in _parse_known_args
    start_index = consume_optional(start_index)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 2090, in consume_optional
    take_action(action, args, option_string)
  File "/usr/lib/python3.12/argparse.py", line 1989, in take_action
    argument_values = self._get_values(action, argument_strings)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 2532, in _get_values
    value = self._get_value(action, arg_string)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 2565, in _get_value
    result = type_func(arg_string)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/enum.py", line 814, in __getitem__
    return cls._member_map_[name]
           ~~~~~~~~~~~~~~~~^^^^^^
KeyError: 'SOUTH_WEST'
Traceback (most recent call last):
  File "/home/shar/.local/bin/move-to-monitor", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/shar/.local/share/pipx/venvs/ewmh-m2m/lib/python3.12/site-packages/ewmh_m2m/__main__.py", line 65, in main
    args = arg_parser.parse_args()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 1896, in parse_args
    args, argv = self.parse_known_args(args, namespace)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 1929, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 2150, in _parse_known_args
    start_index = consume_optional(start_index)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 2090, in consume_optional
    take_action(action, args, option_string)
  File "/usr/lib/python3.12/argparse.py", line 1989, in take_action
    argument_values = self._get_values(action, argument_strings)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 2532, in _get_values
    value = self._get_value(action, arg_string)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 2565, in _get_value
    result = type_func(arg_string)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/enum.py", line 814, in __getitem__
    return cls._member_map_[name]
           ~~~~~~~~~~~~~~~~^^^^^^
KeyError: 'SOUTH_EAST'
DEBUG:ewmh_m2m.__main__:Detected screens: {Geometry(0, 130, 1080, 1920), Geometry(1080, 0, 1920, 1080), Geometry(1080, 1080, 1920, 1080)}
DEBUG:ewmh_m2m.__main__:Containing screen: Geometry(0, 130, 1080, 1920)
Traceback (most recent call last):
  File "/home/shar/.local/bin/move-to-monitor", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/shar/.local/share/pipx/venvs/ewmh-m2m/lib/python3.12/site-packages/ewmh_m2m/__main__.py", line 67, in main
    move_to_screen(args)
  File "/home/shar/.local/share/pipx/venvs/ewmh-m2m/lib/python3.12/site-packages/ewmh_m2m/__main__.py", line 36, in move_to_screen
    raise ValueError("No sibling screen found")
ValueError: No sibling screen found
Traceback (most recent call last):
  File "/home/shar/.local/bin/move-to-monitor", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/shar/.local/share/pipx/venvs/ewmh-m2m/lib/python3.12/site-packages/ewmh_m2m/__main__.py", line 65, in main
    args = arg_parser.parse_args()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 1896, in parse_args
    args, argv = self.parse_known_args(args, namespace)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 1929, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 2150, in _parse_known_args
    start_index = consume_optional(start_index)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 2090, in consume_optional
    take_action(action, args, option_string)
  File "/usr/lib/python3.12/argparse.py", line 1989, in take_action
    argument_values = self._get_values(action, argument_strings)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 2532, in _get_values
    value = self._get_value(action, arg_string)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 2565, in _get_value
    result = type_func(arg_string)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/enum.py", line 814, in __getitem__
    return cls._member_map_[name]
           ~~~~~~~~~~~~~~~~^^^^^^
KeyError: 'SOUTH_WEST'
Traceback (most recent call last):
  File "/home/shar/.local/bin/move-to-monitor", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/shar/.local/share/pipx/venvs/ewmh-m2m/lib/python3.12/site-packages/ewmh_m2m/__main__.py", line 65, in main
    args = arg_parser.parse_args()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 1896, in parse_args
    args, argv = self.parse_known_args(args, namespace)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 1929, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 2150, in _parse_known_args
    start_index = consume_optional(start_index)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 2090, in consume_optional
    take_action(action, args, option_string)
  File "/usr/lib/python3.12/argparse.py", line 1989, in take_action
    argument_values = self._get_values(action, argument_strings)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 2532, in _get_values
    value = self._get_value(action, arg_string)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/argparse.py", line 2565, in _get_value
    result = type_func(arg_string)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/enum.py", line 814, in __getitem__
    return cls._member_map_[name]
           ~~~~~~~~~~~~~~~~^^^^^^
KeyError: 'SOUTH_EAST'
DEBUG:ewmh_m2m.__main__:Detected screens: {Geometry(0, 130, 1080, 1920), Geometry(1080, 0, 1920, 1080), Geometry(1080, 1080, 1920, 1080)}
DEBUG:ewmh_m2m.__main__:Containing screen: Geometry(1080, 0, 1920, 1080)
DEBUG:ewmh_m2m.__main__:New window geometry: Geometry(1637, 1341, 658, 464)

@AlexisBRENON
Copy link
Owner Author

AlexisBRENON commented Jul 22, 2024

My bad, directions should be typed in single word:
move-to-monitor -d SOUTHWEST || move-to-monitor -d SOUTHEAST || move-to-monitor -d NORTH

You can get the list of supported values with move-to-monitor -h.

@glolsh
Copy link

glolsh commented Jul 22, 2024

My bad, directions should be typed in single word: move-to-monitor -d SOUTHWEST || move-to-monitor -d SOUTHEAST || move-to-monitor -d NORTH

You can get the list of supported values with move-to-monitor -h.

This one is not getting job done, but I have a question now - what's the difference between NORTH_NORTHEAST and NORTHEAST?

move-to-monitor -d SOUTHWEST || move-to-monitor -d SOUTHEAST || move-to-monitor -d NORTH
Traceback (most recent call last):
  File "/home/shar/.local/bin/move-to-monitor", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/shar/.local/share/pipx/venvs/ewmh-m2m/lib/python3.12/site-packages/ewmh_m2m/__main__.py", line 67, in main
    move_to_screen(args)
  File "/home/shar/.local/share/pipx/venvs/ewmh-m2m/lib/python3.12/site-packages/ewmh_m2m/__main__.py", line 36, in move_to_screen
    raise ValueError("No sibling screen found")
ValueError: No sibling screen found
Traceback (most recent call last):
  File "/home/shar/.local/bin/move-to-monitor", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/shar/.local/share/pipx/venvs/ewmh-m2m/lib/python3.12/site-packages/ewmh_m2m/__main__.py", line 67, in main
    move_to_screen(args)
  File "/home/shar/.local/share/pipx/venvs/ewmh-m2m/lib/python3.12/site-packages/ewmh_m2m/__main__.py", line 36, in move_to_screen
    raise ValueError("No sibling screen found")
ValueError: No sibling screen found
Traceback (most recent call last):
  File "/home/shar/.local/bin/move-to-monitor", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/shar/.local/share/pipx/venvs/ewmh-m2m/lib/python3.12/site-packages/ewmh_m2m/__main__.py", line 67, in main
    move_to_screen(args)
  File "/home/shar/.local/share/pipx/venvs/ewmh-m2m/lib/python3.12/site-packages/ewmh_m2m/__main__.py", line 36, in move_to_screen
    raise ValueError("No sibling screen found")
ValueError: No sibling screen found

move-to-monitor -d SOUTHWEST || move-to-monitor -d SOUTHEAST || move-to-monitor -d NORTH
Traceback (most recent call last):
  File "/home/shar/.local/bin/move-to-monitor", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/shar/.local/share/pipx/venvs/ewmh-m2m/lib/python3.12/site-packages/ewmh_m2m/__main__.py", line 67, in main
    move_to_screen(args)
  File "/home/shar/.local/share/pipx/venvs/ewmh-m2m/lib/python3.12/site-packages/ewmh_m2m/__main__.py", line 36, in move_to_screen
    raise ValueError("No sibling screen found")
ValueError: No sibling screen found
Traceback (most recent call last):
  File "/home/shar/.local/bin/move-to-monitor", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/shar/.local/share/pipx/venvs/ewmh-m2m/lib/python3.12/site-packages/ewmh_m2m/__main__.py", line 67, in main
    move_to_screen(args)
  File "/home/shar/.local/share/pipx/venvs/ewmh-m2m/lib/python3.12/site-packages/ewmh_m2m/__main__.py", line 36, in move_to_screen
    raise ValueError("No sibling screen found")
ValueError: No sibling screen found

p.s. when using just move-to-monitor -vvv on case 1, it works. Looks like chaining is going wrong, cause if I change to move-to-monitor -d SOUTHEAST || move-to-monitor -d SOUTHWEST || move-to-monitor -d NORTH - it's not working in case 1

DEBUG:ewmh_m2m.__main__:Detected screens: {Geometry(0, 130, 1080, 1920), Geometry(1080, 0, 1920, 1080), Geometry(1080, 1080, 1920, 1080)}
DEBUG:ewmh_m2m.__main__:Containing screen: Geometry(0, 130, 1080, 1920)
DEBUG:ewmh_m2m.__main__:New window geometry: Geometry(1254, 1614, 1169, 261)

barnas-michal and others added 5 commits July 22, 2024 15:21
index instead of position.

This will allow to move windows when the displays are not set in "siblings" positions,
where no coordinates (x and y) are equal and will allow to have windows-like control.
This change allows to use the program without parameters when there's no siblings
in the default configuration.
@AlexisBRENON
Copy link
Owner Author

AlexisBRENON commented Jul 22, 2024

I really want to thank you to test such kind of setup.
Actually I didn't remember what was the difference between NORTH_NORTHEAST and NORTHEAST. I just added a test to highlight the behavior.
So the fact is that NORTHEAST alone, match only screen which doesn't overlap the source screen at all. In your case, screens overlap, so this is not the right value to use.

So, what about:
move-to-monitor -vvv -d WEST_SOUTHWEST || move-to-monitor -vvv -d EAST_SOUTHEAST || move-to-monitor -vvv -d NORTH

P.S. I rebased and force pushed. You may have to "force pull" if you want to pull the latest source locally (it's not required if you just want to test the command above).
git fetch && git reset --hard '@{u}'.

@glolsh
Copy link

glolsh commented Jul 22, 2024

Dunno if you're joking or not about "this kind of setup". Maybe it's my QA karma following me, cause I found some corner case and bother you with it...Sorry for that anyway(

So, what about: move-to-monitor -vvv -d WEST_SOUTHWEST || move-to-monitor -vvv -d EAST_SOUTHEAST || move-to-monitor -vvv -d NORTH

P.S. I rebased and force pushed. You may have to "force pull" if you want to pull the latest source locally (it's not required if you just want to test the command above). git fetch && git reset --hard '@{u}'.

Okay I did what you asked for and updated local repo.
Behavior changed.

  1. Window is placed on screen 1 manually, using command - moved to 2.
move-to-monitor -vvv -d WEST_SOUTHWEST || move-to-monitor -vvv -d EAST_SOUTHEAST || move-to-monitor -vvv -d NORTH
DEBUG:ewmh_m2m.__main__:Detected screens: {Geometry(0, 130, 1080, 1920), Geometry(1080, 0, 1920, 1080), Geometry(1080, 1080, 1920, 1080)}
DEBUG:ewmh_m2m.__main__:Containing screen: Geometry(1080, 0, 1920, 1080)
DEBUG:ewmh_m2m.__main__:New window geometry: Geometry(351, 706, 369, 817)
  1. Window is placed on screen 2 manually, using command - moved to 1.
move-to-monitor -vvv -d WEST_SOUTHWEST || move-to-monitor -vvv -d EAST_SOUTHEAST || move-to-monitor -vvv -d NORTH
DEBUG:ewmh_m2m.__main__:Detected screens: {Geometry(0, 130, 1080, 1920), Geometry(1080, 0, 1920, 1080), Geometry(1080, 1080, 1920, 1080)}
DEBUG:ewmh_m2m.__main__:Containing screen: Geometry(0, 130, 1080, 1920)
DEBUG:ewmh_m2m.__main__:New window geometry: Geometry(1704, 324, 656, 459)
  1. Window is placed on screen 3 manually, using command - moved to 2
move-to-monitor -vvv -d WEST_SOUTHWEST || move-to-monitor -vvv -d EAST_SOUTHEAST || move-to-monitor -vvv -d NORTH
DEBUG:ewmh_m2m.__main__:Detected screens: {Geometry(0, 130, 1080, 1920), Geometry(1080, 0, 1920, 1080), Geometry(1080, 1080, 1920, 1080)}
DEBUG:ewmh_m2m.__main__:Containing screen: Geometry(1080, 1080, 1920, 1080)
Traceback (most recent call last):
  File "/home/shar/.local/bin/move-to-monitor", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/shar/.local/share/pipx/venvs/ewmh-m2m/lib/python3.12/site-packages/ewmh_m2m/__main__.py", line 67, in main
    move_to_screen(args)
  File "/home/shar/.local/share/pipx/venvs/ewmh-m2m/lib/python3.12/site-packages/ewmh_m2m/__main__.py", line 36, in move_to_screen
    raise ValueError("No sibling screen found")
ValueError: No sibling screen found
DEBUG:ewmh_m2m.__main__:Detected screens: {Geometry(0, 130, 1080, 1920), Geometry(1080, 0, 1920, 1080), Geometry(1080, 1080, 1920, 1080)}
DEBUG:ewmh_m2m.__main__:Containing screen: Geometry(1080, 1080, 1920, 1080)
DEBUG:ewmh_m2m.__main__:New window geometry: Geometry(313, 666, 366, 808)

In the end it looks like we're almost there. And about overlapping - can't see where you found that.

@AlexisBRENON
Copy link
Owner Author

Dunno if you're joking or not about "this kind of setup".

No. Actually, I started this project with very simple setups in mind (I had only two screens, either horizontally or vertically aligned). I'm happy to see more people use it and to discover their setup.

I totally rewrote the direction computation and added a test to mimic your setup.
Feel free to pull and re-test.

And about overlapping - can't see where you found that.

I mean, your left screen is (horizontally) overlapping both of your right screens.

@glolsh
Copy link

glolsh commented Jul 23, 2024

Thanks! It's my secondary pc layout and first time it's like this (I need to conserve space)

  1. Window is placed on screen 1 manually, using command - moved to 2.
move-to-monitor -vvv -d WEST_SOUTHWEST || move-to-monitor -vvv -d EAST_SOUTHEAST || move-to-monitor -vvv -d NORTH
DEBUG:ewmh_m2m.__main__:Detected screens: {Geometry(0, 130, 1080, 1920), Geometry(1080, 0, 1920, 1080), Geometry(1080, 1080, 1920, 1080)}
DEBUG:ewmh_m2m.__main__:Containing screen: Geometry(1080, 0, 1920, 1080)
[(0.0017016276385742682, <Ordinal.WEST_SOUTHWEST: 202.5>), (0.12224736822678268, <Ordinal.WEST: 180.0>), (0.18537884429780535, <Ordinal.SOUTHWEST: 225.0>), (0.5286632352541457, <Ordinal.WEST_NORTHWEST: 157.5>), (0.6453165519751619, <Ordinal.SOUTH_SOUTHWEST: 247.5>), (1.159078333107666, <Ordinal.NORTHWEST: 135.0>), (1.3114907016831536, <Ordinal.SOUTH: 270.0>), (1.9175164930330983, <Ordinal.NORTH_NORTHWEST: 112.5>), (2.082484572744902, <Ordinal.SOUTH_SOUTHEAST: 292.5>), (2.6885092983168466, <Ordinal.NORTH: 90.0>), (2.840922904688334, <Ordinal.SOUTHEAST: 315.0>), (3.3546845138028383, <Ordinal.NORTH_NORTHEAST: 67.5>), (3.4713378305238543, <Ordinal.EAST_SOUTHEAST: 337.5>), (3.8146223934981944, <Ordinal.NORTHEAST: 45.0>), (3.877752631773218, <Ordinal.EAST: 0.0>), (3.998299438139426, <Ordinal.EAST_NORTHEAST: 22.5>)]
[(0.0, <Ordinal.SOUTH: 270.0>), (0.152240532889, <Ordinal.SOUTH_SOUTHWEST: 247.5>), (0.152240532889, <Ordinal.SOUTH_SOUTHEAST: 292.5>), (0.5857866188980001, <Ordinal.SOUTHWEST: 225.0>), (0.5857866188980001, <Ordinal.SOUTHEAST: 315.0>), (1.234634532889, <Ordinal.WEST_SOUTHWEST: 202.5>), (1.234634532889, <Ordinal.EAST_SOUTHEAST: 337.5>), (2.0, <Ordinal.EAST: 0.0>), (2.0, <Ordinal.WEST: 180.0>), (2.7653665328890007, <Ordinal.EAST_NORTHEAST: 22.5>), (2.7653665328890007, <Ordinal.WEST_NORTHWEST: 157.5>), (3.4142146188980007, <Ordinal.NORTHEAST: 45.0>), (3.4142146188980007, <Ordinal.NORTHWEST: 135.0>), (3.847760532889, <Ordinal.NORTH_NORTHEAST: 67.5>), (3.847760532889, <Ordinal.NORTH_NORTHWEST: 112.5>), (4.0, <Ordinal.NORTH: 90.0>)]
DEBUG:ewmh_m2m.__main__:New window geometry: Geometry(263, 851, 611, 824)
  1. Window is placed on screen 2 manually, using command - moved to 1.
move-to-monitor -vvv -d WEST_SOUTHWEST || move-to-monitor -vvv -d EAST_SOUTHEAST || move-to-monitor -vvv -d NORTH
DEBUG:ewmh_m2m.__main__:Detected screens: {Geometry(0, 130, 1080, 1920), Geometry(1080, 0, 1920, 1080), Geometry(1080, 1080, 1920, 1080)}
DEBUG:ewmh_m2m.__main__:Containing screen: Geometry(0, 130, 1080, 1920)
[(0.0017016276385742682, <Ordinal.EAST_NORTHEAST: 22.5>), (0.12224736822678268, <Ordinal.EAST: 0.0>), (0.18537884429780535, <Ordinal.NORTHEAST: 45.0>), (0.5286632352541457, <Ordinal.EAST_SOUTHEAST: 337.5>), (0.6453165519751619, <Ordinal.NORTH_NORTHEAST: 67.5>), (1.159078333107666, <Ordinal.SOUTHEAST: 315.0>), (1.3114907016831536, <Ordinal.NORTH: 90.0>), (1.9175164930330983, <Ordinal.SOUTH_SOUTHEAST: 292.5>), (2.082484572744902, <Ordinal.NORTH_NORTHWEST: 112.5>), (2.6885092983168466, <Ordinal.SOUTH: 270.0>), (2.840922904688334, <Ordinal.NORTHWEST: 135.0>), (3.3546845138028383, <Ordinal.SOUTH_SOUTHWEST: 247.5>), (3.4713378305238543, <Ordinal.WEST_NORTHWEST: 157.5>), (3.8146223934981944, <Ordinal.SOUTHWEST: 225.0>), (3.877752631773218, <Ordinal.WEST: 180.0>), (3.998299438139426, <Ordinal.WEST_SOUTHWEST: 202.5>)]
[(0.0028144083716743692, <Ordinal.EAST_SOUTHEAST: 337.5>), (0.11425153959578492, <Ordinal.EAST: 0.0>), (0.19543085137812144, <Ordinal.SOUTHEAST: 315.0>), (0.5127760822098332, <Ordinal.EAST_NORTHEAST: 22.5>), (0.6627774531980868, <Ordinal.SOUTH_SOUTHEAST: 292.5>), (1.137718513235792, <Ordinal.NORTHEAST: 45.0>), (1.3337022106571774, <Ordinal.SOUTH: 270.0>), (1.893935856434181, <Ordinal.NORTH_NORTHEAST: 67.5>), (2.106065209343819, <Ordinal.SOUTH_SOUTHWEST: 247.5>), (2.666297789342823, <Ordinal.NORTH: 90.0>), (2.862282724560208, <Ordinal.SOUTHWEST: 225.0>), (3.3372236125799133, <Ordinal.NORTH_NORTHWEST: 112.5>), (3.4872249835681672, <Ordinal.WEST_SOUTHWEST: 202.5>), (3.8045703864178786, <Ordinal.NORTHWEST: 135.0>), (3.885748460404215, <Ordinal.WEST: 180.0>), (3.997186657406326, <Ordinal.WEST_NORTHWEST: 157.5>)]
DEBUG:ewmh_m2m.__main__:New window geometry: Geometry(1547, 405, 1086, 463)
  1. Window is placed on screen 3 manually, using command - moved to 2.
move-to-monitor -vvv -d WEST_SOUTHWEST || move-to-monitor -vvv -d EAST_SOUTHEAST || move-to-monitor -vvv -d NORTH
DEBUG:ewmh_m2m.__main__:Detected screens: {Geometry(0, 130, 1080, 1920), Geometry(1080, 0, 1920, 1080), Geometry(1080, 1080, 1920, 1080)}
DEBUG:ewmh_m2m.__main__:Containing screen: Geometry(1080, 1080, 1920, 1080)
[(0.0028144083716743692, <Ordinal.WEST_NORTHWEST: 157.5>), (0.11425153959578492, <Ordinal.WEST: 180.0>), (0.19543085137812144, <Ordinal.NORTHWEST: 135.0>), (0.5127760822098332, <Ordinal.WEST_SOUTHWEST: 202.5>), (0.6627774531980868, <Ordinal.NORTH_NORTHWEST: 112.5>), (1.137718513235792, <Ordinal.SOUTHWEST: 225.0>), (1.3337022106571774, <Ordinal.NORTH: 90.0>), (1.893935856434181, <Ordinal.SOUTH_SOUTHWEST: 247.5>), (2.106065209343819, <Ordinal.NORTH_NORTHEAST: 67.5>), (2.666297789342823, <Ordinal.SOUTH: 270.0>), (2.862282724560208, <Ordinal.NORTHEAST: 45.0>), (3.3372236125799133, <Ordinal.SOUTH_SOUTHEAST: 292.5>), (3.4872249835681672, <Ordinal.EAST_NORTHEAST: 22.5>), (3.8045703864178786, <Ordinal.SOUTHEAST: 315.0>), (3.885748460404215, <Ordinal.EAST: 0.0>), (3.997186657406326, <Ordinal.EAST_SOUTHEAST: 337.5>)]
[(0.0, <Ordinal.NORTH: 90.0>), (0.152240532889, <Ordinal.NORTH_NORTHEAST: 67.5>), (0.152240532889, <Ordinal.NORTH_NORTHWEST: 112.5>), (0.5857866188980001, <Ordinal.NORTHEAST: 45.0>), (0.5857866188980001, <Ordinal.NORTHWEST: 135.0>), (1.234634532889, <Ordinal.EAST_NORTHEAST: 22.5>), (1.234634532889, <Ordinal.WEST_NORTHWEST: 157.5>), (2.0, <Ordinal.EAST: 0.0>), (2.0, <Ordinal.WEST: 180.0>), (2.7653665328890007, <Ordinal.WEST_SOUTHWEST: 202.5>), (2.7653665328890007, <Ordinal.EAST_SOUTHEAST: 337.5>), (3.4142146188980007, <Ordinal.SOUTHWEST: 225.0>), (3.4142146188980007, <Ordinal.SOUTHEAST: 315.0>), (3.847760532889, <Ordinal.SOUTH_SOUTHWEST: 247.5>), (3.847760532889, <Ordinal.SOUTH_SOUTHEAST: 292.5>), (4.0, <Ordinal.SOUTH: 270.0>)]
Traceback (most recent call last):
  File "/home/shar/.local/bin/move-to-monitor", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/shar/.local/share/pipx/venvs/ewmh-m2m/lib/python3.12/site-packages/ewmh_m2m/__main__.py", line 67, in main
    move_to_screen(args)
  File "/home/shar/.local/share/pipx/venvs/ewmh-m2m/lib/python3.12/site-packages/ewmh_m2m/__main__.py", line 36, in move_to_screen
    raise ValueError("No sibling screen found")
ValueError: No sibling screen found
DEBUG:ewmh_m2m.__main__:Detected screens: {Geometry(0, 130, 1080, 1920), Geometry(1080, 0, 1920, 1080), Geometry(1080, 1080, 1920, 1080)}
DEBUG:ewmh_m2m.__main__:Containing screen: Geometry(1080, 1080, 1920, 1080)
[(0.0028144083716743692, <Ordinal.WEST_NORTHWEST: 157.5>), (0.11425153959578492, <Ordinal.WEST: 180.0>), (0.19543085137812144, <Ordinal.NORTHWEST: 135.0>), (0.5127760822098332, <Ordinal.WEST_SOUTHWEST: 202.5>), (0.6627774531980868, <Ordinal.NORTH_NORTHWEST: 112.5>), (1.137718513235792, <Ordinal.SOUTHWEST: 225.0>), (1.3337022106571774, <Ordinal.NORTH: 90.0>), (1.893935856434181, <Ordinal.SOUTH_SOUTHWEST: 247.5>), (2.106065209343819, <Ordinal.NORTH_NORTHEAST: 67.5>), (2.666297789342823, <Ordinal.SOUTH: 270.0>), (2.862282724560208, <Ordinal.NORTHEAST: 45.0>), (3.3372236125799133, <Ordinal.SOUTH_SOUTHEAST: 292.5>), (3.4872249835681672, <Ordinal.EAST_NORTHEAST: 22.5>), (3.8045703864178786, <Ordinal.SOUTHEAST: 315.0>), (3.885748460404215, <Ordinal.EAST: 0.0>), (3.997186657406326, <Ordinal.EAST_SOUTHEAST: 337.5>)]
[(0.0, <Ordinal.NORTH: 90.0>), (0.152240532889, <Ordinal.NORTH_NORTHEAST: 67.5>), (0.152240532889, <Ordinal.NORTH_NORTHWEST: 112.5>), (0.5857866188980001, <Ordinal.NORTHEAST: 45.0>), (0.5857866188980001, <Ordinal.NORTHWEST: 135.0>), (1.234634532889, <Ordinal.EAST_NORTHEAST: 22.5>), (1.234634532889, <Ordinal.WEST_NORTHWEST: 157.5>), (2.0, <Ordinal.EAST: 0.0>), (2.0, <Ordinal.WEST: 180.0>), (2.7653665328890007, <Ordinal.WEST_SOUTHWEST: 202.5>), (2.7653665328890007, <Ordinal.EAST_SOUTHEAST: 337.5>), (3.4142146188980007, <Ordinal.SOUTHWEST: 225.0>), (3.4142146188980007, <Ordinal.SOUTHEAST: 315.0>), (3.847760532889, <Ordinal.SOUTH_SOUTHWEST: 247.5>), (3.847760532889, <Ordinal.SOUTH_SOUTHEAST: 292.5>), (4.0, <Ordinal.SOUTH: 270.0>)]
DEBUG:ewmh_m2m.__main__:New window geometry: Geometry(352, 636, 610, 823)

I just don't get it why still says about subling screens when chain-execution is used, but nothing like that when specific command is used.
I'll gladly help with further testing, but if you'll grow tired of this - let's find some workaround:)

@AlexisBRENON
Copy link
Owner Author

No sibling screen found is raised when there is no screen discovered in the given direction. When you are on screen 3, there is no screen in WEST_SOUTHWEST, so this is expected. And so, the shell execute the next command.
I expected that the same exception would be raised for direction EAST_SOUTHEAST, but I forgot that by default, it tries to "wrap around". So if no screen is found on EAST_SOUTHEAST, it looks to WEST_NORTHWEST (the opposite direction), and here find screen 2 and so move the window to screen 2.

Can you add the -W to all your commands. This prevent the wrapping mechanism.
move-to-monitor -vvv -W -d WEST_SOUTHWEST || move-to-monitor -vvv -W -d EAST_SOUTHEAST || move-to-monitor -vvv -W -d NORTH

Thanks for your time.

@glolsh
Copy link

glolsh commented Jul 24, 2024

Finally it works like a charm!
Thanks for your work!
p.s. tested on last version of this branch

@AlexisBRENON
Copy link
Owner Author

Glad to hear ! 🎉

@AlexisBRENON AlexisBRENON merged commit 5e527b5 into master Jul 24, 2024
6 checks passed
@AlexisBRENON AlexisBRENON deleted the non_aligned_screens branch July 24, 2024 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants