You are not logged in.
I was frustrated at how I had to bind a different keybinding to each layout I wanted to switch to. So I came up with a simple script which simply checks a file and changes the keyboard layout accordingly. I needed to switch between US and US International, so those are the two layouts my script checks for. However, this can easily be adapted for more than two layouts.
Here's the script:
#!/bin/bash
KEYBOARD=`cat ~/.keyboard`
test "$KEYBOARD" = "us"
RETURN=$?
if [[ $RETURN -eq 0 ]]
then
setxkbmap us intl
echo "us intl" > ~/.keyboard
exit
fi
if [[ $RETURN -eq 1 ]]
then
setxkbmap us
echo "us" > ~/.keyboard
exit
fi
To use this, you need to create the .keyboard file. So open up a terminal and type in
echo "us" > .keyboard
That's it!
To use this for more than two layouts, you would add another RETURN variable (like RETURN2) and test for equality with another of your keymaps. Then, you'd add some more test statements checking first if RETURN is true, and then if RETURN2 is true. If neither is true, you should switch to the third layout.
Now just bind this script to a keyboard shortcut in Openbox and you're good to go!
Last edited by chaanakya (2011-01-10 21:34:23)
Check out Musik - an easy-to-use text-to-music converter!
Join SpiderOak using this link and get an extra 1 GB free: https://spideroak.com/download/referral … 660e787ff1
Offline
Or you could just put something like this in /etc/default/keyboard:
XKBMODEL="pc105"
XKBLAYOUT="us,us intl"
XKBVARIANT=""
XKBOPTIONS="grp:switch,grp:alt_shift_toggle"
This allows you to change between layouts like in Windows, by pressing Alt+Right_Shift.
Offline
Oh... lol
Last edited by chaanakya (2011-01-10 22:21:46)
Check out Musik - an easy-to-use text-to-music converter!
Join SpiderOak using this link and get an extra 1 GB free: https://spideroak.com/download/referral … 660e787ff1
Offline
I'm assuming you can just change the
alt_shift_toggle
to change the keybinding?
Check out Musik - an easy-to-use text-to-music converter!
Join SpiderOak using this link and get an extra 1 GB free: https://spideroak.com/download/referral … 660e787ff1
Offline
Yes. You can find a list of options in the following file: /usr/share/X11/xkb/rules/base.lst.
Offline
Eh...oh well...at least I get the satisfaction of writing a script...
Check out Musik - an easy-to-use text-to-music converter!
Join SpiderOak using this link and get an extra 1 GB free: https://spideroak.com/download/referral … 660e787ff1
Offline
As for me I prefer this easier steps;
-go to autorun.sh (open box)
-add this line
## Start keyboard with 3 language mapping by Omen
setxkbmap -layout 'us,ua,ru' -option 'grp:alt_shift_toggle' &
That`s all.
Offline
lol...I wrote this script before I figured out there was such an option with setxkbmap
Check out Musik - an easy-to-use text-to-music converter!
Join SpiderOak using this link and get an extra 1 GB free: https://spideroak.com/download/referral … 660e787ff1
Offline
Using either
XKBLAYOUT="us,us intl"
or the setxkbmap option
setxkbmap -layout "us,us intl"
didn't work for me.
I had to use this or the equivalent with setxkbmap -variant:
XKBLAYOUT="us,us"
XKBVARIANT=",intl"
I know it's bad forum manners to answer such an old post, but I thought if I had to find this out, then it may be helpful to someone else.
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat