develia.org
»» i686 slackware tarballs..
»» software projects..
»» and much more..
 NAVIGATION 
 OPTIONS 

 INFO 
*** develia.org ***
di Giacomo Lozito
© 2004-2010

valid xhtml 1.0valid css!
powered by apachepowered by php
valid rss 2.0get firefox!

NO software patents in UE
 DOCUMENTS 
 emulatenumlock, tasto NumLock sempre attivo

Ho realizzato questo bash script, basato su xmodmap, per far sì che il tastierino numerico si comporti come se NumLock fosse sempre attivo, a prescindere dallo stato reale. In altre parole, usando questo script, il tastierino numerico potrà essere usato per digitare i numeri ed il punto in qualsiasi situazione.
Lo script si è rivelato molto utile con alcuni programmi che sembrano ignorare lo stato del NumLock; per esempio Unreal Tournament 2004 (™) e altri programmi basati su SDL che non interpretano a dovere i tasti digitati sul tastierino numerico, comportandosi come se NumLock fosse sempre disattivato. Emulatenumlock permette anche di ripristinare la situazione normale.
Lo script è esposto nello spazio sottostante, ed è scaricabile da questo link.
Con xmodmap -pk è possibile visualizzare keycode e relativi keysymname associati, utili per adattare lo script ad esigenze particolari.

#!/bin/bash
#
# "NumLock always on" script
# Version 0.1 by Giacomo Lozito
# Last edited on 23/7/2004
# License: General Public License v2
#
# This script uses xmodmap to remap the keys on numeric keypad,
# so that they behave as if NumLock was always turned on.
# Things can be also reversed back to normal state as well.
#


function nlo_start() {
  xmodmap -quiet \
  -e "keysym KP_Delete = KP_Decimal" \
  -e "keysym KP_Insert = KP_0" \
  -e "keysym KP_End = KP_1" \
  -e "keysym KP_Down = KP_2" \
  -e "keysym KP_Next = KP_3" \
  -e "keysym KP_Left = KP_4" \
  -e "keysym KP_Begin = KP_5" \
  -e "keysym KP_Right = KP_6" \
  -e "keysym KP_Home = KP_7" \
  -e "keysym KP_Up = KP_8" \
  -e "keysym KP_Prior = KP_9"
}

function nlo_stop() {
  xmodmap -quiet \
  -e "keycode 91 = 0xff9f 0xffae" \
  -e "keycode 90 = 0xff9e 0xffb0" \
  -e "keycode 87 = 0xff9c 0xffb1" \
  -e "keycode 88 = 0xff99 0xffb2" \
  -e "keycode 89 = 0xff9b 0xffb3" \
  -e "keycode 83 = 0xff96 0xffb4" \
  -e "keycode 84 = 0xff9d 0xffb5" \
  -e "keycode 85 = 0xff98 0xffb6" \
  -e "keycode 79 = 0xff95 0xffb7" \
  -e "keycode 80 = 0xff97 0xffb8" \
  -e "keycode 81 = 0xff9a 0xffb9"
}

case "$1" in
  start)
    nlo_start
    ;;

  stop)
    nlo_stop
    ;;

  *)
    echo $"Usage: $0 {start|stop}"
    exit 1
esac