Open pymen opened 3 years ago
I'm glad you find it useful. I think your ideas are great! Personally I'd perhaps rely on window focus instead of visibility. BUT I lack time and motivation to add new features to xatk partially because it's unclear how long I will be able to avoid wayland.
Thanks for the answer!
Personally I'd perhaps rely on window focus instead of visibility.
as I can see the issue with focus, that if you have 4 windows on one monitor (without overlapping) - both of them are visible, but only one has focus, the same if you have 2 monitors...
I have added some hack to the source code, but because I have never worked with these areas - it is ugly but working :)
@staticmethod
def raise_window(wid, desktop_action=DESKTOP_IGNORE):
"""Activate window.
Optionally switch a desktop or move a window to the active desktop.
Raise BadWindow.
"""
if Xtool.is_visible(wid):
Xtool.hide_window(wid)
return
@staticmethod
def is_visible(wid):
from xcovered import XCovered
return not XCovered().is_covered(wid)
@staticmethod
def hide_window(wid):
from ewmh import EWMH
cmd = EWMH()
win = cmd.display.create_resource_object('window', wid)
cmd.setWmState(win, 1, '_NET_WM_STATE_HIDDEN')
cmd.display.flush()
XCovered
class XCovered(object):
def __init__(self):
import ewmh_xlib as ewmh
self.ewmh = ewmh.EWMH()
def is_covered(self, window_id):
wid = self.ewmh.dpy.create_resource_object('window', window_id)
return self.is_fully_covered(wid)
Really nice tool, was looking for it for a long time.
For my workflow I need to have the ability to temporary show and hide window (for example) TelegramDesktop, for example, now i need to
It will be really nice instead
Other
IF telegram is not visible!! on the screen - it will be shown
IF multiple TG available, next will be shown
example how to get if win is visible https://github.com/ikem-krueger/sleep-walker/blob/develop/src/usr/lib/sleep-walker/daemon/xcovered.py