Skip to content

Commit

Permalink
Improve start/stop shell scripts
Browse files Browse the repository at this point in the history
Fix the wrong remapping. The full definition of keycode 65 is reassigned
to keycode 255. control is now fully reinitialized.
  • Loading branch information
Renaud AUBIN committed Mar 10, 2012
1 parent 9a9a65a commit f396af6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions start_Space2Ctrl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
origmap=$(xmodmap -pke | grep -E "^keycode[[:blank:]]*?65")
echo ${origmap} > ~/.Space2Ctrl.backup

newmap=$(echo ${origmap} | perl -pe "s/[[:blank:]]*?=[[:blank:]]*?space/ = Control_L/")
newmap=$(echo ${origmap} | perl -pe "s/65[[:blank:]]*?=[[:blank:]]*?space/255 = space/")
echo $newmap
xmodmap -e "$newmap"
xmodmap -e "keycode 65 = Control_L"
xmodmap -e "add control = Control_L"
xmodmap -e "keycode 255 = space"

nohup ./Space2Ctrl >> ~/.Space2Ctrl.log 2>&1 &
echo $! > ~/.Space2Ctrl.pid
Expand Down
5 changes: 4 additions & 1 deletion stop_Space2Ctrl.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#! /bin/sh

[ -f ~/.Space2Ctrl.pid ] && kill `cat ~/.Space2Ctrl.pid` && rm -f ~/.Space2Ctrl.pid
cat ~/.Space2Ctrl.backup | xmodmap -
[ -f ~/.Space2Ctrl.backup ] && cat ~/.Space2Ctrl.backup | xmodmap - && rm -f ~/.Space2Ctrl.backup
xmodmap -e "keycode 255 ="
xmodmap -e "clear control"
xmodmap -e "add control = Control_L"
xmodmap -e "add control = Control_R"
exit 0

0 comments on commit f396af6

Please sign in to comment.