hyprland-community/pyprland

[BUG] Scratchpad wont hide on multi-monitor setup (need help to reproduce)

Closed this issue ยท 27 comments

Pyprland version

python3.11-pyprland-2.0.8/

Describe the bug

I use a multi-monitor setup, the 2nd display connects over HDMI internally attached to USB-C (Framework laptop w/ HDMI adapter card).

When I boot up my system with the HDMI cable attached, my scratchpads won't hide. They loose focus and can't be interacted with, but they remain on screen.

To Reproduce

Steps to reproduce the behavior:

  1. Boot up laptop with HDMI cable connected,
  2. Login via SDDM, which starts up hyprland which starts pypr
  3. Open my kitty scratchpad
  4. Hide my kitty scratchpad -- ISSUE
  5. Open my kitty scratchpad, kitty works as expected
  6. Hide my kitty scratchpad -- ISSUE

Steps 4 - 6 can be repeated indefinitely.

If HDMI cable is connected after step 2, everything works as expected.

I mostly use multi-monitors and don't have any problem.
Can you share your config and logs ?

I've updated to

โฏ pypr version
2.0.8-16-gcc7def9

and can't reproduce anymore.
Closing this request as fixed.

Re-opening since the issue is still happening.

It's somehow connected to using systemctl hybrid-sleep with 2 monitors connected but not reliably/ reproducibly happening.

pyprland debug output from last suspend/ resume cycle

2024-03-14 12:46:29,591 [DEBUG] scratchpads :: event_monitorremoved('DP-4',) :: command.py:149
2024-03-14 12:46:29,594 [INFO] scratchpads :: Hiding kitty :: scratchpads.py:916
2024-03-14 12:46:29,594 [DEBUG] ipc :: dispatch movetoworkspacesilent special:scratch_kitty,address:0x3094440 :: ipc.py:114
2024-03-14 12:46:29,595 [DEBUG] pyprland :: event_workspace('5',) :: command.py:149
2024-03-14 12:46:29,595 [DEBUG] pyprland :: event_focusedmon('eDP-1,3',) :: command.py:149
2024-03-14 12:46:32,444 [DEBUG] pyprland :: event_workspace('2',) :: command.py:149
2024-03-14 12:46:32,444 [DEBUG] pyprland :: event_focusedmon('DP-4,6',) :: command.py:149
2024-03-14 12:46:32,445 [DEBUG] monitors :: event_monitoradded('DP-4',) :: command.py:149
2024-03-14 12:46:33,446 [DEBUG] ipc :: monitors :: ipc.py:75
2024-03-14 12:46:33,449 [DEBUG] monitors :: Using {'DP-4': {'topof': ['eDP-1']}} :: monitors.py:126
2024-03-14 12:46:33,449 [INFO] monitors :: wlr-randr --output DP-4 --pos 0,0 --output eDP-1 --pos 0,2160 :: monitors.py:145
2024-03-14 12:46:40,218 [DEBUG] pyprland :: event_activewindowv2('30cf130',) :: command.py:149
2024-03-14 12:46:40,219 [DEBUG] scratchpads :: event_activewindowv2('30cf130',) :: command.py:149
2024-03-14 12:46:40,287 [DEBUG] pyprland :: event_activewindowv2('3f28bf0',) :: command.py:149
2024-03-14 12:46:40,288 [DEBUG] scratchpads :: event_activewindowv2('3f28bf0',) :: command.py:149
2024-03-14 12:46:41,435 [DEBUG] scratchpads :: run_toggle('kitty',) :: command.py:149
2024-03-14 12:46:41,435 [DEBUG] scratchpads :: kitty is visible = False :: scratchpads.py:738
2024-03-14 12:46:41,436 [INFO] scratchpads :: Showing kitty :: scratchpads.py:789
2024-03-14 12:46:41,437 [DEBUG] ipc :: clients :: ipc.py:75
2024-03-14 12:46:41,438 [DEBUG] ipc :: monitors :: ipc.py:75
2024-03-14 12:46:41,439 [DEBUG] ipc :: dispatch ['moveworkspacetomonitor special:scratch_kitty DP-4', 'movetoworkspacesilent 4,address:0x3094440', 'alterzorder top,address:0x3094440'] :: ipc.py:114
2024-03-14 12:46:41,441 [DEBUG] pyprland :: event_activewindowv2('3f28bf0',) :: command.py:149
2024-03-14 12:46:41,445 [DEBUG] pyprland :: event_activewindowv2('3094440',) :: command.py:149
2024-03-14 12:46:41,445 [DEBUG] ipc :: dispatch resizewindowpixel exact 2841 1296,address:0x3094440 :: ipc.py:114
2024-03-14 12:46:41,446 [DEBUG] ipc :: clients :: ipc.py:75
2024-03-14 12:46:41,450 [DEBUG] ipc :: dispatch movewindowpixel exact 499 151,address:0x3094440 :: ipc.py:114
2024-03-14 12:46:41,451 [DEBUG] ipc :: dispatch focuswindow address:0x3094440 :: ipc.py:114
2024-03-14 12:46:41,453 [DEBUG] pyprland :: event_activewindowv2('3094440',) :: command.py:149
2024-03-14 12:46:41,653 [DEBUG] scratchpads :: event_activewindowv2('3f28bf0',) :: command.py:149
2024-03-14 12:46:41,654 [DEBUG] scratchpads :: event_activewindowv2('3094440',) :: command.py:149
2024-03-14 12:46:41,654 [DEBUG] scratchpads :: event_activewindowv2('3094440',) :: command.py:149
2024-03-14 12:46:42,241 [DEBUG] scratchpads :: run_toggle('kitty',) :: command.py:149
2024-03-14 12:46:42,241 [DEBUG] scratchpads :: kitty is visible = True :: scratchpads.py:738
2024-03-14 12:46:42,242 [INFO] scratchpads :: Hiding kitty :: scratchpads.py:916
2024-03-14 12:46:42,242 [DEBUG] ipc :: dispatch movetoworkspacesilent special:scratch_kitty,address:0x3094440 :: ipc.py:114
2024-03-14 12:46:42,245 [DEBUG] pyprland :: event_activewindowv2('3f39990',) :: command.py:149
2024-03-14 12:46:42,245 [DEBUG] scratchpads :: event_activewindowv2('3f39990',) :: command.py:149
2024-03-14 12:46:42,880 [DEBUG] scratchpads :: run_toggle('kitty',) :: command.py:149
2024-03-14 12:46:42,881 [DEBUG] scratchpads :: kitty is visible = False :: scratchpads.py:738
2024-03-14 12:46:42,881 [INFO] scratchpads :: Showing kitty :: scratchpads.py:789
2024-03-14 12:46:42,883 [DEBUG] ipc :: clients :: ipc.py:75
2024-03-14 12:46:42,884 [DEBUG] ipc :: monitors :: ipc.py:75
2024-03-14 12:46:42,884 [DEBUG] ipc :: dispatch ['moveworkspacetomonitor special:scratch_kitty DP-4', 'movetoworkspacesilent 4,address:0x3094440', 'alterzorder top,address:0x3094440'] :: ipc.py:114
2024-03-14 12:46:42,886 [DEBUG] pyprland :: event_activewindowv2('3f39990',) :: command.py:149
2024-03-14 12:46:42,889 [DEBUG] ipc :: dispatch resizewindowpixel exact 2841 1296,address:0x3094440 :: ipc.py:114
2024-03-14 12:46:42,890 [DEBUG] ipc :: clients :: ipc.py:75
2024-03-14 12:46:42,892 [DEBUG] ipc :: dispatch movewindowpixel exact 499 151,address:0x3094440 :: ipc.py:114
2024-03-14 12:46:42,893 [DEBUG] ipc :: dispatch focuswindow address:0x3094440 :: ipc.py:114
2024-03-14 12:46:42,895 [DEBUG] pyprland :: event_activewindowv2('3094440',) :: command.py:149
2024-03-14 12:46:43,096 [DEBUG] scratchpads :: event_activewindowv2('3f39990',) :: command.py:149
2024-03-14 12:46:43,097 [DEBUG] scratchpads :: event_activewindowv2('3094440',) :: command.py:149
2024-03-14 12:46:43,534 [DEBUG] scratchpads :: run_toggle('kitty',) :: command.py:149
2024-03-14 12:46:43,535 [DEBUG] scratchpads :: kitty is visible = True :: scratchpads.py:738
2024-03-14 12:46:43,536 [INFO] scratchpads :: Hiding kitty :: scratchpads.py:916
2024-03-14 12:46:43,536 [DEBUG] ipc :: dispatch movetoworkspacesilent special:scratch_kitty,address:0x3094440 :: ipc.py:114
2024-03-14 12:46:43,539 [DEBUG] pyprland :: event_activewindowv2('3f39990',) :: command.py:149
2024-03-14 12:46:43,539 [DEBUG] scratchpads :: event_activewindowv2('3f39990',) :: command.py:149

hyprland debug log from last suspend/ resume cycle

