2018-06-21, 10:14
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.
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.