Release Keyboard layout changer

Discussion in 'Software Releases' started by slaeshjag, Mar 18, 2011.

  1. slaeshjag

    slaeshjag ¯\_(ツ)_/¯

    Joined:
    Apr 8, 2010
    Messages:
    2,687
    Location:
    ~Stockholm, Sweden
    Made a quick zenity hack to easily change keyboard layout when using external keyboards.


    When restoring to the pandoras internal keyboards layout, it uses the pndXmodmap in your home directory. It shoudn't write to NAND.


    I only included scripts for US-qwerty, Swedish-qwerty and German-qwertz, but you can easily add your own (look at the ones saved in appdata/kblayout/keymaps)


    The scripts are nothing fancy, they just call a included setxkbmap with specified layout settings.


    It shouldn't re-add default ones or overwrite the default ones unless the default pandora one is removed.


    Dunno why a GUI isn't included on the firmware for this, but I was to lazy to look for one, so there could be better ways to do this a opkg install away.


    If you find it useful and create a script for your own layout, just paste it here and I'll include it in case I release this as final.


    Shows up in Settings as Keyboard Layout.


    »» Download ««
     
    Last edited by a moderator: Jun 29, 2011
    Tags:
  2. Esn

    Esn (:";

    Joined:
    Mar 5, 2003
    Messages:
    3,239
    Location:
    Toronto, Canada
    Will this work for changing the layout of the Pandora's own keyboard, or is it only for connecting external keyboards?
     
  3. slaeshjag

    slaeshjag ¯\_(ツ)_/¯

    Joined:
    Apr 8, 2010
    Messages:
    2,687
    Location:
    ~Stockholm, Sweden
    It's changing for the entire X11-session, that's why there is a option to change back to the pandoras default layout.
     
  4. Eight Bit

    Eight Bit Advanced Member

    Joined:
    Nov 16, 2008
    Messages:
    1,570
    Location:
    Amsterdam, Netherlands
    Hmm.. I get an empty box?
     
  5. slaeshjag

    slaeshjag ¯\_(ツ)_/¯

    Joined:
    Apr 8, 2010
    Messages:
    2,687
    Location:
    ~Stockholm, Sweden
    Please paste output from /tmp/pndrun_kblayout.out
     
  6. mhadf

    mhadf Member

    Joined:
    Jun 23, 2009
    Messages:
    172
    Quick question,


    Does it let you remap the pandora controls too?
     
  7. slaeshjag

    slaeshjag ¯\_(ツ)_/¯

    Joined:
    Apr 8, 2010
    Messages:
    2,687
    Location:
    ~Stockholm, Sweden
    Not really, if you know how to write scripts that does, you can make it do that. But otherwhise, it's just a fancy wrapper around setxkbmap
     
  8. cube48

    cube48 Member

    Joined:
    Oct 6, 2008
    Messages:
    283
    Location:
    Germany + Czech Republic
    I had the same problem.


    This is what I did to solve it:

    1. Start the Keyboard layout PND from menu Settings (this will mount the PND)
    2. Copy all files from "/mnt/utmp/kblayout/presets/" to "/media/NAME_OF_YOUR_CARD/pandora/appdata/kblayout/keymaps/"
    3. Create your own keymap if needed. I wanted to have Czech keyboard but the default command as it is in other presets didn't work for me -> "./setxkbmap -layout cz". So I changed it to "./setxkbmap cz" (skipped "-layout") and that made the trick.



    In the PND, there is a script which checks if the "keymaps" folder is existing, if not it tries to create it and then tries to copy the content of "presets" folder to "keymaps" folder (both part of PND). This was not happening, from some reason mkdir didn't work.
     
  9. Esn

    Esn (:";

    Joined:
    Mar 5, 2003
    Messages:
    3,239
    Location:
    Toronto, Canada
    Is there any special reason why it wouldn't? They do have keycodes...


    http://pandorawiki.org/Keyboard#Keycodes
     
  10. slaeshjag

    slaeshjag ¯\_(ツ)_/¯

    Joined:
    Apr 8, 2010
    Messages:
    2,687
    Location:
    ~Stockholm, Sweden
    Then it's just a matter of adding a line of modmap to make it happen (and possibly one to restore)
     
  11. DragonFang

    DragonFang Still Fresh

    Joined:
    May 18, 2011
    Messages:
    13
    Thanks, I had the same problem :)


    slaeshjag: Could you fix the script? <swedish banter> Vore grymt bra, jag diggar ditt program, tack! :D </swedish banter>
     
  12. slaeshjag

    slaeshjag ¯\_(ツ)_/¯

    Joined:
    Apr 8, 2010
    Messages:
    2,687
    Location:
    ~Stockholm, Sweden
    I'll look into it when I got my pandora back. Would be great if anyone can find out *why* mkdir fails, I've neverr encountered this problem myself.
     
  13. Neelix

    Neelix Insecticidal Maniac

    Joined:
    Jan 8, 2011
    Messages:
    3,209
    Location:
    Melbourne, Australia
    Probably because as an existing folder in the PND, the folder already exists within the union, which is where the run script is trying to create it. I seem to recall seeing something in the wiki about using the no-clobber flag... not sure if that would work or not - haven't tried it. That being said, my understanding is that this issue should hopefully be fixed in HF6.
     
  14. Esn

    Esn (:";

    Joined:
    Mar 5, 2003
    Messages:
    3,239
    Location:
    Toronto, Canada
    I have no idea what this means, sadly... for now, my question is this: is it possible to make my own custom keymap for the Pandora's controls? Let's say I want to make one for Russian, for example. If so, where would I put it so that the program will see it? Where are the existing ones stored? Somewhere on the NAND I assume, but where exactly?


    Also, is it possible to create a keyboard shortcut that will let me switch between the default layout and an alternate one?


    Also, (I know this is a bit farfetched) in the future, would it be possible to integrate this with Caine's Nub configuration utility? It just seems logical that Pandora controls should be configured in one place.
     
    Last edited by a moderator: Feb 6, 2016
  15. slaeshjag

    slaeshjag ¯\_(ツ)_/¯

    Joined:
    Apr 8, 2010
    Messages:
    2,687
    Location:
    ~Stockholm, Sweden
    The "layouts" themself are just shellscripts. You can make it blow up your battery or download the internet if you want to. If you can express it all in shellscript, this layout changer can do it. Scripts are stored in appdata/kblayout/keymaps. You can make it apply a full russian layout and then add a xmodmap on that to fine tune some keycodes.


    In build 2 (on the repo), that folder is removed from the PND, so it should work now.
     
  16. Esn

    Esn (:";

    Joined:
    Mar 5, 2003
    Messages:
    3,239
    Location:
    Toronto, Canada
    Ok, so... hypothetically, what would the contents of a file like that look like? I looked inside appdata/kblayout/keymaps, and all the files that are in there now seem to point somewhere else; they don't have any "keycode 17 = xxx" lines inside.


    If I'm understanding you right, and I may well not be because I'm a newbie at this and your explanations aren't very newbie-friendly, it is possible to create a text file of some sort, place it inside the folder appdata/kblayout/keymaps, and I can then select that option in the Keyboard layout changer and make the Pandora keys do whatever I want them to do, if the file is properly-written. Where can I see an example of what the contents of a text file like that might look like?


    The particular layout I'd want would be a custom one that applies Russian letters mostly to their phonetic English equivalents, something like this:


    [​IMG]


    I'd want to assign some letters to the ABXY buttons.


    Also...

    That's what I have set up in Windows. I type in English on one website, then go to another site, press a key combination, and I can now type in Russian. Can something similar be done in Linux?


    So basically, my two main questions are:


    1. Where can I see an example of what a custom file that would go in appdata/kblayout/keymaps looks like?


    2. Can a keyboard shortcut be created to switch between keyboard layouts?
     
    Last edited by a moderator: Jun 16, 2011
  17. slaeshjag

    slaeshjag ¯\_(ツ)_/¯

    Joined:
    Apr 8, 2010
    Messages:
    2,687
    Location:
    ~Stockholm, Sweden
    Open ~/.pndXmodmap in a text editor (hidden file), that's a list of keycode changes specific for the pandora keyboard. If you google around a bit (something about xmodmap scancodes i think) you can find a list of what all keys name are. The shellscripts for the included layouts calls up predefined layouts that ships with the device.


    It's possible to bind it to a hotkey, yes. But don't ask me how, I've never done it.
     
    Last edited by a moderator: Jun 16, 2011
  18. Esn

    Esn (:";

    Joined:
    Mar 5, 2003
    Messages:
    3,239
    Location:
    Toronto, Canada
    If you've never done it, how do you know it can be done? Have you seen or heard of anyone else doing it? Can you, perhaps, give me some tips on what to Google for so I can find instructions?
     
  19. slaeshjag

    slaeshjag ¯\_(ツ)_/¯

    Joined:
    Apr 8, 2010
    Messages:
    2,687
    Location:
    ~Stockholm, Sweden
    I've seen people binding hotkeys to taking screenshots etc, and this layout changer can be runned the same way. So searching on that could be a start.
     
    Last edited by a moderator: Jun 16, 2011
  20. MarioPandio

    MarioPandio Well-Known Member

    Joined:
    Aug 28, 2010
    Messages:
    1,378
    Location:
    Half way up the stair
    If the layout changer appears in usr/share/applications then right click it there>properties>launcher and copy the command for it. Open the settings>keyboard>ApplicationShortcuts tab then click ADD and paste in the command you copied. Then apply a shortcut keys of your choosing and ok it. Test. Job done.


    If it doesn't show up in usr/share/applications then I don't know. Perhaps theres a PND run type argument that could be used as the command for the keyboard shortcuts field?
     

Share This Page

Loading...