Kodi Community Forum

Full Version: [RELEASE] Steam Launcher - Start Steam Big Picture Mode from within Kodi
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
(2021-01-31, 06:24)teeedubb Wrote: [ -> ]
(2021-01-29, 18:26)LupinSansei Wrote: [ -> ]
(2021-01-29, 13:26)teeedubb Wrote: [ -> ]You can use wmctrl to achieve this, it's what I use to force focus in the add-on.

Awesome! Can you tell me how to do it? I don't see an option anywhere in the add-on settings. Sorry if I'm being a pain here.

Oh I thought you meant outside of the Kodi add-on. When exactly is Kodi losing focus? IIRC the add-on already forces focus on Kodi and certain points.
Steam's desktop ui pops up over Kodi after exiting BPM usually forcing me to have to a grab a mouse and minimize Steam's desktop ui if that makes sense? It's weird because in Windows this never happens.
(2021-01-31, 23:28)LupinSansei Wrote: [ -> ]
(2021-01-31, 06:24)teeedubb Wrote: [ -> ]
(2021-01-29, 18:26)LupinSansei Wrote: [ -> ]Awesome! Can you tell me how to do it? I don't see an option anywhere in the add-on settings. Sorry if I'm being a pain here.

Oh I thought you meant outside of the Kodi add-on. When exactly is Kodi losing focus? IIRC the add-on already forces focus on Kodi and certain points.
Steam's desktop ui pops up over Kodi after exiting BPM usually forcing me to have to a grab a mouse and minimize Steam's desktop ui if that makes sense? It's weird because in Windows this never happens.

From the sounds of it, you are not quitting kodi and not minimizing it when bpm is launched, exiting bpm to the desktop ui, kodi displays, then the steam desktop ui? If so, unless something has changed with steam on linux, there isnt much I can do because I cant find a way to detect when bpm is closed to the desktop ui, minimised or loses focus. Because of this limitation, the best way to use the addon on linux is to always quit steam when you want to go back to kodi.
(2021-02-01, 14:14)teeedubb Wrote: [ -> ]
(2021-01-31, 23:28)LupinSansei Wrote: [ -> ]
(2021-01-31, 06:24)teeedubb Wrote: [ -> ]Oh I thought you meant outside of the Kodi add-on. When exactly is Kodi losing focus? IIRC the add-on already forces focus on Kodi and certain points.
Steam's desktop ui pops up over Kodi after exiting BPM usually forcing me to have to a grab a mouse and minimize Steam's desktop ui if that makes sense? It's weird because in Windows this never happens.

From the sounds of it, you are not quitting kodi and not minimizing it when bpm is launched, exiting bpm to the desktop ui, kodi displays, then the steam desktop ui? If so, unless something has changed with steam on linux, there isnt much I can do because I cant find a way to detect when bpm is closed to the desktop ui, minimised or loses focus. Because of this limitation, the best way to use the addon on linux is to always quit steam when you want to go back to kodi.
Yeah, that's what I'm experiencing. I also thought about just exiting Steam like you mentioned. I might just start doing that. I appreciate the help and sorry for cluttering up the thread with this nonsense Rofl
(2021-02-01, 21:54)LupinSansei Wrote: [ -> ]
(2021-02-01, 14:14)teeedubb Wrote: [ -> ]
(2021-01-31, 23:28)LupinSansei Wrote: [ -> ]Steam's desktop ui pops up over Kodi after exiting BPM usually forcing me to have to a grab a mouse and minimize Steam's desktop ui if that makes sense? It's weird because in Windows this never happens.

From the sounds of it, you are not quitting kodi and not minimizing it when bpm is launched, exiting bpm to the desktop ui, kodi displays, then the steam desktop ui? If so, unless something has changed with steam on linux, there isnt much I can do because I cant find a way to detect when bpm is closed to the desktop ui, minimised or loses focus. Because of this limitation, the best way to use the addon on linux is to always quit steam when you want to go back to kodi.
Yeah, that's what I'm experiencing. I also thought about just exiting Steam like you mentioned. I might just start doing that. I appreciate the help and sorry for cluttering up the thread with this nonsense Rofl

