Release Keyboard layout changer


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:
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
 
Hmm.. I get an empty box?

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.
 
Hmm.. I get an empty box?

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.

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>
 
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.
 
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.

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.
 
Then it's just a matter of adding a line of modmap to make it happen (and possibly one to restore)
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:
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.
 
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.
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:


O96Pu.gif



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


Also...

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

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:
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:
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:
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?
 
Back
Top