[WARN] [12:46:32.802393980] Orphaned wlr_surface 39f1130 in setPreferredScaleForSurface
[WARN] [12:46:32.802419758] Orphaned wlr_surface 39f1130 in setPreferredTransformForSurface
[ERR] [12:46:32.802476138] BUG THIS: No CWLSurface for surface in damageSurface!!!
[WARN] [12:46:32.802505700] Orphaned wlr_surface 39f1130 in setPreferredScaleForSurface
[WARN] [12:46:32.802530738] Orphaned wlr_surface 39f1130 in setPreferredTransformForSurface
[LOG] [12:46:32.812908966] New Gamma event at 7ffef1d5cfc0
[LOG] [12:46:32.813516368] New Gamma event at 7ffef1d5cfc0
[LOG] [12:46:32.886605743] Registered signal for owner 39f3ee0: 39f3a28 -> 39f4318 (owner: layerSurface)
[LOG] [12:46:32.886709376] Registered signal for owner 39f3ee0: 39f3c08 -> 39f41e0 (owner: layerSurface)
[LOG] [12:46:32.886729666] Registered signal for owner 39f3ee0: 39f3a38 -> 39f4248 (owner: layerSurface)
[LOG] [12:46:32.886747187] Registered signal for owner 39f3ee0: 39f3a48 -> 39f42b0 (owner: layerSurface)
[LOG] [12:46:32.886767605] Registered signal for owner 39a2840: 39f3c18 -> 39a29c0 (owner: CPopup Head)
[LOG] [12:46:32.886785192] LayerSurface 39f3b40 (namespace waybar layer 1) created on monitor DP-4
[ERR] [12:46:32.886845316] BUG THIS: No CWLSurface for surface in damageSurface!!!
[WARN] [12:46:32.886874263] Orphaned wlr_surface 39f3750 in setPreferredScaleForSurface
[WARN] [12:46:32.886892997] Orphaned wlr_surface 39f3750 in setPreferredTransformForSurface
[LOG] [12:46:32.993911727] LayerSurface 39f3b40 mapped
[LOG] [12:46:32.993999913] Registered signal for owner 39f40c0: 39f3a68 -> 39f4108 (owner: CWLSurface)
[LOG] [12:46:32.994021433] Registered signal for owner 39f40c0: 39f3a28 -> 39f4170 (owner: CWLSurface)
[LOG] [12:46:32.994037233] CWLSurface 39f40c0 called init()
[LOG] [12:46:33.048167518] LayerSurface 39f1ac0 mapped
[LOG] [12:46:33.048296091] Registered signal for owner 39f1e50: 39f1448 -> 39f1e98 (owner: CWLSurface)
[LOG] [12:46:33.048319258] Registered signal for owner 39f1e50: 39f1408 -> 39f1f00 (owner: CWLSurface)
[LOG] [12:46:33.048333814] CWLSurface 39f1e50 called init()
[LOG] [12:46:33.459975208] OutputMgr Applied/Tested.
[LOG] [12:46:33.461359149] Applying monitor rule for eDP-1
[LOG] [12:46:33.461415670] Monitor eDP-1: Applying highest mode 2256x1504@59.999001.
[LOG] [12:46:33.461443086] output eDP-1 succeeded basic test on format DRM_FORMAT_XRGB8888
[LOG] [12:46:33.481635935] arrangeMonitors: 2 to arrange
[LOG] [12:46:33.481713111] arrangeMonitors: eDP-1 explicit [792.00, 2160.00]
[LOG] [12:46:33.481756931] arrangeMonitors: DP-4 explicit [0.00, 0.00]
[LOG] [12:46:33.481778739] arrangeMonitors: eDP-1 xwayland [0, 0.00]
[LOG] [12:46:33.481798830] arrangeMonitors: DP-4 xwayland [2256, 0.00]
[LOG] [12:46:33.481846746] Monitor eDP-1 data dump: res 2256x1504@60.00Hz, scale 1.00, transform 0, pos 792x2160, 10b 0
[LOG] [12:46:33.481912685] Applying monitor rule for DP-4
[LOG] [12:46:33.483952687] Monitor DP-4: Applying highest mode 3840x2160@59.939999.
[LOG] [12:46:33.484006604] output DP-4 succeeded basic test on format DRM_FORMAT_XRGB8888
[LOG] [12:46:33.494789435] arrangeMonitors: 2 to arrange
[LOG] [12:46:33.494853648] arrangeMonitors: eDP-1 explicit [792.00, 2160.00]
[LOG] [12:46:33.494891546] arrangeMonitors: DP-4 explicit [0.00, 0.00]
[LOG] [12:46:33.494913010] arrangeMonitors: eDP-1 xwayland [0, 0.00]
[LOG] [12:46:33.494932429] arrangeMonitors: DP-4 xwayland [2256, 0.00]
[LOG] [12:46:33.494959008] Monitor DP-4 data dump: res 3840x2160@59.94Hz, scale 1.00, transform 0, pos 0x0, 10b 0
[wlr] [backend/drm/drm.c:826] connector DP-4: Failed to page-flip output: a page-flip is already pending

