How to create a programmable button on Home
#1
Sad 
Hi all,

I'm new to kodi and I'm writing a service add-on to track my user's login/logout behavior. After several days' struggle, all the other things are up and working. Except that I need to put a "Logout" button on the Home screen.

I've tried various things with no luck:
  • The target of onClick event of a Button can only be one of the built-ins;
  • e.g. I'm able to create an RPC server by service and use RunScript(some_script) to trigger it however this is too awkward;
  • Or go to some built-in events (e.g. Screensaver), however this is also too awkward;
  • I even tried to hook the onClick / onControl events of the Window(10000), however the C++ exported class cannot be modified(i.e. hooked) as usual;
  • etc.
I'm afraid that I was missing something easy. So I'm asking for help on creating a "programmable" button on the GUI which is able to trigger a function / event in the service elegantly.

BTW, I also tried to employ shutdown / logout events without going to a custom event. Neither of them could fit my requirement.

Any helps are greatly appreciated.
Reply
#2
I think it can be done by modifying the respective XML file of your preferred skin.
Reply
#3
imo, it depends on what skin you are using, there are some skins that enable you to add any script/plugin as menu/shortcut etc, then that would make it trivial for you by making plugin or script with parameters. but if you are looking for more universal solution you could go with favorite road, which is similar as plugin/script but are located in your favorites. Also Kodi support Profiles -by adding profile you will have log off function in "power off" menu.
Reply

Logout Mark Read Team Forum Stats Members Help
How to create a programmable button on Home0