Release X11 Window Control pack
#1
Hi all,

since i needed to maximize kodi again in my plugin i searched for possibilities to do so. In windows the powershell is actually quite powerfull when comes to this kind of tasks, so that was easy... linux not so much. While some plugins rely wmctrl or similar command line programs I didn't like that approach because the user has to install something by himself on his machine.
So i found this two libraries which are python only and did the job for me. However they are much more powerful. Things like manipulating an (external) window size or generating an input are possible with those two (e.g. start the browser, bring it to fullscreen and enter a few commands). Since ubuntu dropped wayland basically all the desktops should now use x11.

Here are the kodi modules
The first is python-xlib which gives you a python binding to the xlib
https://github.com/Takezo36/python-xlib/...e.xlib.zip
The second one is call pyewmh and is basically a wrapper for python-xlib with the some easy of use functions
https://github.com/Takezo36/pyewmh/relea...e.ewmh.zip

a little example from my side would be maximizing kodi after you started an external app from your plugin

from ewmh import EWMH ewmh = EWMH()
# get the active window which is kodi
win = ewmh.getActiveWindow()
#blocking call for external app
subprocess.call(command, args)
#when done set kodi as active window again
ewmh.setActiveWindow(win)
# flush request
ewmh.display.flush()

more examples on ewmh here
http://ewmh.readthedocs.io/en/latest/ewmh.html#examples


I'll try to push them to the repo ... When i understood how to do so.
Reply
#2
I have tried it but without success. In my use case im starting the Spotifyclient and after it is started i like to put kodi in foreground.

Code:

ewmh = EWMH() 
win = ewmh.getActiveWindow()
Log(str(win))
Popen([path, spotify_param])
ewmh.setActiveWindow(win)
ewmh.display.flush()

The window-id in my logfile is correct and sometimes the kodi-tab is sending a yellow notice in the kde-tablist after the command. But it is never getting in foreground. I have tested wmctl and this is working, but you are completely right saying this is not the best way to do it.
Reply
#3
Thats unfortunate i have to admit i only tested this with my gnome.
Would you mind trying this instead of setactivewindow

ewmh.setWmState(win, 1, "_NET_WM_STATE_MODAL")
Reply
#4
Saddly it doesnt change anything
Reply

Logout Mark Read Team Forum Stats Members Help
X11 Window Control pack0