Cannot keep the widgets on top on Linux if window manager is not mutter
srlemke opened this issue · comments
I tested this with a few window managers:
kwin
marco (from mate desktop)
icewm
openbox
mutter
The only window manager that can keep the overlays on top is mutter, I would not have a problem in using mutter, but the caveat is that mutter is a compositing window manager and you cannot disable compositing, in my case playing the game with compositing enabled causes performance issues.
I tried a few edits on tinypedal/base.py but without luck.
It may be related to the window managers itself, the behavior works as expected if I use: xfwm4 as window manager, which is no problem as it is lightweight and supports to run without compositing, only short come is that without compositing the widgets do not get transparent, but for me that is not a problem.
thanks!
hi, I just checked QT documents, there is one windowflag called Qt.X11BypassWindowManagerHint
, which says it might be needed for Qt.WindowStaysOnTopHint
to work under X11, maybe you can give it a try and see if helps (I can't test myself).
Hello,
That actually did it, I also have the impression it removed some stuttering when compositing is enabled:
diff --git a/tinypedal/base.py b/tinypedal/base.py
index 6d01b3e..b3413d1 100644
--- a/tinypedal/base.py
+++ b/tinypedal/base.py
@@ -84,6 +84,7 @@ class Widget(QWidget):
self.setWindowFlag(Qt.FramelessWindowHint, True)
self.setWindowFlag(Qt.Tool, True) # remove taskbar icon
self.setWindowFlag(Qt.WindowStaysOnTopHint, True)
+ self.setWindowFlag(Qt.X11BypassWindowManagerHint, True)
self.setAttribute(Qt.WA_DeleteOnClose, True)
self.cfg.active_widget_list.append(self) # add to active widget list
thanks!
Awesome, thanks for help and testing! I'll add the line to code.
Ok, it has a drawback, this line added:
-
self.setWindowFlag(Qt.X11BypassWindowManagerHint, True)
I cannot 'see' the windows on OBS, tricky one.
Although I have not mentioned, since 2.0 it is not possible for OBS to directly capture QT window (though capturing entire screen would still work), with or without X11BypassWindowManagerHint line, at least on windows platform. I have done many testing with various code, still it is not possible to let OBS see widgets, unless I disable self.setWindowFlag(Qt.Tool, True)
, which this line is necessary to hide taskbar subwindows (this may not be an issue on linux). Also even with Qt.Tool disabled, OBS can only get a "black" window without anything shown on widget, unless Qt.FramelessWindowHint
is also disabled, which is also not a viable solution. Not sure if it is the same case on linux. So far for windows platform I haven't found any viable solutions.
Yeah I think this is the best compromise, at least now it work on all Linux windows managers.
If someone really wants stream and not use Full screen mode, this are the steps:
At this point in time, use window border mutter or xfwm4 (you need to install it), it as simple as, run in terminal:
mutter --replace
or
xfwm4 --replace
Edit your tinypedal git checkout:
vim Tinypedal/tinypedal/base.py
And comment or set to False this line:
self.setWindowFlag(Qt.X11BypassWindowManagerHint, True)
Thanks! I'll add those to FAQ section on wiki page.
I don't think this is a good long term solution. This change breaks any functionality the window manager may provide. Now users of popular window managers have to edit a file by hand if they want to record with OBS or restore some other functionality.
Couldn't a detection be put for the window managers known to require this workaround? It should also be reported as a bug on those window managers if it isn't already.
Thanks for bring up the point, I reopened the issue, please let me know which approach you guys think is best:
- remove
X11BypassWindowManagerHint
line. - Add an option in json to toggle this option (though I think it not necessary to be added to menu).
- other solutions maybe?
Note X11BypassWindowManagerHint has no effects on windows platform, so in either case it will only be concerned on linux.
Edit: I'll disable X11BypassWindowManagerHint line for now in master branch.
The config flag probably would be the best option in the end as would not require src edits.
Something like:
Window not staying on top on some Linux window managers, at this moment, the bellow 2 window managers work properly:
mutter
xfwm4
(you can test by installing it and running mutter --replace
or xfwm4 replace
)
The above window managers also work properly with stream tools like OBS.
In case you want yo use another window manager (eg. kwin, icewm, openbox, marco...)
Set the bellow flag to True, note that with this flag and above file manager you won´t be able to catch the widgets windows in OBS.
thanks!
Most users wouldn't need to do anything if it worked OOTB on Gnome, KDE and XFCE. We're missing only KDE. Users of other desktops/WMs are probably used to edit files to configure their systems, so I guess the configuration setting to bypass the window manager would be a good option.
Would this comment help to get the widgets on top on KDE? It's about setting a window type in the desktop file so that the window is drawn over everything else.
I've also read something about a KWindowSystem component which could handle it but I know nothing about it.
thanks, I have just added compatibility option (enable_bypass_window_manager) in setting file in this commit 279e353
User guide is updated too, lemme know for any further changes required.
Most users wouldn't need to do anything if it worked OOTB on Gnome, KDE and XFCE. We're missing only KDE. Users of other desktops/WMs are probably used to edit files to configure their systems, so I guess the configuration setting to bypass the window manager would be a good option.
Would this comment help to get the widgets on top on KDE? It's about setting a window type in the desktop file so that the window is drawn over everything else.
I've also read something about a KWindowSystem component which could handle it but I know nothing about it.
I tested the KDE advanced window rules, the one mentioned in the link is already upstream so that one was also part of my testing, but without luck. I did not report any bug yet as it is somewhat specific to reproduce.
I will probably put back xfwm4 as it solves all the problems and is also lightweight, I do not have it enabled right now because I have a few app shortcuts on marco, which I will add to xfwm4.
Most users wouldn't need to do anything if it worked OOTB on Gnome, KDE and XFCE. We're missing only KDE. Users of other desktops/WMs are probably used to edit files to configure their systems, so I guess the configuration setting to bypass the window manager would be a good option.
Would this comment help to get the widgets on top on KDE? It's about setting a window type in the desktop file so that the window is drawn over everything else.
I've also read something about a KWindowSystem component which could handle it but I know nothing about it.I tested the KDE advanced window rules, the one mentioned in the link is already upstream so that one was also part of my testing, but without luck. I did not report any bug yet as it is somewhat specific to reproduce.
You have to edit the desktop file to change the window type to OSD. The comment has an example desktop file for Firefox PiP.
hi, I have just pushed a commit 902fff3 that should fix the "black border" problem that wrapping around each widget previously for WM that not have transparency support (someone on the forum also mentioned this border appear on VR, so I think this is also solved). I have tested on xfwm4 and all seems working ok, lemme know for any issue. (note: due to this border removal, all existing preset widget position will have a slightly offset from their previous position)
Edit: I have decided to add compatibility
to Config
menu on main window for easy toggle. And all main window related options are now placed under Window
menu. 38edacf
IMO, this is also fully implemented, thanks for that! :)