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

Bug: Multiple chrome PWA apps in scratchpad #31

Closed
kuba-gaj opened this issue Nov 27, 2023 · 29 comments
Closed

Bug: Multiple chrome PWA apps in scratchpad #31

kuba-gaj opened this issue Nov 27, 2023 · 29 comments
Labels
enhancement New feature or request

Comments

@kuba-gaj
Copy link

Some applications don't provide native linux experience and are installed as PWAs (e.g. google meet, yt music, amplenote).

The problem is that currently only 1st PWA application works in a scratchpad, and others give an error:
/Failed to show scratch. The command terminated successfully, is it already running.

I believe this is because chrome reuses the same process id when running multiple applications.
In sway I was just launching the apps and then matched them by app_id that is specific for each application, but it doesn't seem to work here.

Here is a snippet from my config:

[scratchpads.amplenote]
animation = "fromBottom"
command = "/opt/google/chrome-beta/google-chrome-beta --profile-directory=Default --app-id=pfphgelppkenhllngngioolkaeelhlmi"
class = "chrome-pfphgelppkenhllngngioolkaeelhlmi-Default"
class_match = true
size = "50% 80%"
lazy = true

[scratchpads.ytmusic]
animation = "fromBottom"
command = "/opt/google/chrome-beta/google-chrome-beta --profile-directory=Default --app-id=cinhimbnkkaeohfgghhklpknlkffjgod"
class = "chrome-cinhimbnkkaeohfgghhklpknlkffjgod-Default"
class_match = true
size = "50% 80%"
lazy = true
unfocus = "hide"

Thank you for your help and this amazing project!

@fdev31
Copy link
Collaborator

fdev31 commented Nov 27, 2023

This is not a pypr bug but a google chrome issue, also it looks like you are not using the right arguments... Check https://bugs.chromium.org/p/chromium/issues/detail?id=118613

I got "class" working on google chrome using the following: --class=foobar --user-data-dir=/tmp/.

There could be more complications to it but it looks like setting user-data + class will allow configuring each app separately.

Thank you for being a user! :)

PS: You can verify your google chrome options checking the properties if the app in hyprctl -j clients

@fdev31 fdev31 closed this as completed Nov 27, 2023
@kuba-gaj
Copy link
Author

kuba-gaj commented Nov 27, 2023

Thank you for a quick response!

I got the command from .desktop file generated by chrom when I installed the PWA app in the browser and confirmed that calss is correct with hyprctl clients. The correct app is being picked up, the problem is that only one of them can be started.

I tried using --class and --user-data-dir as you recommended but it doesn't work, maybe appid overrides it?

I changed the command to this one:
/opt/google/chrome-beta/google-chrome-beta --class=amplenote_scratch --profile-directory=Default --user-data-dir="/home/kuba/.config/google-chrome-beta" --app-id=pfphgelppkenhllngngioolkaeelhlmi

Here is output from hyprctl clients for a window started with the command above:

Window 5608e6eafc30 -> Amplenote - Notes - Amplenote:
	mapped: 1
	hidden: 0
	at: 3975,742
	size: 1123,676
	workspace: 2 (2)
	floating: 0
	monitor: 1
	class: chrome-pfphgelppkenhllngngioolkaeelhlmi-Default
	title: Amplenote - Notes - Amplenote
	initialClass: chrome-pfphgelppkenhllngngioolkaeelhlmi-Default
	initialTitle: Amplenote
	pid: 4773
	xwayland: 0
	pinned: 0
	fullscreen: 0
	fullscreenmode: 0
	fakefullscreen: 0
	grouped: 0
	swallowing: 0
	focusHistoryID: 5

I can start every PWA app from the terminal without problems, all of them with unique class. It's just scratchpad having problems launching more than one. First one launches and works in scratchpad without problems, but next ones throw error in my original message.

@fdev31
Copy link
Collaborator

fdev31 commented Nov 27, 2023

While hyprctl clients show correct info.... ! Can you please check the output of "px axuw" and find the lines matching the PID of the chrome clients windows ? Is the PID of every client the same ? Since the option you are using isn't working for me I assumed that was the problem, but maybe that is indeed something in Pyprland... For me it's not clear what is going wrong yet.

If you do similar setup with another "real" app (not a webapp) I guess there is no problem ?

@fdev31 fdev31 reopened this Nov 27, 2023
@kuba-gaj
Copy link
Author

Yes, real apps (like different kityy) or even electron apps work fine. It's only PWA apps that have this problem.
I ran ps and couldn't grep for running application neither by app-id (rg app-id only shows the first one), but found the process ids from process manager inside chrome and used the processId from that to grep ps.

These are the 2 PWA apps with pid 53923 and 16104. Interesting that it's different command than what is in exec. Also, when I kill that process from chrome process manager it doesn't kill the window, just replaces content with Oh Snap

kuba       53923  1.7  0.3 1186601168 219768 tty1 S<l+ 18:28   0:05 /opt/google/chrome-beta/chrome --type=renderer --crashpad-handler-pid=4780 --enable-crash-reporter=,beta --disable-nacl --origin-trial-disabled-features=WebGPU --change-stack-guard-on-fork=enable --ozone-platform=wayland --lang=en-GB --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=51 --time-ticks-at-unix-epoch=-1701101548064289 --launch-time-ticks=8144261986 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=0,i,5770316724824534407,5993653096521772292,262144 --variations-seed-version=20231121-140654.348000

kuba       16104  0.0  0.3 1186605740 210640 tty1 Sl+ 17:00   0:02 /opt/google/chrome-beta/chrome --type=renderer --crashpad-handler-pid=4780 --enable-crash-reporter=,beta --disable-nacl --origin-trial-disabled-features=WebGPU --change-stack-guard-on-fork=enable --ozone-platform=wayland --lang=en-GB --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=43 --time-ticks-at-unix-epoch=-1701101548064289 --launch-time-ticks=2868099295 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=0,i,5770316724824534407,5993653096521772292,262144 --variations-seed-version=20231121-140654.348000

@fdev31
Copy link
Collaborator

fdev31 commented Nov 27, 2023

Can you also provide the pypr debug logs when you try to show a scratchpad ?

If you don't want to send everything, when you toggle the scratch the first time, you should see something such as:

scratchpads - ==> Wait for test spawning // scratchpads.py:412
[...]
scratchpads - => test client (proc:22608, addr:0x5567f784c580) received on time // scratchpads.py:420

That's the part which I'm the most interested in, but please include a good amount of the events / lines received before & after that

@kuba-gaj
Copy link
Author

kuba-gaj commented Nov 27, 2023

Of course, attached is a full log from system start, you can see I first started first app successfully (ytmusic) and then second one failed (amplenote)

