Skip to content
Browse files

Improve start/stop shell scripts

Fix the wrong remapping. The full definition of keycode 65 is reassigned
to keycode 255. control is now fully reinitialized.
  • Loading branch information...
1 parent 9a9a65a commit f396af648b68b4ce83fb96c71206b5fdae4c56a1 Renaud AUBIN committed Mar 10, 2012
Showing with 7 additions and 3 deletions.
  1. +3 −2 start_Space2Ctrl.sh
  2. +4 −1 stop_Space2Ctrl.sh
View
5 start_Space2Ctrl.sh
@@ -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
View
5 stop_Space2Ctrl.sh
@@ -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.
Something went wrong with that request. Please try again.