You are not logged in.
I suspect the following script is not exporting the DEADKS environment variable I need for it to function properly. I'm running it from a urxvt terminal:
#!/bin/bash
# ~/bin/deadkeys_switch
# Switch dead keys on/off
if [ -z "${DEADKS+x}" ]; then
export DEADKS="1"
fi
if [ "$DEADKS" = "1" ]; then
DEADKS="0"
xmodmap -e "keycode 35 = acute grave dead_acute dead_grave dead_tilde dead_macron"
xmodmap -e "keycode 51 = asciitilde asciicircum dead_tilde dead_circumflex dead_grave dead_breve"
else
DEADKS="1"
xmodmap -e "keycode 35 = dead_acute dead_grave dead_acute dead_grave dead_tilde dead_macron"
xmodmap -e "keycode 51 = dead_tilde dead_circumflex dead_tilde dead_circumflex dead_grave dead_breve"
fi
export DEADKS
Once I run it the first time, I manage to disable deadkeys as I intended (most certainly because of the first check). But running it again does not re-enable them as I would like to. On the command prompt running the following command produces a null output:
echo $DEADKS
What am I doing wrong?
Last edited by marfig (2010-08-25 03:02:41)
I probably made this post longer than it should only because I lack the time to make it shorter.
- Paraphrased from Blaise Pascal
Offline
I have changed my script to this:
#!/bin/bash
# ~/bin/deadkeys_switch
# Switch dead keys on/off
if [ -n "${DEADKS-x}" ]; then
export DEADKS="1"
fi
if [ "$DEADKS" = "1" ]; then
dks="0"
xmodmap -e "keycode 35 = acute grave dead_acute dead_grave dead_tilde dead_macron"
xmodmap -e "keycode 51 = asciitilde asciicircum dead_tilde dead_circumflex dead_grave dead_breve"
else
dks="1"
xmodmap -e "keycode 35 = dead_acute dead_grave dead_acute dead_grave dead_tilde dead_macron"
xmodmap -e "keycode 51 = dead_tilde dead_circumflex dead_tilde dead_circumflex dead_grave dead_breve"
fi
export DEADKS=$dks
And this is the output from debug mode, no matter how many times I run it:
+ '[' -n x ']'
+ export DEADKS=1
+ DEADKS=1
+ '[' 1 = 1 ']'
+ dks=0
+ xmodmap -e 'keycode 35 = acute grave dead_acute dead_grave dead_tilde dead_macron'
+ xmodmap -e 'keycode 51 = asciitilde asciicircum dead_tilde dead_circumflex dead_grave dead_breve'
+ export DEADKS=0
+ DEADKS=0
I probably made this post longer than it should only because I lack the time to make it shorter.
- Paraphrased from Blaise Pascal
Offline
Source that file.
#!/bin/bash
# ~/test/keys
DEADKS="0"
export DEADKS
[karol@black test]$ echo $DEADKS
[karol@black test]$ . keys
[karol@black test]$ echo $DEADKS
0
Last edited by karol (2010-08-25 02:57:33)
Offline
Oh, thank you Karol. That solves it
Kind of a bummer, though. Having to do it every time i need to run it. But not a big problem.
Thank you once again.
I probably made this post longer than it should only because I lack the time to make it shorter.
- Paraphrased from Blaise Pascal
Offline
Can you put it in your .bashrc
foo () { ~/test/keys && . ~/test/keys; }
?
Offline
Well, I intend to run it only on demand. I'm planning something similar and wrap it around a launcher script.
EDIT: I understand your suggestion now, karol. I didn't know I could do that. Thanks. It's ideal.
Last edited by marfig (2010-08-25 03:40:14)
I probably made this post longer than it should only because I lack the time to make it shorter.
- Paraphrased from Blaise Pascal
Offline