You are not logged in.

#1 2020-12-13 23:21:04

jones
Member
Registered: 2013-03-14
Posts: 276

[S]Make Xfce open current firefox window if firefox is already running

Hey everyone, I simply assigned

firefox

to the keyboard shortcut SUPER+W.

Is it possible to have Xfce open the current firefox window/application if it is already running?

Last edited by jones (2020-12-21 19:44:56)

Offline

#2 2020-12-13 23:43:54

toz
Member
Registered: 2011-10-28
Posts: 513

Re: [S]Make Xfce open current firefox window if firefox is already running

Try:

bash -c "pgrep firefox && wmctrl -a firefox || firefox"

(requires wmctrl)

Offline

#3 2020-12-14 12:05:08

frugal1
Member
Registered: 2020-11-16
Posts: 4

Re: [S]Make Xfce open current firefox window if firefox is already running

I think one can omit "pgrep firefox && ". Also, while "wmctrl -a" works for many applications, "wmctrl -xa" is required for some applications such as leafpad and lxterminal. So I just use "wmctrl -xa" instead.

Offline

#4 2020-12-21 19:44:44

jones
Member
Registered: 2013-03-14
Posts: 276

Re: [S]Make Xfce open current firefox window if firefox is already running

This is solved!

bash -c "pgrep firefox && wmctrl -a firefox || firefox"

The following only works as intended if the program ("process", to be exact) is already running:

wmctrl -xa firefox

Last edited by jones (2020-12-23 10:08:40)

Offline

Board footer

Powered by FluxBB