Kodi Community Forum

Full Version: Avoid multiple Kodi instances?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is it possible to configure Kodi so it won't open a new instance when I am launching it (using Linux Mint if it's important), but it will just bring the existing and running instance to the foreground?

Thanks
PHP Code:
#! /bin/bash
winid=''
winid=$(wmctrl -l|cut -d' ' -f1,5|grep 'Kodi'|cut -d' ' -f1)
if [ ! -
"$winid]
then
        xdotool windowactivate $winid
else
/
usr/bin/kodi &
fi
exit 

Needed tools - xdotool and wmctrl.

wmctrl gets the window list, the first cut gets the names of the windows and the hex ids. We then look for the window called "Kodi" and get the window id for that. Make sure we have found a window ID and set focus on that window using xdotool, else start Kodi.

Tested on Ubuntu 14.04

Save it in a script and then use that to start kodi.
Works great, thanks!