Reputation: 542
How can I programmatically bring a window on top of the others? I'm using a full screen app and I need to bring a second window temporary on the front.
Upvotes: 4
Views: 1924
Reputation: 4534
According to the Arch wiki,
Windows load behind the active window
Some application windows (such as Firefox windows) may load behind the currently active window, causing you to need to switch to the window you just created to focus it. To fix this behavior add this to your
~/.config/openbox/rc.xml
file, inbetween the<openbox_config>
and</openbox_config>
tags:<applications> <application class="*"> <focus>yes</focus> </application> </applications>
In Debian Strech 9 LXDE, the config is in ~/.config/openbox/lxde-rc.xml
. You'll need to edit this file as root. The <applications>
tags already exist at the end of the file and, in my case, there are bunch of helpful comments which explain things. As they pertain to your situation,
<application name="first element of window's WM_CLASS property (see xprop)" class="second element of window's WM_CLASS property (see xprop)" role="the window's WM_WINDOW_ROLE property (see xprop)"> # the name or the class can be set, or both. this is used to match # windows when they appear. role can optionally be set as well, to # further restrict your matches. # the name, class, and role use simple wildcard matching such as those # used by a shell. you can use * to match any characters and ? to match # any single character.
xprop
is a "property displayer for X". To read more about it, type man xprop
. Basically, setting class equal to the wildcard *
says, "Apply the inner options to all new applications". The inner option is then <focus>yes</focus>
which means put the new application in front of all the current windows.
Once you've added those lines, make sure you run
openbox --reconfigure
That will apply your updates. As always, you can read more about what that command does with man openbox
.
Upvotes: 0
Reputation: 241928
I use wmctrl
for that:
wmctrl -a "window name"
Or, if you know the PID of the application
wmctrl -i -a "$PID"
Upvotes: 6