Hi,
When I started using fluxbox, I missed this functionality in kde to be able to cycle through all the available keyboard layouts with ctrl+alt+k.
I have to generally switch between us and de (German) keyboard layouts because I can blind-type in us layout but sometimes also need the German layout.
I hope somebody will find this useful.
[EDIT]
For this you will need to create a dir ~/xkbSwitch and a file ~/.xkbSwitch/xkb_layouts which contains your keyboard layouts separated by a newline.
e.g.
Code:
us
de
Code:
#!/bin/bash
#############
# @author: Hardik
# @purpose: Cycle through the keyboard layouts sotored in
# ~/.xkbSwitch/xkb_layouts file
# This script is called on Ctrl + Alt + k key-combination in fluxbox
################
LAYOUTS_FILE=~/.xkbSwitch/xkb_layouts
INDEX_FILE=~/.xkbSwitch/index
if [ ! -r $LAYOUTS_FILE ]; then
echo "File $LAYOUTS_FILE does not exist"
exit 1
fi
# if the script is running the frist time
if [ ! -r $INDEX_FILE ]; then
echo '0' > $INDEX_FILE
fi
read line < $INDEX_FILE
let "INDEX=$line+1"
INNER_INDEX=0
while read line
do
LAYOUTS[$INNER_INDEX]=$line
let "INNER_INDEX +=1"
done <$LAYOUTS_FILE
if [ $INDEX -ge $INNER_INDEX ]; then
let "INDEX -=$INNER_INDEX"
fi
setxkbmap -layout ${LAYOUTS[$INDEX]}
if [ $? = "0" ]; then
echo $INDEX >$INDEX_FILE
echo ${LAYOUTS[$INDEX]}
fi
Please let me know about possible bugs and I will also appreciate any suggestion to improve it.
regards,
Hardik |