pypr_launch_log.txt
                      ipc - Logger initialized for ipc // common.py:70�[0m
                  startup - Logger initialized for startup // common.py:70�[0m
                     pypr - Logger initialized for pypr // common.py:70�[0m
                     pypr - Loading /home/kuba/.config/hypr/pyprland.toml // command.py:52�[0m
              scratchpads - Logger initialized for scratchpads // common.py:70�[0m
              scratchpads - top is not running, restarting... // scratchpads.py:405�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['windowrule workspace special:scratch_top silent,^(kitty_btm)$', 'windowrule float,^(kitty_btm)$', 'windowrule move 677 200%,^(kitty_btm)$', 'windowrule size 902 962,^(kitty_btm)$'] // ipc.py:64�[0m
              scratchpads - starting top // scratchpads.py:410�[0m
              scratchpads - scratch top has pid 2431 // scratchpads.py:463�[0m
              scratchpads - ==> Wait for top spawning // scratchpads.py:412�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
              scratchpads - => top client (proc:2431, addr:0x55b1fce25620) received on time // scratchpads.py:420�[0m
              scratchpads - wavebox is not running, restarting... // scratchpads.py:405�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['windowrule workspace special:scratch_wavebox silent,^(wavebox)$', 'windowrule float,^(wavebox)$', 'windowrule move 1280 200%,^(wavebox)$', 'windowrule size 2560 1152,^(wavebox)$'] // ipc.py:64�[0m
              scratchpads - starting wavebox // scratchpads.py:410�[0m
              scratchpads - scratch wavebox has pid 2713 // scratchpads.py:463�[0m
              scratchpads - ==> Wait for wavebox spawning // scratchpads.py:412�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
              scratchpads - => wavebox client (proc:2713, addr:0x55b1fd367a50) received on time // scratchpads.py:420�[0m
              scratchpads - term is not running, restarting... // scratchpads.py:405�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['windowrule workspace special:scratch_term silent,^(kitty-dropterm)$', 'windowrule float,^(kitty-dropterm)$', 'windowrule move 640 -200%,^(kitty-dropterm)$', 'windowrule size 3840 864,^(kitty-dropterm)$'] // ipc.py:64�[0m
              scratchpads - starting term // scratchpads.py:410�[0m
              scratchpads - scratch term has pid 3355 // scratchpads.py:463�[0m
              scratchpads - ==> Wait for term spawning // scratchpads.py:412�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
              scratchpads - => term client (proc:3355, addr:0x55b1fd356090) received on time // scratchpads.py:420�[0m
           shift_monitors - Logger initialized for shift_monitors // common.py:70�[0m
                      ipc - monitors // ipc.py:36�[0m
                     pypr - ================================[ initialized ]================================= // command.py:264�[0m
                     pypr - scratchpads.event_openwindow('55b1fce25620,special:scratch_top silent,kitty_btm,btm\n',) // command.py:118�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - movetoworkspacesilent special:scratch_top,address:0x55b1fce25620 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fe19ae50\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('55b1fe19ae50,2,firefox,Mozilla Firefox\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('55b1fd367a50,special:scratch_wavebox silent,wavebox,Untitled - Wavebox\n',) // command.py:118�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - movetoworkspacesilent special:scratch_wavebox,address:0x55b1fd367a50 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd36e7b0\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('55b1fd36e7b0,2,firefox,Mozilla Firefox\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd053480\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('55b1fd053480,2,firefox,Mozilla Firefox\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd054a30\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('55b1fd054a30,2,firefox,Mozilla Firefox\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd363310\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('55b1fd363310,2,firefox,Mozilla Firefox\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('55b1fd356090,special:scratch_term silent,kitty-dropterm,zsh\n',) // command.py:118�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - movetoworkspacesilent special:scratch_term,address:0x55b1fd356090 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd053480\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fe19ae50\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd053480\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fe19ae50\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd363310\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fe19ae50\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd31af40\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('55b1fd31af40,2,kitty,zsh\n',) // command.py:118�[0m
                     pypr - scratchpads.run_toggle('ytmusic',) // command.py:118�[0m
              scratchpads - ytmusic is visible = False // scratchpads.py:562�[0m
                      ipc - activewindow // ipc.py:36�[0m
              scratchpads - Showing ytmusic // scratchpads.py:605�[0m
              scratchpads - ytmusic is not running, restarting... // scratchpads.py:405�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['windowrule workspace special:scratch_ytmusic silent,^(chrome-cinhimbnkkaeohfgghhklpknlkffjgod-Default)$', 'windowrule float,^(chrome-cinhimbnkkaeohfgghhklpknlkffjgod-Default)$', 'windowrule move 1280 200%,^(chrome-cinhimbnkkaeohfgghhklpknlkffjgod-Default)$', 'windowrule size 2560 1152,^(chrome-cinhimbnkkaeohfgghhklpknlkffjgod-Default)$'] // ipc.py:64�[0m
              scratchpads - starting ytmusic // scratchpads.py:410�[0m
              scratchpads - scratch ytmusic has pid 6749 // scratchpads.py:463�[0m
              scratchpads - ==> Wait for ytmusic spawning // scratchpads.py:412�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
              scratchpads - => ytmusic client (proc:6749, addr:0x55b1fd32a260) received on time // scratchpads.py:420�[0m
              scratchpads - hidding wavebox // scratchpads.py:616�[0m
