How to add a keybind that runs a script? - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33) +--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111) +---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52) +---- Thread: How to add a keybind that runs a script? (/showthread.php?tid=378158) |
How to add a keybind that runs a script? - jim_p - 2024-07-11 Hello everyone. I want to add a keybind that will run a script and pop a notification about the cpu's temperature inside kodi. For that purpose, I will use libreelec's built in "cputemp" command, but because I can not add/run it directly to a notification action, I made this tiny bash script that grabs it as a text and adds it there. Code: # cat test.sh After that, I have to add it to a keybind which will be avaiable everywhere, so I made this xml file Code: # cat test.xml p.s. Due to high temperatures here, I may be afk the following days, so please excuse any delays in answering. I will do my best to reply in timely manner. RE: How to add a keybind that runs a script? - jim_p - 2024-07-11 Major (or minor) update. The keybind works now! I deleted and redid everything just to be sure. However, it works only when kodi is not playing something, i.e. it works on any kodi menu but not when a video is playing. Any ideas why? RE: How to add a keybind that runs a script? - jim_p - 2024-07-12 As it seems, on video playback, "t" toggels the subtitles visibility (I knew that already) and it does not care if i longpress it or not, it still does that action. Is there a key (a letter prefferably) which is not bound to any action? RE: How to add a keybind that runs a script? - Jogee - 2024-07-12 Keyboard controls are noted in the Wiki - Keyboard_controls (wiki) Note that some are Global, and some just specific to a particular section. As an alternative, you may want to consider doing and ALT or CTRL mod with T. RE: How to add a keybind that runs a script? - jim_p - 2024-07-15 I knew that page, I even have it in my bookmarks. I tried setting "g" (single press, not longpress) for the job which works everywhere but the pvr menu. It also froze kodi and I had to close the system from the power button. And this is where I gave up with the keybinds and made this. Here is a script, which is run by a systemd service, which in turn runs every 5 minutes via a systemd timer. The script checks if the cpu temperature is above 75C and if it is, it just stops any playback, mentions the temperature it has reached and shutdowns the system via a kodi action. It goes without saying that the (advanced linux) who plans to use it will have to find the right device under /sys/class/hwmon and that cputemp is a command which exists as built in only in *elecs. The 1 minute delay for the start of the service is there because le's systemd was complaining that it could not start it properly. Code: # cat /storage/toohot.sh Code: # cat /storage/.config/system.d/toohot.service Code: # cat /storage/.config/system.d/toohot.timer |