In case the log output is not help, what is the best way to prepare debugging for next occurance?

When you say they can't be interacted with, you mean you can't focus them back ?
I suspect this is caused by Hyprland... I don't see any anomaly in the pyprland log...
What happens if you switch workspace and then return, is the window still visible ?

It would also be interesting to test commands "manually" to see if hyprland reacts, eg:
if you have something in the "ipc" log of pyprland such as:

dispatch movewindowpixel exact 499 151,address:0x3094440 

you can just type

hyprctl dispatch movewindowpixel exact 499 151,address:0x3094440 

such log:

[DEBUG] ipc :: dispatch ['moveworkspacetomonitor special:scratch_kitty DP-4', 'movetoworkspacesilent 4,address:0x3094440', 'alterzorder top,address:0x3094440'] :: ipc.py:114

means there are multiple commands issued, all starting with "dispatch".
By testing it manually you'll figure if it's a communication (pyprland?) issue or an hyprland issue...

Also double check the client address is correct even though I doubt this can be the problem.

Another issue I just realized is that the scratchpad that stays open also get pulled to the foreground when opening other scratchpads on the same monitor, irregardless of the workspace they are in.
If the focus is on a different monitor, opening any other scratchpad doesn't influence the stuck scratchpad.

When you say they can't be interacted with, you mean you can't focus them back ?

Happy to clarify: Since the stuck scratchpad is showing kitty, I can see by the ZSH cursor if the window is focused or not.
In the state where the scratchpad is mistakenly shown, the ZSH cursor is displayed the same as not having the keyboard cursor. I can see the window, but I can interact with it. Neither typing nor clicking events are forwarded to the window.
image
See the rectangular box as a cursor in this screenshot with ZSH not having a focus.

I hope that helps, happy to answer more questions or try to explain differently.

What happens if you switch workspace and then return, is the window still visible ?

Yes. My current workaround is to essentially park the scratchpad on an empty workspace by

  • Switching to an empty workspace
  • Open the scratchpad
  • Close the scratchpad
    Continue my work on other workspaces. Whenever I switch to the workspace I used for parking, the scratchpad is displayed there but can only be interacted with by opening it again.

Opening the scratchpad on any workspace other than the one I parked it on will move the window from the parked workspace to the current workspace.

Also double check the client address is correct even though I doubt this can be the problem.

Yes address is correct.

By testing it manually you'll figure if it's a communication (pyprland?) issue or an hyprland issue...

I looked through the pyprland debug log and the command

hyprctl dispatch movetoworkspacesilent special:scratch_kitty,address:$ID

makes the window loose focus without being removed from the workspace.

I assume this is pointing to a hyprland bug?

Hm... as you describe it, it looks like so... but I'm very surprised you see such issue and nobody else, must be something in your configuration...

If you open any window, check its address, then issue such command:
hyprctl dispatch movetoworkspacesilent special:XXX,address:$ADDRESS
will the window disappear or just lose focus ?

Scratchpads indeed rely on the fact that those special workspaces aren't visible, so they are used to "hide" clients.
Do you have a rule which makes all the special workspaces visible or something like this ?

must be something in your configuration

Maybe

If you open any window, check its address, then issue such command:
hyprctl dispatch movetoworkspacesilent special:XXX,address:$ADDRESS
will the window disappear or just lose focus ?

Yes that's exactly how I tested. It works as expected and than randomly breaks after a suspend/hibernate cycle until I restart (by logging out) my desktop apps.

Do you have a rule which makes all the special workspaces visible or something like this ?
No. From my understanding this would also make the behaviour consistent and not randomly triggered at some point in time.

So if you can reproduce the same issue without involving pyprland I guess the bug for Hyprland is the solution... may we close this issue ?

off topic @dantefromhell : I pushed some experimental (absolutely untested) change in the monitors plugin, dropping support for wlr-randr... now it requires Hyprland >= 0.37.
Feedback is very welcome, I'll test it later (at the moment I have a single screen available...)

Thank you for creating this suite of hyprland utility!

To OP: You're not alone! I have this exact issue.

Please see the following video:

output-2.mp4

