hyprland-community / pyprland

Scratchpads & many goodies for Hyprland [maintainer=@fdev31]
MIT License
345 stars 15 forks source link

[BUG] pyprland web apps #93

Closed AtnProjects closed 4 months ago

AtnProjects commented 4 months ago

Steps to reproduce the problem:

[scratchpads.gpt] animation = "fromTop" command = "brave --profile-directory=Default --app=https://chat.openai.com/" class = "brave-chat.openai.com__-Default" size = "75% 60%" process_tracking = false

Open Brave. Run the command pypr toggle chatgpt. Notice that the scratchpad opens, but not at the 75% width and 60% height size as specified. Additional Information:

Linux distribution: Arch Linux Desktop environment: Hyprland I have tried restarting Pyprland and checking the window class, but the problem persists.

I would appreciate any help in solving this problem

fdev31 commented 4 months ago

I can't reproduce the problem, which version are you using?

EDIT: If you didn't restart Hyprland for a while and played with many different configs, it could be worth restarting it since it keeps tracks of some styles which have been set (after ensuring there is no conflicting rule in the Hyprland config).

AtnProjects commented 4 months ago

image

pypr version 2.2.14

fdev31 commented 4 months ago

Did you try match_by="class"? Did you get it working with previous pyprland versions?

It's disappointing, I'm also having brave installed & using Archlinux...

fdev31 commented 4 months ago

Try providing your complete Hyprland & Pyprland config, I'll run with your own config.

fdev31 commented 4 months ago

You can also try to do match_by="initialClass" and providing initialClass="same as your class"

AtnProjects commented 4 months ago

I have changed the process tracking to a lazy one and I solved it, windows no longer open out of nowhere when starting Hyprland. Also, the only way I found is to use a browser only for web apps because if I open it I still have the same error

Additional Information

pyrprland.toml

[pyprland] plugins = [ "shortcuts_menu", "toggle_special", "scratchpads", "layout_center", "lost_windows", "monitors", "toggle_special", "shift_monitors", "toggle_dpms", "magnify", "expose", "shift_monitors", "workspaces_follow_focus", "fetch_client_menu" ]

[workspaces_follow_focus] max_workspaces = 9

[expose] include_special = false

[scratchpads.term] animation = "fromTop" command = "kitty --class kitty-dropterm" class = "kitty-dropterm" size = "75% 60%" max_size = "1920px 100%"

[scratchpads.volume] animation = "fromRight" command = "pavucontrol" class = "pavucontrol" lazy = true size = "40% 90%" max_size = "1080px 100%" unfocus = "hide"

[layout_center] margin = 60 offset = [0, 30] next = "movefocus r" prev = "movefocus l" next2 = "movefocus d" prev2 = "movefocus u"

Chat GPT on Brave

[scratchpads.gpt] animation = "fromTop" command = "brave --profile-directory=Default --app=https://chat.openai.com" class = "brave-chat.openai.com__-Default" size = "75% 60%" lazy = true

process_tracking = false

[scratchpads.yt_dlp_download] animation = "fromTop" command = "kitty --class yt_dlp_download /home/rootkit/.config/scrash/downloads.sh" class = "yt_dlp_download" lazy = true size = "65% 25%"

[scratchpads.gemini] animation = "fromTop" command = "brave --profile-directory=Default --app=https://gemini.google.com/app" class = "brave-gemini.google.com-Default" size = "75% 60%" lazy = true

[scratchpads.gmail] animation = "fromTop" command = "brave --profile-directory=Default --app=https://mail.google.com/mail/u/0/#inbox" class = "brave-mail.google.com-Default" size = "75% 60%" lazy = true

[scratchpads.translate] animation = "fromTop" command = "brave --profile-directory=Default --app=https://translate.google.com/" class = "brave-translate.google.com-Default" size = "75% 60%" lazy = true

[scratchpads.ai] animation = "fromTop" command = "brave --profile-directory=Default --app=https://aistudio.google.com/app/prompts/new_chat" class = "brave-aistudio.google.com-Default" size = "75% 60%" lazy = true

AtnProjects commented 4 months ago

image

fdev31 commented 4 months ago

lazy is turned off when you disable process tracking, so here you are just not disabling the process tracking anymore.

Did you try using match_by="class" with the current configuration to see if it improves something ?

A webbrowser is often "one app" with a complex process management, so using it as a standalone app requires some trick, but with class matching and no process handling you can achieve it. Use a different profile than the default eventually... maybe that helps ? (if so, please tell me so I'll update the wiki)

If you want it easy, you should use a different webbrowser for the scratchpad...

AtnProjects commented 4 months ago

[scratchpads.gpt] animation = "fromTop" command = "brave --profile-directory=Default --app=https://chat.openai.com/" match_by = "brave-chat.openai.com__-Default" size = "75% 60%" process_tracking = false

image

fdev31 commented 4 months ago

tldr: replace "match_by" with "class"

match_by="class" class="brave-chat.openai.com__-Default"

but the "match_by" should be automatic when you disable process tracking... so just defining class should work.

AtnProjects commented 4 months ago

[scratchpads.gpta] animation = "fromTop" command = "brave --profile-directory=Default --app=https://chat.openai.com" class="brave-chat.openai.com__-Default" match_by="class" size = "75% 60%"

the same continuous error

fdev31 commented 4 months ago

[scratchpads.gpta] animation = "fromTop" command = "brave --profile-directory=Default --app=https://chat.openai.com" class="brave-chat.openai.com__-Default" match_by="class" size = "75% 60%"

the same continuous error

Why did you remove the process tracking line?

AtnProjects commented 4 months ago

Sorry I was wrong, I put it again but it still produces the size error

fdev31 commented 4 months ago

Using this configuration it works perfectly for me:

[scratchpads.gpta]
animation = "fromTop"
command = "brave --profile-directory=Default --app=https://chat.openai.com"
class="brave-chat.openai.com__-Default"
size = "75% 60%"
lazy = true
process_tracking = false

If it doesn't for you, send the pypr logs after a clean restart of Hyprland, using this exact configuration.

By the way, did you try to change the profile directory (& class) to see if this had an impact ?

EDIT: removed match_by="class" because it's automatic in that case

fdev31 commented 4 months ago

What pyprland is doing is setting windowrule = size 75% 60%,^(class)$ which you can manually add to Hyprland.conf and try to understand why it's not working for you.

The only limitation you should face when you have no process tracking is that you can't close the window, it will mess up everything, you need to always hide it "properly"...

AtnProjects commented 4 months ago

With the lazy configuration it worked correctly but when I tried yours it did not apply the sizes to me

fdev31 commented 4 months ago

Ok, then I provided you all the information to understand the issue on your system. If the windowrules are working in Hyprland.conf when you set them manually and only via pypr they don't work, then open a bug for this including the full log file. Hope it helped!