Kodi Community Forum
Solved Key map - 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: OS independent / Other (https://forum.kodi.tv/forumdisplay.php?fid=228)
+---- Thread: Solved Key map (/showthread.php?tid=353803)



Key map - Chris230291 - 2020-04-23

Hi can anyone see why this doesn't work for me?
I want the |<< and >>| buttons on my remote to switch channel groups in the guide.

According to the Wiki this is the |<< and >>| buttons...
Quote:. period Skip forward
, comma Skip backward
The commands to switch channel groups are...
Quote:NextChannelGroup
PreviousChannelGroup
This is what I have in .kodi/userdata/keymaps/epg.xml
Quote:<keymap>
   <tvguide>
      <keyboard>
         <.>NextChannelGroup</.>
         <,>PreviousChannelGroup</,>
      </keyboard>
   </tvguide>
</keymap>

Cheers
Chris


RE: Key map - DarrenHill - 2020-04-24

You need <comma> and <period>, not <,> and <.> (and their mirror closing tags of course).

Try that and see if it works for you.


RE: Key map - jjd-uk - 2020-04-24

Further to what Darren wrote, a copy of the default system keymap that comes in Kodi can be found at https://github.com/xbmc/xbmc/blob/master/system/keymaps/keyboard.xml so that can be used as a guide to check syntax and how keys should be represented.


RE: Key map - Chris230291 - 2020-04-24

(2020-04-24, 09:09)DarrenHill Wrote: You need <comma> and <period>, not <,> and <.> (and their mirror closing tags of course).

Try that and see if it works for you.

Thanks guys.
I got it working with this...
Quote:<keymap>
   <tvguide>
      <keyboard>
         <period>NextChannelGroup</period>
         <comma>PreviousChannelGroup</comma>
      </keyboard>
   </tvguide>
</keymap>
Will this be universal and work on all platforms?

Chris


Key map - DarrenHill - 2020-04-24

It should be yes. Obviously will need a device with a keyboard input, but it should be generic.

Thread marked solved.


RE: Key map - Chris230291 - 2020-04-24

(2020-04-24, 15:18)DarrenHill Wrote: It should be yes. Obviously will need a device with a keyboard input, but it should be generic.

Thread marked solved.

Is there a way to remap the action rather than the key? So it would be completely universal


RE: Key map - DarrenHill - 2020-04-24

No, the keymaps are by definition for keys and for other similar inputs.

In some cases even remotes appear to Kodi as keyboards and send their button presses as keystrokes, but for other items they send input actions such as "select" or "playpause" etc corresponding to the relevant button push or whatever.

Have a look at the link below which are all of the default keymaps for the different input methods:

https://github.com/xbmc/xbmc/tree/master/system/keymaps

You can see there how it links the input action to the Kodi action, but you can't universally assign the Kodi action other than by defining each of the different input actions (which can also be default or active window dependent, so the same input can send different action commands depending on which Kodi window has focus).


RE: Key map - Chris230291 - 2020-04-24

(2020-04-24, 17:18)DarrenHill Wrote: No, the keymaps are by definition for keys and for other similar inputs.

In some cases even remotes appear to Kodi as keyboards and send their button presses as keystrokes, but for other items they send input actions such as "select" or "playpause" etc corresponding to the relevant button push or whatever.

Have a look at the link below which are all of the default keymaps for the different input methods:

https://github.com/xbmc/xbmc/tree/master/system/keymaps

You can see there how it links the input action to the Kodi action, but you can't universally assign the Kodi action other than by defining each of the different input actions (which can also be default or active window dependent, so the same input can send different action commands depending on which Kodi window has focus).

Right OK.
Looking at those files I think the only ones I need are keyboard and remote.
Should this work?
Quote:<keymap>
    <tvguide>
        <keyboard>
            <period>NextChannelGroup</period>
            <comma>PreviousChannelGroup</comma>
        </keyboard>
        <remote>
            <skipplus>NextChannelGroup</skipplus>
            <skipminus>PreviousChannelGroup</skipminus>
        </remote>
    </tvguide>
</keymap>



RE: Key map - DarrenHill - 2020-04-25

<tvguide> I think should be <TVGuide> (I'm not 100% sure if the keymaps are case sensitive or not) along with it's reciprocal closing tag, but aside from that it looks OK to me.

The keymaps for different inputs (keyboard, remote etc) are fine to merge together into one file. They're only split into separate files in the official repo for clarity.

What happens is the keymaps are loaded in alphabetical order (based on their filename, as long as all are valid xml files), with anything in later loaded maps overwriting duplicate tags in earlier loaded ones. Similarly all the default keymaps are loaded before the user ones, so that the user ones can be used to update and modify the default ones without having to actually change the default files.