All good mate. If you work out how to detect the differences in steam windows let me know
(2021-02-02, 11:43)teeedubb Wrote: [ -> ]
(2021-02-01, 21:54)LupinSansei Wrote: [ -> ]
(2021-02-01, 14:14)teeedubb Wrote: [ -> ]From the sounds of it, you are not quitting kodi and not minimizing it when bpm is launched, exiting bpm to the desktop ui, kodi displays, then the steam desktop ui? If so, unless something has changed with steam on linux, there isnt much I can do because I cant find a way to detect when bpm is closed to the desktop ui, minimised or loses focus. Because of this limitation, the best way to use the addon on linux is to always quit steam when you want to go back to kodi.
Yeah, that's what I'm experiencing. I also thought about just exiting Steam like you mentioned. I might just start doing that. I appreciate the help and sorry for cluttering up the thread with this nonsense Rofl

All good mate. If you work out how to detect the differences in steam windows let me know

Hi, there's a way to do that with wlrctl for wlroots based compositors that implement the foreign-toplevel-management protocol. Since I'm on sway which doesn't support the concept of minimizing/maximizing this may not be of any help. Which brings me to my actual issue...
Since Kodi 19 there are no more separate binaries for Wayland and X11. This can (in my case) lead to unwanted behaviour: When I explicitly start kodi in X11 mode via kodi --windowing=x11 (I have reasons...), launch steam from the addon (which shuts down kodi) and exit steam afterwards (which launches kodi) my original preference on the rendering backend is ignored (which means kodi is being started on Wayland).

I crawled through steam-launcher.sh; the way it currently works it cannot distinguish between X11 and Wayland anymore by the name of the binary. To solve this it could instead take into account any command line arguments and recycle them later appropirately. In line 63 where $KODI_BIN is defined ps aux could be extended to find command line parameters, maybe with -o args. I'm not too much into bash magic, so I guess that's all the help I can give.

Alternatively you could implement an option in the addon settings which lets the user set command line arguments for kodi as is already there for the steam executable.

I would appreciate if you considered and took a look into this issue. I'd gladly file an issue on your GitHub repo if you wish.
(2021-03-08, 15:49)hemmschuh Wrote: [ -> ]Since Kodi 19 there are no more separate binaries for Wayland and X11. This can (in my case) lead to unwanted behaviour: When I explicitly start kodi in X11 mode via kodi --windowing=x11 (I have reasons...), launch steam from the addon (which shuts down kodi) and exit steam afterwards (which launches kodi) my original preference on the rendering backend is ignored (which means kodi is being started on Wayland).

I crawled through steam-launcher.sh; the way it currently works it cannot distinguish between X11 and Wayland anymore by the name of the binary. To solve this it could instead take into account any command line arguments and recycle them later appropirately. In line 63 where $KODI_BIN is defined ps aux could be extended to find command line parameters, maybe with -o args. I'm not too much into bash magic, so I guess that's all the help I can give.

Alternatively you could implement an option in the addon settings which lets the user set command line arguments for kodi as is already there for the steam executable.

I would appreciate if you considered and took a look into this issue. I'd gladly file an issue on your GitHub repo if you wish.

I agree that this is something that the addon should do amd I'll add the functionality in the next release.
(2021-03-08, 15:08)hemmschuh Wrote: [ -> ]
(2021-02-02, 11:43)teeedubb Wrote: [ -> ]
(2021-02-01, 21:54)LupinSansei Wrote: [ -> ]Yeah, that's what I'm experiencing. I also thought about just exiting Steam like you mentioned. I might just start doing that. I appreciate the help and sorry for cluttering up the thread with this nonsense Rofl

All good mate. If you work out how to detect the differences in steam windows let me know

Hi, there's a way to do that with wlrctl for wlroots based compositors that implement the foreign-toplevel-management protocol. Since I'm on sway which doesn't support the concept of minimizing/maximizing this may not be of any help. Which brings me to my actual issue...
I currently dont have a wayland install but wen I get one I'll check wlctrl out. Thanks!
Hey @teeedubb .

