svelterust / raise

Run or raise for Hyprland
20 stars 1 forks source link

Run-or-Raise for websites #2

Closed Vaisakhkm2625 closed 5 months ago

Vaisakhkm2625 commented 9 months ago

Run-or-Raise for websites

Thanks for making this.. (i was looking for something like this for months..(maybe years) and i wasn't able to make proper script with hyprctl...skillissue)

Problem

Is there anyway to do raise and run for websites like youtube, discord-web, teams, whatsapp-web ?

current setup

currently i put discord and whatsapp to special workspaces and for things i constantly open new tabs, i use

!#/bin/sh
raise --class "firefox" --launch "firefox" && firefox $1

firefoxRaiseOpen.sh www.youtube.com

but putting webpages into special workspaces breaking this application. (i use repeatedly focusing different instance with raise command, but once reach a special workspace, focus stuck there..., also ,i wasn't able to find a way to change class name of firefox)

it would be nice to have raise support other properties like window title which could resolve such issues...

svelterust commented 9 months ago

Interesting. I haven't looked at how that would be implemented, but if all you need is window title then that's probably very easy to implement.

Vaisakhkm2625 commented 9 months ago

Interesting. I haven't looked at how that would be implemented, but if all you need is window title then that's probably very easy to implement.

yes... that's all... but actually, at this point i don't need it as i already got a good workflow with app in special workspaces, but anyway it is good to have... but for titles, it's better to have regex matching(hyprland allows this) as titles normally change (whatsapp will add 1,2,3 depending on number of unread chats eg:"(1) WhatsApp — Mozilla Firefox", youtube adds video title etc...)

one more bug is getting stuck in clients special workspaces (if needed i can open a new issue for this.... than mixing both issues together)

also, if possible can you filter out client in special workspaces? ignoring such client is feels like the easiest way to fix it... https://github.com/knarkzel/raise/blob/6f4379e309e7da3f417e0ae6363bedf722bace25/src/main.rs#L72

image for "spacial named workspaces", a string "special:" is prefixed with workspace name, and for "special workspace", name is just "special"

or else while walking through the clients with same class, if it is a client from speical workspace, then dispatch "toggleworkspace" with workspace name... in that case, we can walk through clients with same classname without getting stuck on any client....

svelterust commented 9 months ago

Hmm so you want to run-or-raise based on title as well, with regex support? This is easy to implement, feel free to open a pull request for this. The code is basically the same as for clients, using title or initialTitle field return from the array of clients when calling hyprctl clients -j.

svelterust commented 9 months ago

Just add title field here: https://github.com/knarkzel/raise/blob/6f4379e309e7da3f417e0ae6363bedf722bace25/src/main.rs#L18-L22

Then modify Args to take class: Option<String> and title: Option<String> use pattern matching https://github.com/knarkzel/raise/blob/6f4379e309e7da3f417e0ae6363bedf722bace25/src/main.rs#L8-L16: