1

--- The context ---

I'm using Openbox to create a dedicated workspace/desktop for my browser -- the browser only opens on that workspace, and any other windows created on it get kicked onto a different workspace.

This works for most of my browsing, but with fullscreen-capable content such as streaming videos or Flash apps, switching to 'fullscreen mode' actually creates a new window for the content to play in... so Openbox kicks it off the dedicated workspace. Meaning, when I exit fullscreen mode I'm on my random clutter workspace instead of back in my browser.

I need to write an exception so Openbox lets the fullscreen content stay on the dedicated workspace.

--- The problem ---

I would like to use xprop (or just wmctrl -l) to get some info on the window that the fullscreen web content plays in, but the window automatically closes as soon as it loses focus (as far as I can tell) so I can't just switch to my terminal and do it manually. I need some way to log the info in the background. Ideally I'd like some kind of background monitor that logs the name of every window that gets opened.

Is there a relatively simple way to script this? I'm sure I could find a monitoring software package that could do this, but it seems like overkill for what I need.

EDIT to add answer: Just using a timer (sleep 10; xprop) as suggested by Gilles worked. For future reference the relevant line was _OB_APP_CLASS(UTF8_STRING) = "Plugin-container"

1

A program that monitors window creation doesn't come to mind, but you don't need that.

You can run wmctrl -l in a loop or on a timer (e.g. sleep 10; wmctrl -l) and then start the fullscreen application and record its window properties. If you want more information, you can do something like

sleep 10; xprop

After 10 seconds, the mouse cursor will change; clicking should make xprop display information about the foreground window.

Alternatively, use xdotool (again on a timer or in a loop) and its window matching capabilities to find the window ID, e.g. xdotool --pid if the full-screen window is in a pre-existing process, or xdotool getwindowfocus or getactivewindow to get the window ID of the window that has the focus. Note that the foreground window may in fact not have the input focus (some full-screen applications display an additional full-screen window in the foreground but keep the focus in their “normal” window; you can query the window at some screen location instead, or simply xdotool getmouselocation for a full-screen window (for a multi-monitor setup, if the mouse cursor is already on the right monitor).

Alternatively, on Linux, switch to a text console (e.g. Ctrl+Alt+F1), log in, run export DISPLAY=:0, and then you can access the GUI (run xprop, xdotool, etc.). With some setups you may need to set XAUTHORITY as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.