Would it be possible to add an option to turn off the "LibCEC peripheral device" before either minimizing or quitting Kodi and starting Steam.
And of course enable the device again ones Kode maximizes or starts up again.

The reason for this, is I use LibCEC to turn off the TV when the screensaver starts or if Kodi quits (PC shutsdown). This collides with the Steam plugin.

If it quits Kodi the TV turns off.
If it minimizes Kodi, the TV will shutdown when the Kodi screensaver starts (and each time you turn on the TV again to use Steam, it will turn off the TV again ones the screensaver starts again)

An alternative could be to disable the screensaver while Kodi is minimized and Steam is running?
(2021-03-19, 19:43)tannyl Wrote: [ -> ]Hey @teeedubb .

Would it be possible to add an option to turn off the "LibCEC peripheral device" before either minimizing or quitting Kodi and starting Steam.
And of course enable the device again ones Kode maximizes or starts up again.

The reason for this, is I use LibCEC to turn off the TV when the screensaver starts or if Kodi quits (PC shutsdown). This collides with the Steam plugin.

If it quits Kodi the TV turns off.
If it minimizes Kodi, the TV will shutdown when the Kodi screensaver starts (and each time you turn on the TV again to use Steam, it will turn off the TV again ones the screensaver starts again)

An alternative could be to disable the screensaver while Kodi is minimized and Steam is running?

I think this would be better suited in the pre/post steam scripts via jsonrpc.
This thread has info on how to disable/enable the screensaver. In my brief search I couldn't find anything on how to disable/enable cec, so you'll need to do some digging or post a thread asking for help.

https://forum.kodi.tv/showthread.php?tid=354784
(2021-03-20, 00:14)teeedubb Wrote: [ -> ]
(2021-03-19, 19:43)tannyl Wrote: [ -> ]Hey @teeedubb .

Would it be possible to add an option to turn off the "LibCEC peripheral device" before either minimizing or quitting Kodi and starting Steam.
And of course enable the device again ones Kode maximizes or starts up again.

The reason for this, is I use LibCEC to turn off the TV when the screensaver starts or if Kodi quits (PC shutsdown). This collides with the Steam plugin.

If it quits Kodi the TV turns off.
If it minimizes Kodi, the TV will shutdown when the Kodi screensaver starts (and each time you turn on the TV again to use Steam, it will turn off the TV again ones the screensaver starts again)

An alternative could be to disable the screensaver while Kodi is minimized and Steam is running?

I think this would be better suited in the pre/post steam scripts via jsonrpc.
This thread has info on how to disable/enable the screensaver. In my brief search I couldn't find anything on how to disable/enable cec, so you'll need to do some digging or post a thread asking for help.

https://forum.kodi.tv/showthread.php?tid=354784

I had tried looking into this, using the pre/post scripts, but did not get that far due to having kids that demand attention. Big Grin Smile

Is there any way to store a variable in the pre script and later retrieve that variable in the post script? (other then just writing to a file, which I guess would be an option)

I would like to be able to save the selected screensaver settings before disabling them in the pre script, and then restore them in the post script.

Otherwise I have to hardcode the settings into the post script, and remember to change them, if ever the screensaver settings are changed in Kodi.
(2021-03-20, 09:26)tannyl Wrote: [ -> ]
(2021-03-20, 00:14)teeedubb Wrote: [ -> ]
(2021-03-19, 19:43)tannyl Wrote: [ -> ]Hey @teeedubb .

Would it be possible to add an option to turn off the "LibCEC peripheral device" before either minimizing or quitting Kodi and starting Steam.
And of course enable the device again ones Kode maximizes or starts up again.

The reason for this, is I use LibCEC to turn off the TV when the screensaver starts or if Kodi quits (PC shutsdown). This collides with the Steam plugin.

If it quits Kodi the TV turns off.
If it minimizes Kodi, the TV will shutdown when the Kodi screensaver starts (and each time you turn on the TV again to use Steam, it will turn off the TV again ones the screensaver starts again)

An alternative could be to disable the screensaver while Kodi is minimized and Steam is running?