�[33;20m              scratchpads - wavebox is already hidden // scratchpads.py:677�[0m
              scratchpads - hidding obsidian // scratchpads.py:616�[0m
�[33;20m              scratchpads - obsidian is already hidden // scratchpads.py:677�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - movetoworkspacesilent special:scratch_ytmusic,address:0x55b1fd32a260 // ipc.py:64�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['moveworkspacetomonitor special:scratch_ytmusic DP-3', 'movetoworkspacesilent 2,address:0x55b1fd32a260'] // ipc.py:64�[0m
                      ipc - resizewindowpixel exact 2560 1152,address:0x55b1fd32a260 // ipc.py:64�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - movewindowpixel exact 1280 228,address:0x55b1fd32a260 // ipc.py:64�[0m
                      ipc - focuswindow address:0x55b1fd32a260 // ipc.py:64�[0m
                     pypr - scratchpads.event_openwindow('55b1fd32a260,special:scratch_ytmusic silent,chrome-cinhimbnkkaeohfgghhklpknlkffjgod-Default,YouTube Music\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fe19ae50\n',) // command.py:118�[0m
              scratchpads - (SKIPPED) hide ytmusic because another client is active // scratchpads.py:500�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd32a260\n',) // command.py:118�[0m
                     pypr - scratchpads.run_toggle('ytmusic',) // command.py:118�[0m
              scratchpads - ytmusic is visible = True // scratchpads.py:562�[0m
              scratchpads - Hiding ytmusic // scratchpads.py:680�[0m
                      ipc - movewindowpixel 0 1497,address:0x55b1fd32a260 // ipc.py:64�[0m
                      ipc - movetoworkspacesilent special:scratch_ytmusic,address:0x55b1fd32a260 // ipc.py:64�[0m
                      ipc - focuswindow address:0x55b1fd31af40 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fe19ae50\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd31af40\n',) // command.py:118�[0m
                     pypr - scratchpads.run_toggle('amplenote',) // command.py:118�[0m
�[33;20m                     pypr - scratchpads::run_toggle(('amplenote',)) failed: // command.py:130�[0m
�[31;20m                     pypr - 'NoneType' object has no attribute 'visible' // command.py:131�[0m
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/pyprland/command.py", line 120, in _run_plugin_handler
    await getattr(plugin, full_name)(*params)
  File "/usr/lib/python3.11/site-packages/pyprland/plugins/scratchpads.py", line 553, in run_toggle
    is_visible = self.scratches.get(uids[0]).visible
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'visible'
                      ipc - 0 5000 rgb(ff1010)  Pypr error scratchpads::run_toggle: 'NoneType' object has no attribute 'visible' // ipc.py:64�[0m
                     pypr - scratchpads.run_toggle('term',) // command.py:118�[0m
              scratchpads - term is visible = False // scratchpads.py:562�[0m
                      ipc - activewindow // ipc.py:36�[0m
              scratchpads - Showing term // scratchpads.py:605�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['moveworkspacetomonitor special:scratch_term DP-3', 'movetoworkspacesilent 2,address:0x55b1fd356090'] // ipc.py:64�[0m
                      ipc - resizewindowpixel exact 3840 864,address:0x55b1fd356090 // ipc.py:64�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - movewindowpixel exact 640 60,address:0x55b1fd356090 // ipc.py:64�[0m
                      ipc - focuswindow address:0x55b1fd356090 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd356090\n',) // command.py:118�[0m
                     pypr - scratchpads.run_toggle('term',) // command.py:118�[0m
              scratchpads - term is visible = True // scratchpads.py:562�[0m
              scratchpads - Hiding term // scratchpads.py:680�[0m
                      ipc - movewindowpixel 0 -1123,address:0x55b1fd356090 // ipc.py:64�[0m
                      ipc - movetoworkspacesilent special:scratch_term,address:0x55b1fd356090 // ipc.py:64�[0m
                      ipc - focuswindow address:0x55b1fd31af40 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fe19ae50\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd31af40\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fe19ae50\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd31af40\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fe19ae50\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd31af40\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fe19ae50\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd4ded90\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('55b1fd4ded90,2,firefox,File Upload\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fe19ae50\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd4ded90\n',) // command.py:118�[0m
                     pypr - scratchpads.run_toggle('term',) // command.py:118�[0m
              scratchpads - term is visible = False // scratchpads.py:562�[0m
                      ipc - activewindow // ipc.py:36�[0m
              scratchpads - Showing term // scratchpads.py:605�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['moveworkspacetomonitor special:scratch_term DP-3', 'movetoworkspacesilent 2,address:0x55b1fd356090'] // ipc.py:64�[0m
                      ipc - resizewindowpixel exact 3840 864,address:0x55b1fd356090 // ipc.py:64�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - movewindowpixel exact 640 60,address:0x55b1fd356090 // ipc.py:64�[0m
                      ipc - focuswindow address:0x55b1fd356090 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd356090\n',) // command.py:118�[0m
                     pypr - scratchpads.run_toggle('term',) // command.py:118�[0m
              scratchpads - term is visible = True // scratchpads.py:562�[0m
              scratchpads - Hiding term // scratchpads.py:680�[0m
                      ipc - movewindowpixel 0 -1123,address:0x55b1fd356090 // ipc.py:64�[0m
                      ipc - movetoworkspacesilent special:scratch_term,address:0x55b1fd356090 // ipc.py:64�[0m
                      ipc - focuswindow address:0x55b1fd4ded90 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd4ded90\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fe19ae50\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd31af40\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fe19ae50\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd4ded90\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fe19ae50\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd4ded90\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fe19ae50\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd31af40\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fe19ae50\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd31af40\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fe19ae50\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd4de710\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('55b1fd4de710,2,firefox,File Upload\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fe19ae50\n',) // command.py:118�[0m
                     pypr - scratchpads.event_active
[pypr_launch_log.txt](https://github.com/hyprland-community/pyprland/files/13481141/pypr_launch_log.txt)
windowv2('55b1fd053480\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fe19ae50\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd4de710\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fe19ae50\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd4de710\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fe19ae50\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fd31af40\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55b1fe19ae50\n',) // command.py:118�[0m
 

@fdev31
Copy link
Collaborator

fdev31 commented Nov 28, 2023

This is strange, this error should happen if you didn't define "amplenote" in the config...
This is a fresh start ? It's not what I expected ^^
If this setup is easy / quick to get, the simplest would be to tell me what to install to reproduce the issue...
Anyway, I'll look at it again after work, maybe I'll have some ideas.

@kuba-gaj
Copy link
Author

yes, this log is from fresh boot.

It should be easy to reproduce, just go and install a couple of PWA apps, for example youtube music and google meet.
To install the app go to the app page:

And click Install icons that should appear in the address bar:

image

This should add an entry to your launcher (in my case it created a .desktop file in ~/.local/share/applications dir). From that desktop file I got the exec command how to run application.

@fdev31
Copy link
Collaborator

fdev31 commented Nov 28, 2023

Ok it is now clear, every window uses the same PID (visible if you run more than one app and dump hyprctl clients -j).
I never considered this as a valid case, I'll try to see which part of the code blocks it and if it can be supported.

@fdev31
Copy link
Collaborator

fdev31 commented Nov 28, 2023

Ok, it looks like a real mess, the scratchpad is able to relaunch an app if it has been closed for instance, hence there is process tracking required at several levels.

I can try to make something to ignore that, as a workaround for such app, but it will break some of the existing features.

On top of that, it also means I have no way to know that an app as started or not.

EDIT: It's terrible code with some duplication, but I made it work in a degraded way (no process tracking - which makes it crap since it doesn't relaunch the app if it was closed)

I guess there are more improvements, trying to track the window via the class name instead.

I need to see the final code before deciding if it should be merged or not. If I push some experimental branch are you able to test it ?

@kuba-gaj
Copy link
Author

Hi, same as in other ticket - I'm very happy to test, I'm a dev so I know my way around git but I don't know python ecosystem at all so not sure what to do after checking out the branch. I'm on arch and have python installed.

Thank you for that work, i don't like PWAs but unfortunately it's the only available option for some apps for me.
I'm ok with no tracking, on sway i actually mapped keybinds to relaunch these sratchpads if I closed them (e.g $mod+m - yt music scratchpad toggle, $mod+Shift+m launch new yt music)

@fdev31
Copy link
Collaborator

fdev31 commented Nov 28, 2023

Great :)
In the end I found a decent way to restart such apps.

It's still degraded functionality and only lazy can be supported, which I force automatically so it's not needed.

Here are my test configs:

[scratchpads.zic]
command = "/opt/brave-bin/brave --profile-directory=Default --app-id=cinhimbnkkaeohfgghhklpknlkffjgod"
class = "brave-cinhimbnkkaeohfgghhklpknlkffjgod-Default"
class_match = true
size = "50% 50%"
pwa_hack = true

[scratchpads.meets]
command = "/opt/brave-bin/brave --profile-directory=Default --app-id=kjgfgldnnfoeklkmfkjfagphfepbbdan"
class = "brave-kjgfgldnnfoeklkmfkjfagphfepbbdan-Default"
class_match = true
size = "50% 50%"
pwa_hack = true

I'll push on git a commit with this experimental change.
I believe PWA will probably be something not fully supported, it has too many constraints...

Just let me know how that change works for you, and also comment the naming ("hack" isn't really nice even though it shows it will be degraded ? I was thinking in "is_pwa" or "unreliable_pid" or something like this...)

EDIT: It seems to sometimes start an app twice, but even with all the logging I can't figure how it's possible...

EDIT2: pushed the code

fdev31 added a commit that referenced this issue Nov 28, 2023
@fdev31
Copy link
Collaborator

fdev31 commented Nov 28, 2023

I don't like to add complexity for such "broken" apps... but if it's becoming popular it's probably good to have some support.

On my side, I have the same kind of contraints, but I'm not installing the apps, I just have one browser window with every web app I need, without having separate windows for each, but it's a bit messy sometimes.

@kuba-gaj
Copy link
Author

Thank you for that!
lazy is fine to start them.
I agree pwa_hack is not the best name. I like is_pwa but it may also be the case for some non-pwa apps (even though i don't know any), so maybe something like shared_pid?

I also use something similar to you - one of the apps I have in scratchpad is wavebox which is based on chrome where I have all messengers in web version (slack, discord, whatsapp, telegram, fb messenger, 3xgmail, twitter + calendar).
But for some of the apps I need to go straight to them, or I need to be able to have them opened together with that shared browser window, for example, slack and my note app.

@fdev31
Copy link
Collaborator

fdev31 commented Nov 28, 2023

I like shared_pid too... and thought about shared_app , host_process , progressive or just 'pwa' but I get your point... not sure if it's a correct consideration either ^^

I used to have "box" apps for every messenger thing, but it always added some complications & problems compared to a webbrowser... I also had a dedicated "home" directory with separate everything for those chat apps only, but in the end it feels more natural & convenient to share everything even though it's a bit more messy.

Keep me informed about how the latest git commit works for you!

@fdev31
Copy link
Collaborator

fdev31 commented Nov 28, 2023

Oh, so the best option is probably to make a "-git" package... it will also be useful for more users... I just pushed one, feel free to test it yourself:

If you have some package manager which supports AUR, just search pyprland-git, eg:

yay pyprland-git

If you don't have such, you can do it the hard way:

mkdir pyprland-git
cd pyprland-git
cat > PKGBUILD <<EOF
# Maintainer: Fabien Devaux <fdev31@gmail.com>
# Contributor: Fabien Devaux <fdev31@gmail.com>
pkgname=pyprland-git
pkgver=r255.bfedf14
pkgrel=1
pkgdesc="Easy scratchpads, smart monitor placement and more hyprland tweaks (GIT version)"
arch=(any)
url="https://github.com/fdev31/pyprland"
license=('MIT')
groups=()
depends=('python')
makedepends=('git' 'python-build' 'python-installer' 'python-poetry')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
replaces=()
backup=()
options=()
install=
source=(git+"https://github.com/fdev31/pyprland#branch=main")
noextract=()
md5sums=('SKIP')

pkgver() {
	cd "$srcdir/${pkgname%-git}"
	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
	cd "$srcdir/${pkgname%-git}"
    python -m build --wheel --no-isolation
}

package() {
	cd "$srcdir/${pkgname%-git}"
	python -m installer --destdir="$pkgdir" dist/*.whl
}
EOF

makepkg -sfc
sudo pacman -U *.pkg.*

@kuba-gaj
Copy link
Author

Ah thank you, I started playing and got the commands to build it locally from your pyprland aur package but the -git package is appreciated. I will test it soon

@kuba-gaj
Copy link
Author

So it looks like pypr-git does not work for me. It actually stopped starting even the first PWA app.

pyprland.toml
[scratchpads.ytmusic]
animation = "fromBottom"
command = "/opt/google/chrome-beta/google-chrome-beta --profile-directory=Default --app-id=cinhimbnkkaeohfgghhklpknlkffjgod"
class = "chrome-cinhimbnkkaeohfgghhklpknlkffjgod-Default"
class_match = true
size = "90% 80%"
max_size = "1920px 80%"
# lazy = true
pwa_hack = true
unfocus = "hide"
excludes = ["wavebox", "obsidian"]

[scratchpads.amplenote]
animation = "fromBottom"
command = "/opt/google/chrome-beta/google-chrome-beta --profile-directory=Default --app-id=pfphgelppkenhllngngioolkaeelhlmi"
class = "chrome-pfphgelppkenhllngngioolkaeelhlmi-Default"
class_match = true
size = "50% 80%"
max_size = "1920px 80%"
# lazy = true
pwa_hack = true

[scratchpads.gmeet]
command = "/opt/google/chrome-beta/google-chrome-beta \"--profile-directory=Profile 1\" --app-id=kjgfgldnnfoeklkmfkjfagphfepbbdan"
animation = "fromRight"
class = "chrome-kjgfgldnnfoeklkmfkjfagphfepbbdan-Profile_1"
class_match = true
size = "50% 80%"
max_size = "1920px 80%"
# lazy = true
pwa_hack = true
unfocus = "hide"
pypr.log
                      ipc - Logger initialized for ipc // common.py:92�[0m
                  startup - Logger initialized for startup // common.py:92�[0m
                     pypr - Logger initialized for pypr // common.py:92�[0m
                     pypr - Loading /home/kuba/.config/hypr/pyprland.toml // command.py:52�[0m
              scratchpads - Logger initialized for scratchpads // common.py:92�[0m
                      ipc - activeworkspace // ipc.py:36�[0m
                      ipc - monitors // ipc.py:36�[0m
              scratchpads - top is not running, restarting... // scratchpads.py:473�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['windowrule workspace special:scratch_top silent,^(kitty_btm)$', 'windowrule float,^(kitty_btm)$', 'windowrule move 316 200%,^(kitty_btm)$', 'windowrule size 1624 962,^(kitty_btm)$'] // ipc.py:64�[0m
              scratchpads - starting top // scratchpads.py:478�[0m
              scratchpads - scratch top has pid 1957 // scratchpads.py:544�[0m
              scratchpads - ==> Wait for top spawning // scratchpads.py:480�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
              scratchpads - => top client (proc:1957, addr:0x55f197cd3520) received on time // scratchpads.py:491�[0m
              scratchpads - term is not running, restarting... // scratchpads.py:473�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['windowrule workspace special:scratch_term silent,^(kitty-dropterm)$', 'windowrule float,^(kitty-dropterm)$', 'windowrule move 256 -200%,^(kitty-dropterm)$', 'windowrule size 4608 1152,^(kitty-dropterm)$'] // ipc.py:64�[0m
              scratchpads - starting term // scratchpads.py:478�[0m
              scratchpads - scratch term has pid 2246 // scratchpads.py:544�[0m
              scratchpads - ==> Wait for term spawning // scratchpads.py:480�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
              scratchpads - => term client (proc:2246, addr:0x55f197cd6be0) received on time // scratchpads.py:491�[0m
              scratchpads - wavebox is not running, restarting... // scratchpads.py:473�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['windowrule workspace special:scratch_wavebox silent,^(wavebox)$', 'windowrule float,^(wavebox)$', 'windowrule move 256 200%,^(wavebox)$', 'windowrule size 4608 1152,^(wavebox)$'] // ipc.py:64�[0m
              scratchpads - starting wavebox // scratchpads.py:478�[0m
              scratchpads - scratch wavebox has pid 2642 // scratchpads.py:544�[0m
              scratchpads - ==> Wait for wavebox spawning // scratchpads.py:480�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
              scratchpads - => wavebox client (proc:2642, addr:0x55f196f23cb0) received on time // scratchpads.py:491�[0m
           shift_monitors - Logger initialized for shift_monitors // common.py:92�[0m
                      ipc - monitors // ipc.py:36�[0m
                     pypr - ================================[ initialized ]================================= // command.py:264�[0m
                     pypr - scratchpads.event_openwindow('55f197cd3520,special:scratch_top silent,kitty_btm,btm\n',) // command.py:118�[0m
                      ipc - movetoworkspacesilent special:scratch_top,address:0x55f197cd3520 // ipc.py:64�[0m
                     pypr - scratchpads.event_focusedmon('DP-3,2\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('55f197cd6be0,special:scratch_term silent,kitty-dropterm,zsh\n',) // command.py:118�[0m
                      ipc - movetoworkspacesilent special:scratch_term,address:0x55f197cd6be0 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('55f197cf3590\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('55f197cf3590,2,firefox,Mozilla Firefox\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55f196eff6c0\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('55f196eff6c0,2,firefox,Mozilla Firefox\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55f19692fc10\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('55f19692fc10,2,firefox,Mozilla Firefox\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55f196ef4210\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('55f196ef4210,2,firefox,Mozilla Firefox\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55f196f216f0\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('55f196f216f0,2,firefox,Mozilla Firefox\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('55f196f23cb0,special:scratch_wavebox silent,wavebox,Untitled - Wavebox\n',) // command.py:118�[0m
                      ipc - movetoworkspacesilent special:scratch_wavebox,address:0x55f196f23cb0 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('55f196eff6c0\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55f196ef4210\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55f196f216f0\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('55f196ecd130\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('55f196ecd130,2,kitty,zsh\n',) // command.py:118�[0m
                     pypr - scratchpads.run_toggle('ytmusic',) // command.py:118�[0m
              scratchpads - ytmusic is visible = False // scratchpads.py:655�[0m
                      ipc - activewindow // ipc.py:36�[0m
              scratchpads - Showing ytmusic // scratchpads.py:698�[0m
/usr/lib/python3.11/site-packages/pyprland/plugins/scratchpads.py:699: RuntimeWarning: coroutine 'Extension._ensure_alive_pwa' was never awaited
  if not await self.ensure_alive(uid):
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
              scratchpads - hidding wavebox // scratchpads.py:709�[0m
�[33;20m              scratchpads - wavebox is already hidden // scratchpads.py:777�[0m
              scratchpads - hidding obsidian // scratchpads.py:709�[0m
�[33;20m              scratchpads - obsidian is already hidden // scratchpads.py:777�[0m
�[31;20m                     pypr - Bug detected, please report on https://github.com/fdev31/pyprland/issues // command.py:122�[0m
�[31;20m                     pypr -  // command.py:125�[0m
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/pyprland/command.py", line 120, in _run_plugin_handler
    await getattr(plugin, full_name)(*params)
  File "/usr/lib/python3.11/site-packages/pyprland/plugins/scratchpads.py", line 660, in run_toggle
    await asyncio.gather(*(asyncio.create_task(t()) for t in tasks))
  File "/usr/lib/python3.11/site-packages/pyprland/plugins/scratchpads.py", line 711, in run_show
    await item.updateClientInfo()
  File "/usr/lib/python3.11/site-packages/pyprland/plugins/scratchpads.py", line 221, in updateClientInfo
    client_info = await get_client_props(addr=self.full_address)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pyprland/plugins/scratchpads.py", line 70, in get_client_props
    assert addr or pid or cls
AssertionError
                      ipc - 0 5000 rgb(ff1010)  Pypr integrity check failed on scratchpads::run_toggle:  // ipc.py:64�[0m
                     pypr - scratchpads.run_toggle('gmeet',) // command.py:118�[0m
              scratchpads - gmeet is visible = False // scratchpads.py:655�[0m
                      ipc - activewindow // ipc.py:36�[0m
              scratchpads - Showing gmeet // scratchpads.py:698�[0m
�[31;20m                     pypr - Bug detected, please report on https://github.com/fdev31/pyprland/issues // command.py:122�[0m
�[31;20m                     pypr -  // command.py:125�[0m
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/pyprland/command.py", line 120, in _run_plugin_handler
    await getattr(plugin, full_name)(*params)
  File "/usr/lib/python3.11/site-packages/pyprland/plugins/scratchpads.py", line 660, in run_toggle
    await asyncio.gather(*(asyncio.create_task(t()) for t in tasks))
  File "/usr/lib/python3.11/site-packages/pyprland/plugins/scratchpads.py", line 711, in run_show
    await item.updateClientInfo()
  File "/usr/lib/python3.11/site-packages/pyprland/plugins/scratchpads.py", line 221, in updateClientInfo
    client_info = await get_client_props(addr=self.full_address)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pyprland/plugins/scratchpads.py", line 70, in get_client_props
    assert addr or pid or cls
AssertionError
                      ipc - 0 5000 rgb(ff1010)  Pypr integrity check failed on scratchpads::run_toggle:  // ipc.py:64�[0m

@kuba-gaj
Copy link
Author

I did some more testing today, after uncommenting lazy for all the apps.

  1. The first one starts correctly and looks like the toggle is working
  2. For others they start, but they do it every time I toggle scratchpad - what I mean the previous scratchpad stays open and new instance is started.

In this log i started ytmusic first and toggled it few times, followed by starting amplenote (ok) and toggling it few times, each time it started new amplenote window.
I confirmed with hyprctl clients that there is one window with ytmusic and multiple with amplenote

pypr.log
                      ipc - Logger initialized for ipc // common.py:92�[0m
                  startup - Logger initialized for startup // common.py:92�[0m
                     pypr - Logger initialized for pypr // common.py:92�[0m
                     pypr - Loading /home/kuba/.config/hypr/pyprland.toml // command.py:52�[0m
              scratchpads - Logger initialized for scratchpads // common.py:92�[0m
                      ipc - activeworkspace // ipc.py:36�[0m
                      ipc - monitors // ipc.py:36�[0m
              scratchpads - term is not running, restarting... // scratchpads.py:473�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['windowrule workspace special:scratch_term silent,^(kitty-dropterm)$', 'windowrule float,^(kitty-dropterm)$', 'windowrule move 316 -200%,^(kitty-dropterm)$', 'windowrule size 1624 962,^(kitty-dropterm)$'] // ipc.py:64�[0m
              scratchpads - starting term // scratchpads.py:478�[0m
              scratchpads - scratch term has pid 2203 // scratchpads.py:544�[0m
              scratchpads - ==> Wait for term spawning // scratchpads.py:480�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
              scratchpads - => term client (proc:2203, addr:0x5608154281a0) received on time // scratchpads.py:491�[0m
              scratchpads - wavebox is not running, restarting... // scratchpads.py:473�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['windowrule workspace special:scratch_wavebox silent,^(wavebox)$', 'windowrule float,^(wavebox)$', 'windowrule move 256 200%,^(wavebox)$', 'windowrule size 4608 1152,^(wavebox)$'] // ipc.py:64�[0m
              scratchpads - starting wavebox // scratchpads.py:478�[0m
              scratchpads - scratch wavebox has pid 2738 // scratchpads.py:544�[0m
              scratchpads - ==> Wait for wavebox spawning // scratchpads.py:480�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
              scratchpads - => wavebox client (proc:2738, addr:0x5608146d4210) received on time // scratchpads.py:491�[0m
              scratchpads - top is not running, restarting... // scratchpads.py:473�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['windowrule workspace special:scratch_top silent,^(kitty_btm)$', 'windowrule float,^(kitty_btm)$', 'windowrule move 256 200%,^(kitty_btm)$', 'windowrule size 4608 1152,^(kitty_btm)$'] // ipc.py:64�[0m
              scratchpads - starting top // scratchpads.py:478�[0m
              scratchpads - scratch top has pid 4287 // scratchpads.py:544�[0m
              scratchpads - ==> Wait for top spawning // scratchpads.py:480�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
              scratchpads - => top client (proc:4287, addr:0x560814710a10) received on time // scratchpads.py:491�[0m
           shift_monitors - Logger initialized for shift_monitors // common.py:92�[0m
                      ipc - monitors // ipc.py:36�[0m
                     pypr - ================================[ initialized ]================================= // command.py:264�[0m
                     pypr - scratchpads.event_openwindow('5608154281a0,special:scratch_term silent,kitty-dropterm,zsh\n',) // command.py:118�[0m
                      ipc - movetoworkspacesilent special:scratch_term,address:0x5608154281a0 // ipc.py:64�[0m
                     pypr - scratchpads.event_focusedmon('DP-3,2\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('5608140cef60\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('5608140cef60,2,firefox,Mozilla Firefox\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('5608146d4210,special:scratch_wavebox silent,wavebox,Untitled - Wavebox\n',) // command.py:118�[0m
                      ipc - movetoworkspacesilent special:scratch_wavebox,address:0x5608146d4210 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('5608146ce530\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('5608146ce530,2,firefox,Mozilla Firefox\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('5608146f2880\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('5608146f2880,2,firefox,Mozilla Firefox\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('5608146dc870\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('5608146dc870,2,firefox,Mozilla Firefox\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('56081470a820\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('56081470a820,2,firefox,Mozilla Firefox\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('560814710a10,special:scratch_top silent,kitty_btm,btm\n',) // command.py:118�[0m
                      ipc - movetoworkspacesilent special:scratch_top,address:0x560814710a10 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('5608146ce530\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('5608146dc870\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('56081470a820\n',) // command.py:118�[0m
                     pypr - scratchpads.run_toggle('ytmusic',) // command.py:118�[0m
              scratchpads - ytmusic is visible = False // scratchpads.py:655�[0m
                      ipc - activewindow // ipc.py:36�[0m
              scratchpads - Showing ytmusic // scratchpads.py:698�[0m
              scratchpads - ytmusic is not running, restarting... // scratchpads.py:473�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['windowrule workspace special:scratch_ytmusic silent,^(chrome-cinhimbnkkaeohfgghhklpknlkffjgod-Default)$', 'windowrule float,^(chrome-cinhimbnkkaeohfgghhklpknlkffjgod-Default)$', 'windowrule move 256 200%,^(chrome-cinhimbnkkaeohfgghhklpknlkffjgod-Default)$', 'windowrule size 4608 1152,^(chrome-cinhimbnkkaeohfgghhklpknlkffjgod-Default)$'] // ipc.py:64�[0m
              scratchpads - starting ytmusic // scratchpads.py:478�[0m
              scratchpads - scratch ytmusic has pid 6039 // scratchpads.py:544�[0m
              scratchpads - ==> Wait for ytmusic spawning // scratchpads.py:480�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
              scratchpads - => ytmusic client (proc:6039, addr:0x560814722760) received on time // scratchpads.py:491�[0m
              scratchpads - hidding wavebox // scratchpads.py:709�[0m
�[33;20m              scratchpads - wavebox is already hidden // scratchpads.py:777�[0m
              scratchpads - hidding obsidian // scratchpads.py:709�[0m
�[33;20m              scratchpads - obsidian is already hidden // scratchpads.py:777�[0m
                      ipc - movetoworkspacesilent special:scratch_ytmusic,address:0x560814722760 // ipc.py:64�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['moveworkspacetomonitor special:scratch_ytmusic DP-3', 'movetoworkspacesilent 2,address:0x560814722760'] // ipc.py:64�[0m
                      ipc - resizewindowpixel exact 1920 1152,address:0x560814722760 // ipc.py:64�[0m
                      ipc - movewindowpixel exact 256 228,address:0x560814722760 // ipc.py:64�[0m
                      ipc - focuswindow address:0x560814722760 // ipc.py:64�[0m
                     pypr - scratchpads.event_openwindow('560814722760,special:scratch_ytmusic silent,chrome-cinhimbnkkaeohfgghhklpknlkffjgod-Default,YouTube Music\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2(',\n',) // command.py:118�[0m
              scratchpads - (SKIPPED) hide ytmusic because another client is active // scratchpads.py:589�[0m
                     pypr - scratchpads.event_activewindowv2('560814722760\n',) // command.py:118�[0m
                     pypr - scratchpads.run_toggle('ytmusic',) // command.py:118�[0m
              scratchpads - ytmusic is visible = True // scratchpads.py:655�[0m
              scratchpads - Hiding ytmusic // scratchpads.py:780�[0m
                      ipc - movewindowpixel 0 1497,address:0x560814722760 // ipc.py:64�[0m
                      ipc - movetoworkspacesilent special:scratch_ytmusic,address:0x560814722760 // ipc.py:64�[0m
                      ipc - focuswindow address:0x56081470a820 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('5608146ce530\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('56081470a820\n',) // command.py:118�[0m
                     pypr - scratchpads.run_toggle('ytmusic',) // command.py:118�[0m
              scratchpads - ytmusic is visible = False // scratchpads.py:655�[0m
                      ipc - activewindow // ipc.py:36�[0m
              scratchpads - Showing ytmusic // scratchpads.py:698�[0m
              scratchpads - hidding wavebox // scratchpads.py:709�[0m
�[33;20m              scratchpads - wavebox is already hidden // scratchpads.py:777�[0m
              scratchpads - hidding obsidian // scratchpads.py:709�[0m
�[33;20m              scratchpads - obsidian is already hidden // scratchpads.py:777�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['moveworkspacetomonitor special:scratch_ytmusic DP-3', 'movetoworkspacesilent 2,address:0x560814722760'] // ipc.py:64�[0m
                      ipc - resizewindowpixel exact 1920 1152,address:0x560814722760 // ipc.py:64�[0m
                      ipc - movewindowpixel exact 1600 228,address:0x560814722760 // ipc.py:64�[0m
                      ipc - focuswindow address:0x560814722760 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('560814722760\n',) // command.py:118�[0m
                     pypr - scratchpads.run_toggle('ytmusic',) // command.py:118�[0m
              scratchpads - ytmusic is visible = True // scratchpads.py:655�[0m
              scratchpads - Hiding ytmusic // scratchpads.py:780�[0m
                      ipc - movewindowpixel 0 1497,address:0x560814722760 // ipc.py:64�[0m
                      ipc - movetoworkspacesilent special:scratch_ytmusic,address:0x560814722760 // ipc.py:64�[0m
                      ipc - focuswindow address:0x56081470a820 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('5608146ce530\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('56081470a820\n',) // command.py:118�[0m
                     pypr - scratchpads.run_toggle('ytmusic',) // command.py:118�[0m
              scratchpads - ytmusic is visible = False // scratchpads.py:655�[0m
                      ipc - activewindow // ipc.py:36�[0m
              scratchpads - Showing ytmusic // scratchpads.py:698�[0m
              scratchpads - hidding wavebox // scratchpads.py:709�[0m
�[33;20m              scratchpads - wavebox is already hidden // scratchpads.py:777�[0m
              scratchpads - hidding obsidian // scratchpads.py:709�[0m
�[33;20m              scratchpads - obsidian is already hidden // scratchpads.py:777�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['moveworkspacetomonitor special:scratch_ytmusic DP-3', 'movetoworkspacesilent 2,address:0x560814722760'] // ipc.py:64�[0m
                      ipc - resizewindowpixel exact 1920 1152,address:0x560814722760 // ipc.py:64�[0m
                      ipc - movewindowpixel exact 1600 228,address:0x560814722760 // ipc.py:64�[0m
                      ipc - focuswindow address:0x560814722760 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('560814722760\n',) // command.py:118�[0m
                     pypr - scratchpads.run_toggle('ytmusic',) // command.py:118�[0m
              scratchpads - ytmusic is visible = True // scratchpads.py:655�[0m
              scratchpads - Hiding ytmusic // scratchpads.py:780�[0m
                      ipc - movewindowpixel 0 1497,address:0x560814722760 // ipc.py:64�[0m
                      ipc - movetoworkspacesilent special:scratch_ytmusic,address:0x560814722760 // ipc.py:64�[0m
                      ipc - focuswindow address:0x56081470a820 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('5608146ce530\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('56081470a820\n',) // command.py:118�[0m
                     pypr - scratchpads.run_toggle('ytmusic',) // command.py:118�[0m
              scratchpads - ytmusic is visible = False // scratchpads.py:655�[0m
                      ipc - activewindow // ipc.py:36�[0m
              scratchpads - Showing ytmusic // scratchpads.py:698�[0m
              scratchpads - hidding wavebox // scratchpads.py:709�[0m
�[33;20m              scratchpads - wavebox is already hidden // scratchpads.py:777�[0m
              scratchpads - hidding obsidian // scratchpads.py:709�[0m
�[33;20m              scratchpads - obsidian is already hidden // scratchpads.py:777�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['moveworkspacetomonitor special:scratch_ytmusic DP-3', 'movetoworkspacesilent 2,address:0x560814722760'] // ipc.py:64�[0m
                      ipc - resizewindowpixel exact 1920 1152,address:0x560814722760 // ipc.py:64�[0m
                      ipc - movewindowpixel exact 1600 228,address:0x560814722760 // ipc.py:64�[0m
                      ipc - focuswindow address:0x560814722760 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('560814722760\n',) // command.py:118�[0m
                     pypr - scratchpads.run_toggle('ytmusic',) // command.py:118�[0m
              scratchpads - ytmusic is visible = True // scratchpads.py:655�[0m
              scratchpads - Hiding ytmusic // scratchpads.py:780�[0m
                      ipc - movewindowpixel 0 1497,address:0x560814722760 // ipc.py:64�[0m
                      ipc - movetoworkspacesilent special:scratch_ytmusic,address:0x560814722760 // ipc.py:64�[0m
                      ipc - focuswindow address:0x56081470a820 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('5608146ce530\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('56081470a820\n',) // command.py:118�[0m
                     pypr - scratchpads.run_toggle('amplenote',) // command.py:118�[0m
              scratchpads - amplenote is visible = False // scratchpads.py:655�[0m
                      ipc - activewindow // ipc.py:36�[0m
              scratchpads - Showing amplenote // scratchpads.py:698�[0m
              scratchpads - amplenote is not running, restarting... // scratchpads.py:473�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['windowrule workspace special:scratch_amplenote silent,^(chrome-pfphgelppkenhllngngioolkaeelhlmi-Default)$', 'windowrule float,^(chrome-pfphgelppkenhllngngioolkaeelhlmi-Default)$', 'windowrule move 1280 200%,^(chrome-pfphgelppkenhllngngioolkaeelhlmi-Default)$', 'windowrule size 2560 1152,^(chrome-pfphgelppkenhllngngioolkaeelhlmi-Default)$'] // ipc.py:64�[0m
              scratchpads - starting amplenote // scratchpads.py:478�[0m
              scratchpads - scratch amplenote has pid 6411 // scratchpads.py:544�[0m
              scratchpads - ==> Wait for amplenote spawning // scratchpads.py:480�[0m
                      ipc - clients // ipc.py:36�[0m
                      ipc - clients // ipc.py:36�[0m
              scratchpads - => amplenote client (proc:6411, addr:0x560814732020) received on time // scratchpads.py:491�[0m
                      ipc - movetoworkspacesilent special:scratch_amplenote,address:0x560814732020 // ipc.py:64�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['moveworkspacetomonitor special:scratch_amplenote DP-3', 'movetoworkspacesilent 2,address:0x560814732020'] // ipc.py:64�[0m
                      ipc - resizewindowpixel exact 1920 1152,address:0x560814732020 // ipc.py:64�[0m
                      ipc - movewindowpixel exact 1280 228,address:0x560814732020 // ipc.py:64�[0m
                      ipc - focuswindow address:0x560814732020 // ipc.py:64�[0m
                     pypr - scratchpads.event_openwindow('560814732020,special:scratch_amplenote silent,chrome-pfphgelppkenhllngngioolkaeelhlmi-Default,Amplenote\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('560814732020\n',) // command.py:118�[0m
                     pypr - scratchpads.run_toggle('amplenote',) // command.py:118�[0m
              scratchpads - amplenote is visible = True // scratchpads.py:655�[0m
                      ipc - activewindow // ipc.py:36�[0m
              scratchpads - Showing amplenote // scratchpads.py:698�[0m
              scratchpads - amplenote is not running, restarting... // scratchpads.py:473�[0m
              scratchpads - starting amplenote // scratchpads.py:478�[0m
              scratchpads - scratch amplenote has pid 6488 // scratchpads.py:544�[0m
              scratchpads - ==> Wait for amplenote spawning // scratchpads.py:480�[0m
                      ipc - clients // ipc.py:36�[0m
              scratchpads - => amplenote client (proc:6488, addr:0x560814732020) received on time // scratchpads.py:491�[0m
                      ipc - movetoworkspacesilent special:scratch_amplenote,address:0x560814732020 // ipc.py:64�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['moveworkspacetomonitor special:scratch_amplenote DP-3', 'movetoworkspacesilent 2,address:0x560814732020'] // ipc.py:64�[0m
                      ipc - resizewindowpixel exact 1920 1152,address:0x560814732020 // ipc.py:64�[0m
                      ipc - movewindowpixel exact 1600 228,address:0x560814732020 // ipc.py:64�[0m
                      ipc - focuswindow address:0x560814732020 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('5608146ce530\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('560814732020\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('5608147364f0,special:scratch_amplenote silent,chrome-pfphgelppkenhllngngioolkaeelhlmi-Default,Amplenote\n',) // command.py:118�[0m
                     pypr - scratchpads.run_toggle('amplenote',) // command.py:118�[0m
              scratchpads - amplenote is visible = True // scratchpads.py:655�[0m
                      ipc - activewindow // ipc.py:36�[0m
              scratchpads - Showing amplenote // scratchpads.py:698�[0m
              scratchpads - amplenote is not running, restarting... // scratchpads.py:473�[0m
              scratchpads - starting amplenote // scratchpads.py:478�[0m
              scratchpads - scratch amplenote has pid 6541 // scratchpads.py:544�[0m
              scratchpads - ==> Wait for amplenote spawning // scratchpads.py:480�[0m
                      ipc - clients // ipc.py:36�[0m
              scratchpads - => amplenote client (proc:6541, addr:0x560814732020) received on time // scratchpads.py:491�[0m
                      ipc - movetoworkspacesilent special:scratch_amplenote,address:0x560814732020 // ipc.py:64�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['moveworkspacetomonitor special:scratch_amplenote DP-3', 'movetoworkspacesilent 2,address:0x560814732020'] // ipc.py:64�[0m
                      ipc - resizewindowpixel exact 1920 1152,address:0x560814732020 // ipc.py:64�[0m
                      ipc - movewindowpixel exact 1600 228,address:0x560814732020 // ipc.py:64�[0m
                      ipc - focuswindow address:0x560814732020 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('5608146ce530\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('560814732020\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('560814738c60,special:scratch_amplenote silent,chrome-pfphgelppkenhllngngioolkaeelhlmi-Default,Amplenote\n',) // command.py:118�[0m
                     pypr - scratchpads.run_toggle('amplenote',) // command.py:118�[0m
              scratchpads - amplenote is visible = True // scratchpads.py:655�[0m
                      ipc - activewindow // ipc.py:36�[0m
              scratchpads - Showing amplenote // scratchpads.py:698�[0m
              scratchpads - amplenote is not running, restarting... // scratchpads.py:473�[0m
              scratchpads - starting amplenote // scratchpads.py:478�[0m
              scratchpads - scratch amplenote has pid 6593 // scratchpads.py:544�[0m
              scratchpads - ==> Wait for amplenote spawning // scratchpads.py:480�[0m
                      ipc - clients // ipc.py:36�[0m
              scratchpads - => amplenote client (proc:6593, addr:0x560814732020) received on time // scratchpads.py:491�[0m
                      ipc - movetoworkspacesilent special:scratch_amplenote,address:0x560814732020 // ipc.py:64�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['moveworkspacetomonitor special:scratch_amplenote DP-3', 'movetoworkspacesilent 2,address:0x560814732020'] // ipc.py:64�[0m
                      ipc - resizewindowpixel exact 1920 1152,address:0x560814732020 // ipc.py:64�[0m
                      ipc - movewindowpixel exact 1600 228,address:0x560814732020 // ipc.py:64�[0m
                      ipc - focuswindow address:0x560814732020 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('5608146ce530\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('560814732020\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('56081473cd60,special:scratch_amplenote silent,chrome-pfphgelppkenhllngngioolkaeelhlmi-Default,Amplenote\n',) // command.py:118�[0m
                     pypr - scratchpads.run_toggle('amplenote',) // command.py:118�[0m
              scratchpads - amplenote is visible = True // scratchpads.py:655�[0m
                      ipc - activewindow // ipc.py:36�[0m
              scratchpads - Showing amplenote // scratchpads.py:698�[0m
              scratchpads - amplenote is not running, restarting... // scratchpads.py:473�[0m
              scratchpads - starting amplenote // scratchpads.py:478�[0m
              scratchpads - scratch amplenote has pid 6643 // scratchpads.py:544�[0m
              scratchpads - ==> Wait for amplenote spawning // scratchpads.py:480�[0m
                      ipc - clients // ipc.py:36�[0m
              scratchpads - => amplenote client (proc:6643, addr:0x560814732020) received on time // scratchpads.py:491�[0m
                      ipc - movetoworkspacesilent special:scratch_amplenote,address:0x560814732020 // ipc.py:64�[0m
                      ipc - monitors // ipc.py:36�[0m
                      ipc - ['moveworkspacetomonitor special:scratch_amplenote DP-3', 'movetoworkspacesilent 2,address:0x560814732020'] // ipc.py:64�[0m
                      ipc - resizewindowpixel exact 1920 1152,address:0x560814732020 // ipc.py:64�[0m
                      ipc - movewindowpixel exact 1600 228,address:0x560814732020 // ipc.py:64�[0m
                      ipc - focuswindow address:0x560814732020 // ipc.py:64�[0m
                     pypr - scratchpads.event_activewindowv2('5608146ce530\n',) // command.py:118�[0m
                     pypr - scratchpads.event_activewindowv2('560814732020\n',) // command.py:118�[0m
                     pypr - scratchpads.event_openwindow('56081473fc60,special:scratch_amplenote silent,chrome-pfphgelppkenhllngngioolkaeelhlmi-Default,Amplenote\n',) // command.py:118�[0m

@fdev31
Copy link
Collaborator

fdev31 commented Nov 29, 2023

Can you please install the package again when you have fixed your other issues.
There was a stupid problem making pwa fail, I just pushed the fix.

@kuba-gaj
Copy link
Author

It works great now, thank you very much!

At first, I encountered problems but I solved them by setting float with windowrule in my hyprland.conf. It is mentioned in the documentation but things worked for me without setting it for other apps. Maybe something to mention in the docs?

Also noticed the config param name is still pwa_hack, but we discussed other names above.

Thanks again!

@fdev31
Copy link
Collaborator

fdev31 commented Nov 30, 2023

Yes, I didn't decide for the final name yet... but I may pick shared_pid which sounds quite neutral.
Thank you a lot for your feedback!
As I said this can't support all the features, else it may make the code too complex, but I'll still have a look why this happens (float not set automatically), there is no obvious reason for it to be broken by this...

I'll add some notes in the troubleshooting part for this feature.

@fdev31 fdev31 closed this as completed Nov 30, 2023
@fdev31
Copy link
Collaborator

fdev31 commented Nov 30, 2023

FYI I pushed an update (in -git branch) which should fix the floating state....
EDIT: I'll call it process_tracking = false which matches the "solution".

@fdev31
Copy link
Collaborator

fdev31 commented Dec 1, 2023

Yesterday I made a refactoring of this code.
It's not on git yet, I wanted to know if you would be kind enough to test the git release when I'll push this one. It looks like it works exactly the same for me but I'm not an extensive user of it, you'll have a better view. Also playing with PWA can easily break here, it looked completely off until I restarted the computer. It looks like sometimes some browser windows unrelated to PWA are causing some troubles which I'm not understanding.

@realsnick
Copy link

following, will be able to test on nixOS

@fdev31
Copy link
Collaborator

fdev31 commented Dec 2, 2023 via email

@kuba-gaj
Copy link
Author

kuba-gaj commented Dec 2, 2023

of course I'm happy to test!

@fdev31
Copy link
Collaborator

fdev31 commented Dec 2, 2023

Great :)
So if you can check out the pyprland-git package and tell me if you see new problems you are very welcome!
I did some minimal testing and it looks all fine, but I'ld prefer having some feedback first :)

@kuba-gaj
Copy link
Author

kuba-gaj commented Dec 2, 2023

seems to be working fine for me on pyprland-git

@fdev31 fdev31 added the enhancement New feature or request label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants