CZ-NIC/run-or-raise

Shortcut to run or raise google-chrome but not to raise google-chrome --app=https://mail.google.com/mail/u/0

Closed this issue · 2 comments

Hi thanks for creating such a great extension.

I have one shortcut to open discord in brave:

<Super>d,brave-browser --profile-directory=Default --app=https://discord.com/channels/865432401270145054/1083781888163979275,,Discord

and another shortcut to open brave:
<Super>w,brave-browser,Brave-browser,

However when discord is open, and I press Super+w, which I intend to open brave, it also sometimes opens discord (i.e. it cycles though all my brave windows including my discord window, if one is open, due to it using brave).

Is there a way that I can modify either of the above shortcuts such that pressing super+w will only ever open standard brave windows and never the discord app window?

Perhaps a solution would involve allowing for a negative filter to be added to the brave-browser shortcut configuration so that it excludes windows with discord.com in one of the WM_CLASS strings. This would solve the problem for me as the discord brave window has the following WM_CLASS strings according to xprop:

WM_CLASS(STRING) = "discord.com__channels_865432401270145054_1083781888163979275", "Brave-browser"

An alternative solution would be to filter on WM_WINDOW_ROLE.
For normal brave windows WM_WINDOW_ROLE(STRING) = "browser" whereas for discord windows WM_WINDOW_ROLE(STRING) = "pop-up"

So adding a requirement that WM_WINDOW_ROLE=browser for the brave command would presumably result in it excluding discord windows, as desired.

many thx!

I think you're on the right way. Definitely using the WM_CLASS should help you.

  1. Use a regex of WM_CLASS_INSTANCE (discord.com__channels_865432401270145054_1083781888163979275") instead of matching by title:
  2. Paste here window titles of the app and regular Brave browser. Is not is so that the string Brave is always in the browser's title but never in the Discord's app? For Chrome is works exactly that way.
<Super>d,brave-browser --profile-directory=Default --app=https://discord.com/channels/865432401270145054/1083781888163979275,"discord.com__channels_.*",
<Super>w,brave-browser,,Brave

Ah perfect this solved it for me:
w,brave-browser,,Brave

thank you very much!