* updated kmousetool (21.12.1 -> 21.12.2), untested
[t2-trunk.git] / package / base / gpm / stone_mod_gpm.sh
blob21540f9777baf211d9df1ac4693281a099fbdd8a
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/.../gpm/stone_mod_gpm.sh
5 # Copyright (C) 2004 - 2005 The T2 SDE Project
6 # Copyright (C) 1998 - 2003 ROCK Linux Project
7 #
8 # More information can be found in the files COPYING and README.
9 #
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; version 2 of the License. A copy of the
13 # GNU General Public License can be found in the file COPYING.
14 # --- T2-COPYRIGHT-NOTE-END ---
16 # [MAIN] 40 gpm General Purpose Mouse (GPM) Daemon
18 write_config() {
19 cat << EOT > /etc/conf/gpm
20 GPM_MOUSE="$GPM_MOUSE"
21 GPM_ARGS="`echo -t $GPM_TYPE -$GPM_BUTTONS $GPM_ARGS`"
22 EOT
25 set_port() {
26 gui_menu gpm_port \
27 "Select the mouse port. (Current: $GPM_MOUSE)" \
28 'All input layer events . /dev/input/mice' 'GPM_MOUSE=/dev/input/mice' \
29 'Input layer mouse 0 .... /dev/input/mouse0' 'GPM_MOUSE=/dev/input/mouse0' \
30 'Input layer mouse 1 .... /dev/input/mouse1' 'GPM_MOUSE=/dev/input/mouse1' \
31 'TTS 0 (aka COM 1) ...... /dev/tts/0' 'GPM_MOUSE=/dev/tts/0' \
32 'TTS 1 (aka COM 2) ...... /dev/tts/1' 'GPM_MOUSE=/dev/tts/1' \
33 'TTS 2 (aka COM 3) ...... /dev/tts/2' 'GPM_MOUSE=/dev/tts/2' \
34 'TTS 3 (aka COM 4) ...... /dev/tts/3' 'GPM_MOUSE=/dev/tts/3' \
35 'PSAUX (aka PS/2) ....... /dev/misc/psaux' 'GPM_MOUSE=/dev/misc/psaux' \
36 'SUNMOUSE (SBUS) ........ /dev/misc/sunmouse' 'GPM_MOUSE=/dev/misc/sunmouse'
37 write_config
40 set_type() {
41 cmd="gui_menu gpm_type 'Select the mouse type."
42 cmd="$cmd (Current: $GPM_TYPE)'" ; x="'"
43 while read type desc ; do
44 cmd="$cmd '$type - ${desc//$x/$x\\$x$x}' 'GPM_TYPE=$type'"
45 done < <( gpm -m $GPM_MOUSE -t help | grep '^[ \*] [^ ]' | cut -c3- )
46 eval "$cmd" ; write_config
49 set_buttons() {
50 gui_menu gpm_buttons \
51 "Select the number of mouse buttons. (Current: $GPM_BUTTONS)" \
52 'This is a mouse with 2 buttons' 'GPM_BUTTONS=2' \
53 'This is a mouse with 3 buttons' 'GPM_BUTTONS=3'
54 write_config
57 set_args() {
58 gui_input "Extra options for the gpm daemon (Current: $GPM_ARGS)" \
59 "$GPM_ARGS" "GPM_ARGS"
60 write_config
63 main() {
64 while
65 GPM_MOUSE="/dev/misc/psaux" ; GPM_ARGS="-t ms -2"
66 [ -f /etc/conf/gpm ] && . /etc/conf/gpm
68 set -- $GPM_ARGS ; GPM_ARGS=""
69 while [ "$1" ] ; do
70 if [ "$1" = "-t" ] ; then
71 GPM_TYPE="$2" ; shift
72 elif [ -z "${1#-[23]}" ] ; then
73 GPM_BUTTONS="${1#-}"
74 else
75 GPM_ARGS="$GPM_ARGS $1"
77 shift
78 done
80 gui_menu gpm 'General Purpose Mouse (GPM) Daemon Configuration.
81 Select an item to change the value:' \
82 "Mouse Port ........ $GPM_MOUSE" 'set_port' \
83 "Mouse Type ........ $GPM_TYPE" 'set_type' \
84 "Mouse Buttons ..... $GPM_BUTTONS" 'set_buttons' \
85 "Extra Options ..... $GPM_ARGS" 'set_args' \
86 '' '' \
87 'Edit the /etc/conf/gpm file' \
88 "gui_edit 'GPM Config File' /etc/conf/gpm" \
89 'Configure runlevels for GPM service' \
90 '$STONE runlevel edit_srv gpm' \
91 '(Re-)Start gpm init script' \
92 '$STONE runlevel restart gpm'
93 do : ; done