Kodi Community Forum

Full Version: Return to Main Menu on exit of Chrome Launcher
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi i am new to KODI.

I have setup a Main Menu Button to open the chrome browser in kiosk mode. Everything works great but when the program launches it opens the Programs Menu

so when you close Chrome you are on the Programs Menu instead of main Menu.

Is there a way to prevent from going to the Programs Menu?
Same here, like to know the solution...
I've encountered the same and fixed it by using the json-rpc api. I've got the chrome launcher addon using a custom script on my linux box. It records the current screensaver value, disables the screensaver, ensures sound is being used properly by chrome, and then when exits it restores the screensaver value and navigates back to the main menu. Here's what it looks like:
Code:
#!/bin/bash

#keepscreenalive.sh &

# get Kodi's powersave display timeout value
DSPLY_VAL=`wget --header='Content-Type: application/json' --post-data '{"jsonrpc":"2.0","method":"Settings.GetSettingValue","params":{"setting":"powermanagement.displaysoff"},"id":1}' http://localhost:8080/jsonrpc -O - -q | python -m json.tool |awk '/value/ {print $2}'`

# disable putting display to sleep when idle
wget --header='Content-Type: application/json' --post-data '{"jsonrpc":"2.0","method":"Settings.SetSettingValue","params":{"setting":"powermanagement.displaysoff","value":0},"id":1}' http://localhost:8080/jsonrpc -O - -q >/dev/null

/usr/bin/google-chrome-stable --alsa-output-device=plughw:0,1 "$@"

# restore display timeout value
wget --header='Content-Type: application/json' --post-data '{"jsonrpc":"2.0","method":"Settings.SetSettingValue","params":{"setting":"powermanagement.displaysoff","value":'$DSPLY_VAL'},"id":1}' http://localhost:8080/jsonrpc -O - -q >/dev/null

kill %1
I know this is an old post, and it might not be relevant any longer, but this was just about the only thread I could find that adresses this issue, and I've found a solution, so I thought I'd share.
Unfortunately, hindumagic's solution did not work for me, it might work for others though.

Solution:
Add these lines to your custom Chrome-script (most likely located in ".kodi/addons/plugin.program.chrome.launcher/", and might be browser.sh (default) or script.sh):
Code:
# Wait for google-chrome to be killed
CHROME_PID=$!
wait $CHROME_PID
# Return to home-screen after Chrome exits
curl -u username:password -X POST -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0", "method": "Input.Home", "id": "1"}' http://localhost:8080/jsonrpc
Replace "username" and "password" with your login to access your Kodi-client over HTTP.
NB: You have to enable "Allow remote control over HTTP" in Kodi's settings (Settings>System>Services>Webserver). It's the username and password specified here you have to put in your custom script.

You should add this after this line (or similar line) (mine enables full-screen and fixes the no-audio-bug in chrome):
Code:
# Run Chrome
/usr/bin/google-chrome --window-size=1920,1080 --window-position=0,0 --chrome-frame --alsa-output-device=plughw:0,3 "$@"

I hope this solution helps someone out, as it has been a frustration of mine for a long time now.
Another soltuion I've found, without using a script.

The issue appears to be related to the shortcut that gets created in your main menu. I'm using the reFocus skin at the moment and noticed that when I created a shortcut to Chrome Launcher's YouTube item, the button action for the shortcut was defined like this:

ActivateWindow(10001, "plugin://.....")

(where "plugin://....." has some extra stuff specifying the action to Chrome Launcher).

The solution for me was to replace "ActiavteWindow(10001, " with "PlayMedia(" like this:

PlayMedia("plugin://.....")

This fixes the issue and Chrome gets launched without navigating Kodi away from the main menu.

Hope this helps someone!
(2016-11-10, 01:52)Fr0styMatt Wrote: [ -> ]Another soltuion I've found, without using a script.

The issue appears to be related to the shortcut that gets created in your main menu. I'm using the reFocus skin at the moment and noticed that when I created a shortcut to Chrome Launcher's YouTube item, the button action for the shortcut was defined like this:

ActivateWindow(10001, "plugin://.....")

(where "plugin://....." has some extra stuff specifying the action to Chrome Launcher).

The solution for me was to replace "ActiavteWindow(10001, " with "PlayMedia(" like this:

PlayMedia("plugin://.....")

This fixes the issue and Chrome gets launched without navigating Kodi away from the main menu.

Hope this helps someone!

Elegant solution! Planning on formatting and re-installing Kodi soon, I will be sure to give your solution a try.
Fr0styMatt,

A little help with your solution please. This has been driving me crazy for months. I use the Titan skin with sub menus. I created a submenu shortcut to HBOGO, but I cant find the activate window for HBO, to use your solution. I am in the Titan skin shortcut main menu folder. Is this the correct location?

Thanks
Fr0styMatt

Your solution worked for me.

Thanks
Hi! i'd like to try the FrOstyMatt sollution but i can fing the way to edit the path?

Edit: ok, I edited the XML file and it works flawlessly. Thank you!
Please, tell what line and what xml you edit, I need this too!
Assuming you're using Kodi on a windows base system and the amber skin, you must edit this xml file:

C:\Users\HTPC\AppData\Roaming\Kodi\userdata\addon_data\skin.amber\settings.xml (where "HTPC" is your system username)

search for the code you want to edit, here it's something like ActivateWindow(10001, "plugin://.....") and simply replace it with PlayMedia("plugin://.....")

In my case it's a shortcut to launch Amazon Prime Video with chrome launcher in kiosk mode, so I replaced :

<setting id="CustomHome.3.Path" type="string">ActivateWindow(10001, &quot;plugin://plugin.program.chrome.launcher/?kiosk=yes&amp;mode=showSite&amp;stopPlayback=yes&amp;url=https%3a%2f%2fwww.primevideo.com&quot;,return)</setting>

by

<setting id="CustomHome.3.Path" type="string">PlayMedia(&quot;plugin://plugin.program.chrome.launcher/?kiosk=yes&amp;mode=showSite&amp;stopPlayback=yes&amp;url=https%3a%2f%2fwww.primevideo.com&quot;,return)</setting>
Can't wait to try this one out stunty999. It's always been a bugbear of mine, one of the very few remaining issues on my setup until it's dialled in 100%.
Cheers.
EDIT*
Just set mine for the Netflix, Stan and YouTube shortcuts. All work perfect.
Awesome!
(2018-09-20, 23:29)Megablaps Wrote: [ -> ]Can't wait to try this one out stunty999. It's always been a bugbear of mine, one of the very few remaining issues on my setup until it's dialled in 100%.
Cheers.
EDIT*
Just set mine for the Netflix, Stan and YouTube shortcuts. All work perfect.
Awesome!
 Congrats!  Now, enjoy Smile
(2018-09-24, 18:12)stunty999 Wrote: [ -> ]
(2018-09-20, 23:29)Megablaps Wrote: [ -> ]Can't wait to try this one out stunty999. It's always been a bugbear of mine, one of the very few remaining issues on my setup until it's dialled in 100%.
Cheers.
EDIT*
Just set mine for the Netflix, Stan and YouTube shortcuts. All work perfect.
Awesome!
 Congrats!  Now, enjoy Smile 

In Debian Kodi Krypton with default skin edit:
/home/HTPC/.kodi/userdata/favourites.xml (where "HTPC" is your system username)