Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit f396af648b68b4ce83fb96c71206b5fdae4c56a1 1 parent 9a9a65a
Renaud AUBIN authored

Showing 2 changed files with 7 additions and 3 deletions. Show diff stats Hide diff stats

  1. +3 2 start_Space2Ctrl.sh
  2. +4 1 stop_Space2Ctrl.sh
5 start_Space2Ctrl.sh
@@ -3,10 +3,11 @@
3 3 origmap=$(xmodmap -pke | grep -E "^keycode[[:blank:]]*?65")
4 4 echo ${origmap} > ~/.Space2Ctrl.backup
5 5
6   -newmap=$(echo ${origmap} | perl -pe "s/[[:blank:]]*?=[[:blank:]]*?space/ = Control_L/")
  6 +newmap=$(echo ${origmap} | perl -pe "s/65[[:blank:]]*?=[[:blank:]]*?space/255 = space/")
  7 +echo $newmap
7 8 xmodmap -e "$newmap"
  9 +xmodmap -e "keycode 65 = Control_L"
8 10 xmodmap -e "add control = Control_L"
9   -xmodmap -e "keycode 255 = space"
10 11
11 12 nohup ./Space2Ctrl >> ~/.Space2Ctrl.log 2>&1 &
12 13 echo $! > ~/.Space2Ctrl.pid
5 stop_Space2Ctrl.sh
... ... @@ -1,6 +1,9 @@
1 1 #! /bin/sh
2 2
3 3 [ -f ~/.Space2Ctrl.pid ] && kill `cat ~/.Space2Ctrl.pid` && rm -f ~/.Space2Ctrl.pid
4   -cat ~/.Space2Ctrl.backup | xmodmap -
  4 +[ -f ~/.Space2Ctrl.backup ] && cat ~/.Space2Ctrl.backup | xmodmap - && rm -f ~/.Space2Ctrl.backup
5 5 xmodmap -e "keycode 255 ="
  6 +xmodmap -e "clear control"
  7 +xmodmap -e "add control = Control_L"
  8 +xmodmap -e "add control = Control_R"
6 9 exit 0

0 comments on commit f396af6

Please sign in to comment.
Something went wrong with that request. Please try again.