hyprland-community/pyprland

[BUG] scratchpads "position" option is ignored

Closed this issue · 3 comments

Pyprland version
Pyprland 2.0.4 and pyprland-git r650.ba16fc8-1 (Arch Linux AUR Package)

Describe the bug
scratchpads don't follow "position" option

To Reproduce

  1. set "position" option in pyprland.toml
  2. (re)start pypr daemon
  3. The floating window is fixed in relation of the "animation" option.
    "fromTop" puts it in the center of the screen horizontally. "fromRight" puts it in the center of the screen vertically. The "position" option is ignored.

Expected behavior
The drop window should be placed at the designated coordinates.

Configuration

  • pyprland.toml
…
[scratchpads.term]
animation = "fromRight"
command = "wezterm start --class=wezterm-dropterm"
class = "wezterm-dropterm"
margin = 13
size = "2102px 1154px"
position = "500px 500px"

Additional context
LOG

2024-02-29 18:19:49,293 [INFO] ipc :: Logger "ipc" initialized :: common.py:78
2024-02-29 18:19:49,293 [INFO] startup :: Logger "startup" initialized :: common.py:78
2024-02-29 18:19:49,293 [INFO] pypr :: Logger "pypr" initialized :: common.py:78
2024-02-29 18:19:49,294 [INFO] pypr :: Loading /home/ewigkeit/.config/hypr/pyprland.toml :: command.py:66
2024-02-29 18:19:49,294 [INFO] pyprland :: Logger "pyprland" initialized :: common.py:78
2024-02-29 18:19:49,294 [DEBUG] ipc :: activeworkspace :: ipc.py:75
2024-02-29 18:19:49,294 [DEBUG] ipc :: monitors :: ipc.py:75
2024-02-29 18:19:49,294 [INFO] pyprland :: configured :: command.py:119
2024-02-29 18:19:49,299 [INFO] scratchpads :: Logger "scratchpads" initialized :: common.py:78
2024-02-29 18:19:49,299 [DEBUG] ipc :: monitors :: ipc.py:75
2024-02-29 18:19:49,299 [DEBUG] ipc :: keyword ['windowrule workspace special:scratch_term silent,^(wezterm-dropterm)$', 'windowrule float,^(wezterm-dropterm)$', 'windowrule move 200% 500,^(wezterm-dropterm)$', 'windowrule size 2102 1154,^(wezterm-dropterm)$'] :: ipc.py:114
2024-02-29 18:19:49,300 [INFO] scratchpads :: term is not running, starting... :: scratchpads.py:512
2024-02-29 18:19:49,301 [INFO] scratchpads :: scratch term (wezterm start --class=wezterm-dropterm) has pid 39792 :: scratchpads.py:531
2024-02-29 18:19:49,301 [INFO] scratchpads :: starting term :: scratchpads.py:485
2024-02-29 18:19:49,301 [INFO] scratchpads :: ==> Wait for term spawning :: scratchpads.py:435
2024-02-29 18:19:49,402 [DEBUG] ipc :: clients :: ipc.py:75
2024-02-29 18:19:49,804 [DEBUG] ipc :: clients :: ipc.py:75
2024-02-29 18:19:49,805 [INFO] scratchpads :: => term client (proc:39792, addr:0x606d6d6bfc40) detected on time :: scratchpads.py:448
2024-02-29 18:19:49,805 [INFO] scratchpads :: configured :: command.py:119
2024-02-29 18:19:49,805 [DEBUG] pypr :: ================================[ initialized ]================================= :: command.py:293
2024-02-29 18:19:49,805 [DEBUG] pyprland :: �[30;1mevent_activewindowv2('606d6d6b2f50',)�[0m :: command.py:142
2024-02-29 18:19:49,805 [DEBUG] scratchpads :: �[30;1mevent_activewindowv2('606d6d6b2f50',)�[0m :: command.py:142
2024-02-29 18:19:49,805 [DEBUG] scratchpads :: �[30;1mevent_openwindow('606d6d6bfc40,special:scratch_term silent,wezterm-dropterm,wezterm',)�[0m :: command.py:142
2024-02-29 18:19:49,805 [DEBUG] ipc :: clients :: ipc.py:75
2024-02-29 18:19:49,806 [DEBUG] ipc :: dispatch movetoworkspacesilent special:scratch_term,address:0x606d6d6bfc40 :: ipc.py:114
2024-02-29 18:20:02,944 [DEBUG] pyprland :: �[30;1mevent_activewindowv2('606d6d6b2f50',)�[0m :: command.py:142
2024-02-29 18:20:02,944 [DEBUG] scratchpads :: �[30;1mevent_activewindowv2('606d6d6b2f50',)�[0m :: command.py:142
2024-02-29 18:20:03,504 [DEBUG] scratchpads :: �[33;1mrun_toggle('term',)�[0m :: command.py:142
2024-02-29 18:20:03,504 [DEBUG] scratchpads :: term is visible = False :: scratchpads.py:691
2024-02-29 18:20:03,504 [INFO] scratchpads :: Showing term :: scratchpads.py:738
2024-02-29 18:20:03,504 [DEBUG] ipc :: monitors :: ipc.py:75
2024-02-29 18:20:03,505 [DEBUG] ipc :: keyword ['windowrule workspace special:scratch_term silent,^(wezterm-dropterm)$', 'windowrule float,^(wezterm-dropterm)$', 'windowrule move 200% 500,^(wezterm-dropterm)$', 'windowrule size 2102 1154,^(wezterm-dropterm)$'] :: ipc.py:114
2024-02-29 18:20:03,506 [DEBUG] ipc :: clients :: ipc.py:75
2024-02-29 18:20:03,506 [DEBUG] ipc :: monitors :: ipc.py:75
2024-02-29 18:20:03,506 [DEBUG] ipc :: dispatch ['moveworkspacetomonitor special:scratch_term DP-1', 'movetoworkspacesilent 1,address:0x606d6d6bfc40', 'alterzorder top,address:0x606d6d6bfc40'] :: ipc.py:114
2024-02-29 18:20:03,507 [DEBUG] pyprland :: �[30;1mevent_activewindowv2('606d6d6b2f50',)�[0m :: command.py:142
2024-02-29 18:20:03,510 [DEBUG] ipc :: dispatch movewindowpixel exact 500 500,address:0x606d6d6bfc40 :: ipc.py:114
2024-02-29 18:20:03,511 [DEBUG] ipc :: dispatch resizewindowpixel exact 2102 1154,address:0x606d6d6bfc40 :: ipc.py:114
2024-02-29 18:20:03,511 [DEBUG] ipc :: clients :: ipc.py:75
2024-02-29 18:20:03,512 [DEBUG] ipc :: dispatch movewindowpixel exact 1325 143,address:0x606d6d6bfc40 :: ipc.py:114
2024-02-29 18:20:03,512 [DEBUG] ipc :: dispatch focuswindow address:0x606d6d6bfc40 :: ipc.py:114
2024-02-29 18:20:03,513 [DEBUG] pyprland :: �[30;1mevent_activewindowv2('606d6d6bfc40',)�[0m :: command.py:142
2024-02-29 18:20:03,713 [DEBUG] scratchpads :: �[30;1mevent_activewindowv2('606d6d6b2f50',)�[0m :: command.py:142
2024-02-29 18:20:03,714 [DEBUG] scratchpads :: �[30;1mevent_activewindowv2('606d6d6bfc40',)�[0m :: command.py:142
2024-02-29 18:20:29,523 [DEBUG] scratchpads :: �[33;1mrun_toggle('term',)�[0m :: command.py:142
2024-02-29 18:20:29,523 [DEBUG] scratchpads :: term is visible = True :: scratchpads.py:691
2024-02-29 18:20:29,523 [INFO] scratchpads :: Hiding term :: scratchpads.py:831
2024-02-29 18:20:29,523 [DEBUG] ipc :: dispatch movewindowpixel 1500 0,address:0x606d6d6bfc40 :: ipc.py:114
2024-02-29 18:20:29,724 [DEBUG] ipc :: dispatch movetoworkspacesilent special:scratch_term,address:0x606d6d6bfc40 :: ipc.py:114
2024-02-29 18:20:29,726 [DEBUG] ipc :: dispatch focuswindow address:0x606d6d6b2f50 :: ipc.py:114
2024-02-29 18:20:29,726 [DEBUG] pyprland :: �[30;1mevent_activewindowv2('606d6d6b2f50',)�[0m :: command.py:142
2024-02-29 18:20:29,727 [DEBUG] pyprland :: �[30;1mevent_activewindowv2('606d6d6b2f50',)�[0m :: command.py:142
2024-02-29 18:20:29,727 [DEBUG] scratchpads :: �[30;1mevent_activewindowv2('606d6d6b2f50',)�[0m :: command.py:142
2024-02-29 18:20:29,727 [DEBUG] scratchpads :: �[30;1mevent_activewindowv2('606d6d6b2f50',)�[0m :: command.py:142
2024-02-29 18:20:38,990 [CRITICAL] pypr :: cancelled :: command.py:299

Especially lines 37 & 40 are interessting, as the designated position gets overridden:

2024-02-29 18:20:03,510 [DEBUG] ipc :: dispatch movewindowpixel exact 500 500,address:0x606d6d6bfc40 :: ipc.py:114
2024-02-29 18:20:03,512 [DEBUG] ipc :: dispatch movewindowpixel exact 1325 143,address:0x606d6d6bfc40 :: ipc.py:114

Thank you for your time and this helpful project!

oops, closed by mistake from the commit message... but I think I fixed it.

In the latest releases indeed "position" wasn't considered at all when an animation is in use.

I changed it as such:

  • position has precedence over everything
  • if it's not set, uses animation and (optional margin)
  • else log an error

Do you have a chance to test the git version ?

I can provide a standalone "pypr" program eventually... (but it's binary code)

@iliayar looks like I broke position again... you might be interested in this one for testing... I changed some of the logic when fixing it.

If you can think about a unit test for it, it can help (me not break this code) in the future since I'm not using it...

Noticed the commit, rebuilt the package and it works like a charm!

Thanks for the quick help 😃