Discover icon indicating copy to clipboard operation
Discover copied to clipboard

Add setting to only show overlay when in a whitelisted active window

Open ckiee opened this issue 4 years ago • 3 comments

...or maybe have a window whitelist - the overlay is pretty distracting when in a (e.g.) browser window and not in a game.

I'd PR this but I'm not too sure how this would be implemented as I don't know Python or low-level X.org/Wayland API's.

ckiee avatar Oct 29 '20 09:10 ckiee

I have no idea how you'd do this in X and know for certain this isn't possible in wayland.

The only way I can see this working is to automatically start and stop the overlay based on game launching. Something like https://github.com/FeralInteractive/gamemode might be able to accommodate us so that it only runs overlay when needed

trigg avatar Oct 29 '20 10:10 trigg

Hmm, I guess the window class whitelist is the next best thing then. I checked with xprop -root | grep NET_ACTIVE_WINDOW and this is definitely possible on X.org. (seems pretty basic so I'd guess a similar thing works on Wayland too but I don't have Wayland setup to test or any idea of what docs I'd read)

ckiee avatar Oct 31 '20 12:10 ckiee

You can always use WM_NAME aka window title if window role or class is not available / too generic.

selurvedu avatar Nov 02 '20 22:11 selurvedu

Don't know if this helps. But you could check if a window is in fullscreen with this method:

def is_window_fullscreen():
    display = Xlib.display.Display()
    root = display.screen().root
    active_window_id = root.get_full_property(
        display.intern_atom('_NET_ACTIVE_WINDOW'),
        Xlib.X.AnyPropertyType
    ).value[0]
    active_window = display.create_resource_object('window', active_window_id)
    state_property = active_window.get_full_property(
        display.intern_atom('_NET_WM_STATE'),
        Xlib.Xatom.ATOM
    )
    if state_property:
        state_atoms = [display.get_atom_name(x) for x in state_property.value]
        if '_NET_WM_STATE_FULLSCREEN' in state_atoms:
            return True
    return False```

Mojito060 avatar Feb 20 '23 01:02 Mojito060

I'm not still interested, can close unless someone else wants this.

ckiee avatar Feb 20 '23 11:02 ckiee