kodi-openbox
kodi-openbox copied to clipboard
Kodi not closing when an external app is launched
Hello!
I'm using the Advance Emulator Launcher to launch an external app (steam). Using kodi-openbox-runprogram with: steam -bigpicture arguments opens my app, but does not exit kodi. When I exit my app, a second instance of kodi is opened so there are 2 running.
How can I get the initial instance of kodi to exit when I launch my external application?
I'm running ubuntu 20, lightdm autologin enabled for my non-root user in the kodi session.
...disregard. I found a solution
editing the kodi-openbox-runprogram.real script to force kodi closed seems to work
Do you mind posting the change you made to the script, in case others have the same issue?
@Nadonate I think I encountered this issue as well, actually. When you launch steam via command, the command exits and steam is launched, rather than the command running until steam exits. If there is some way to keep the command running until steam exits, this will probably fix your issue of a second kodi window popping up.
(sorry for the late response!)
Thanks for the response! I'm still trying to troubleshoot this...
I've edited your runs script based on forum feedback I posted earlier.
I believe this is a less elegent approach, but it works:
#!/bin/bash mkdir -p ~/.kodi-openbox mkdir -p ~/.kodi-openbox/tmp display=$(echo "${DISPLAY}" | tr ':' '_') echo $$ > ~/.kodi-openbox/tmp/program-running.$display kpid=$(cat ~/.kodi-openbox/tmp/session-pid.$display) echo "closing kodi" ps axf | grep kodi.bin | grep -v grep | awk '{print "kill -9 " $1}' | sh echo "running program" eval "$@" eval_result=$? echo "finished running program" exit $eval_result
The issue I am having now, is when steam is launched kodi is not killed and stays running in the background (I can alt-tab between the two)
Ok, I think I found a solution, for my situation atleast.
I added this line to your script:
ps -ef | grep kodi-x11 | grep -v grep | awk '{print $2}' | xargs kill
This should find and close the PID associated with 'kodi-x11'. In testing it works and your script reopens kodi in the openbox session.
I'm not super experienced with scripting, and there is probably a better way to do this, but I'm happy with the result ;).
Thanks again for your work on kodi-openbox, its been perfect in helping me acheive a great HTPC setup! Closing this ticket.
@Nadonate do you mind running Kodi and giving me the path that it's running from? I have a bunch of specific "kodi" commands the script runs through and if it doesn't find the exact path to kodi it just runs the command kodi
, which is an issue because this isn't the true kodi executable. Its a shell script that runs the true kodi executable.
I think I usually run into a similar issue when it falls back to the kodi
command and that might be the cause, since you're having to manually kill something called kodi-x11
/usr/lib/x86_64-linux-gnu/kodi/kodi-x11
Sorry for the late response but do you mind reverting your changes and trying to add this code to line 95 of kodi-openbox-session
?
elif [ -f /usr/lib/x86_64-linux-gnu/kodi/kodi-x11 ]
then
/usr/lib/x86_64-linux-gnu/kodi/kodi-x11 &
kpid=$!
I think this should solve your problem
Ok, got around to trying this:
-
Reverted changes made to
kodi-openbox-runprogram.real
(luckily I backed up the origional) -
Added your suggestion to line 95 of
kodi-openbox-session
Happy to report the changes worked! Everything functions as expeceted; kodi closes, external app launches... when the app closes kodi is resumed.
Thanks for your help!
Hell yeah! I'll add this to the official code and close this out once I do