Note:

  1. It happens when I switch between monitor setups, i.e., from laptop monitor to external monitor + laptop monitor
  2. Super+N is my keybinding to toggle the scratchpad; Basically, with this issue, Super+N is toggling between the "layers" instead of toggling the focus
  3. Running hyprctl reload didn't fix the issue
$ pypr version
2.0.8-18-g2aa3716

$ hyprctl version
Hyprland, built from branch HEAD at commit c5e28ebcfe00a510922779b2c568cfa52a317445  (props: bump ver 0.37.1).
Date: Sat Mar 16 14:51:49 2024
Tag: v0.37.1

flags: (if any)

Thank you!

  • Super+N is my keybinding to toggle the scratchpad; Basically, with this issue, Super+N is toggling between the "layers" instead of toggling the focus

Without any log or configuration it's not very useful... can you provide more information about it ? Is it easy to reproduce the problem on your side ?

Any update on this issue ?

@fdev31 Thank you for checking in on this issue. I appreciate it. This issue remains whenever I switch monitor setups but I have yet to write a bug report. I'll try to do so soon. Thank you again!

off topic @dantefromhell

Sorry @fdev31 haven't had the time to retest. Should we take this testing to another place to keep this issue on topic?

Is it worth re-testing the original issue with hyprland 0.38 and the pyprland 2.1.4?

Why not, also check any extra config you have (scripts or hyprland.conf). This is probably more "troubleshoot" than a bug, we may continue in discussions...
Should I close this ticket?

Until we have more clarity on a potential bug in pyprland I'm closing it.

I have experienced it and believe I added logs which will help identify the issue if that happens.
Please always log the output using --debug <filename> and report it in case you can reproduce the issue.

When you try to hide the scratchpad (using the toggle command), there will be some log line containing a "visibility_check" string:

[DEBUG] scratchpads :: visibility_check: ('1', 'DP-1') == ('1', 'DP-1') :: scratchpads.py:701

I expect the two parts of the check ('==') will be different when the bug happens...

PS: I couldn't figure what created the problem / how to reproduce it, so it may take a while before it happens again... @dantefromhell can you still reproduce the problem that easily ? Note that the alt_toggle option will run a different code and might not trigger the bug.

PS2: When I triggered the issue, I believe I was just saving the hyprland.conf file, can you recall some action that may have triggered it? I can't reproduce the issue by doing the same changes but it could be some very corner case, what do you think?

Did you experience the issue since > 2.2.5 (2.2.6 is out now and also fixes a couple of things but I don't think it is related)

I just updated to hyprland 0.39.0 and pyprland 2.2.7 and will report back if/ when I see the issue occuring again.

It might have been fixed with the latest versions... what is your experience ?

I have experienced it again, once again I was tweaking my hyprland.conf & monitor layout & setup... switching workspace and back recovered the problem.
After checking the code, I have quite high confidence this is due to unexpected active monitor or active workspace advertised by Hyprland's socket in such "transitioning" case.
I was unfortunately testing the alternative toggle, which didn't have logs for such scenario because I thought it wasn't impacted, now it's a bit more clear where the problem seats.

What is unclear are the conditions to trigger it and how to work around it.
Let's keep updating each other with hopefully more logs next time.

So far the issue hasn't happened to me. Not totally sure if related, but I'm using the alternative toggle now.

IIRC I've updated pyprland version + enabled alternative toggle the same day, so not sure what's the source of my improvement.

I was using the alternative toggle when this happened, and this mode didn't have the log which should help figuring the problem :'(
This has changed now, I may release a new version soon, the list of commits from last version starts to be a bit long.

fdev31 commented

I did a lot of nasty things with Hyprland & Pyprland and didn't had this issue for a while... if no activity I'll assume this has been fixed in one of those since the bug has been opened.

@fdev31 Thank you for following up with this bug! Really appreciate it:)
Good news is that I no have this issue (not sure about OP however); I can't reproduce it. Thank you again!

$ pypr version
2.3.4

โžœ hyprctl version
Hyprland, built from branch main at commit 2ff95bba3fec58b9f1a127fe72dda84b1420a7af  (flake.lock: update).
Date: Sat May 25 04:51:08 2024
Tag: v0.40.0-132-g2ff95bba, commits: 4738

flags: (if any)
fdev31 commented

Thank you all for the feedback ๐Ÿ’ฏ

So many things have changed in the meantime, including Hyprland, I also focused on the code simplification / clarity and it probably helped.

I'll close this ticket, keep reporting issues when you see them, thank you helping making Pyprland always better! I'm always excited to reach a "no open issues" state ;)

It's been almost 3 months. Thank YOU for following up! Have a nice day:)