I think this would be better suited in the pre/post steam scripts via jsonrpc.
This thread has info on how to disable/enable the screensaver. In my brief search I couldn't find anything on how to disable/enable cec, so you'll need to do some digging or post a thread asking for help.

https://forum.kodi.tv/showthread.php?tid=354784

I had tried looking into this, using the pre/post scripts, but did not get that far due to having kids that demand attention. Big Grin Smile

Is there any way to store a variable in the pre script and later retrieve that variable in the post script? (other then just writing to a file, which I guess would be an option)

I would like to be able to save the selected screensaver settings before disabling them in the pre script, and then restore them in the post script.

Otherwise I have to hardcode the settings into the post script, and remember to change them, if ever the screensaver settings are changed in Kodi.

I personally would use a file to store the variable.
(2021-03-20, 23:37)teeedubb Wrote: [ -> ]
(2021-03-20, 09:26)tannyl Wrote: [ -> ]
(2021-03-20, 00:14)teeedubb Wrote: [ -> ]I think this would be better suited in the pre/post steam scripts via jsonrpc.
This thread has info on how to disable/enable the screensaver. In my brief search I couldn't find anything on how to disable/enable cec, so you'll need to do some digging or post a thread asking for help.

https://forum.kodi.tv/showthread.php?tid=354784

I had tried looking into this, using the pre/post scripts, but did not get that far due to having kids that demand attention. Big Grin Smile

Is there any way to store a variable in the pre script and later retrieve that variable in the post script? (other then just writing to a file, which I guess would be an option)

I would like to be able to save the selected screensaver settings before disabling them in the pre script, and then restore them in the post script.

Otherwise I have to hardcode the settings into the post script, and remember to change them, if ever the screensaver settings are changed in Kodi.

I personally would use a file to store the variable.

I figured out why I was having problems getting things to work.

I expected the the "pre" and "post" scripts was python scripts run inside Kodi, but now I see that is not the case.
(2021-03-22, 22:15)tannyl Wrote: [ -> ]
(2021-03-20, 23:37)teeedubb Wrote: [ -> ]
(2021-03-20, 09:26)tannyl Wrote: [ -> ]I had tried looking into this, using the pre/post scripts, but did not get that far due to having kids that demand attention. Big Grin Smile

Is there any way to store a variable in the pre script and later retrieve that variable in the post script? (other then just writing to a file, which I guess would be an option)

I would like to be able to save the selected screensaver settings before disabling them in the pre script, and then restore them in the post script.

Otherwise I have to hardcode the settings into the post script, and remember to change them, if ever the screensaver settings are changed in Kodi.

I personally would use a file to store the variable.

I figured out why I was having problems getting things to work.

I expected the the "pre" and "post" scripts was python scripts run inside Kodi, but now I see that is not the case.
Looking at the code the pre/post script are executed by just running the full path to the file, so I guess python scripts should work if you can run them from the command line by just using the filename, but from memory I have never tested it with a python script, only bash at batch files.
(2021-03-26, 10:23)teeedubb Wrote: [ -> ]
(2021-03-22, 22:15)tannyl Wrote: [ -> ]
(2021-03-20, 23:37)teeedubb Wrote: [ -> ]I personally would use a file to store the variable.

I figured out why I was having problems getting things to work.

I expected the the "pre" and "post" scripts was python scripts run inside Kodi, but now I see that is not the case.
Looking at the code the pre/post script are executed by just running the full path to the file, so I guess python scripts should work if you can run them from the command line by just using the filename, but from memory I have never tested it with a python script, only bash at batch files.
Yes, I can run python scripts that way (or run a batch file that then runs the python), and that is what I am doing now. But sadly this all seems to be for nothing.

Also, to run the python code, I need to install Python3 on the PC as well, since Kodi does not (afaik) allow external scripts to use its version of the Python interpreter.

Anyway.. I can now change the screensaver and change it back when Steam stops. But sadly the TV still gets turned off after the screensaver time has passed while Steam is running. It setting the screensaver to "None" via JSON-RPC is not enough to get the "CEC adapter code" to stop trying to power off the TV when it "thinks" the screensaver starts. I guess more testing is needed.