root/Compose/compose_gui.sh @ 1961

Revision 1961, 2.8 KB (checked in by pascal, 4 years ago)

Fehler bei Standardauswahl korrigiert.

  • Property svn:executable set to *
Line 
1#!/bin/bash
2
3# This file is part of the german Neo keyboard layout
4#
5# GUI to combine several Compose modules written by Neo keyboard layout
6# This file has been originally written by Pascal Hauck (neo@pascalhauck.de)
7
8
9SRC=./src                                                               # Source directory
10CONFFILE=.config
11typeset -i anzahl
12
13
14if [ "X:$KDE_FULL_SESSION" = "X:true" ]
15then
16        CHECKLIST() {
17                kdialog --title Compose-Module --checklist "$1<br>$2<br><br>$3" $5
18        }
19        MSGBOX() {
20                kdialog --title Compose-Module --msgbox "$1"
21        }
22        YESNO() {
23                kdialog --title Compose-Module --yesno "$1"
24        }
25else
26        CHECKLIST() {
27                zenity --title Compose-Module --width=610 --height=320 --list --multiple --column Modulname  --column Modulebeschreibung --separator=_ --text "$1\n$2\n\n$3\n$4" $6
28        }
29        MSGBOX() {
30                zenity --title Compose-Module --info --text "$1"
31        }
32        YESNO() {
33                zenity --title Compose-Module --question --text "$1"
34        }
35fi
36
37
38if [ -f $HOME/.XCompose ]
39then
40        YESNO "Es gibt bereits eine Compose-Datei (z.B. durch eine ältere Neo-Installation).\nSollten Sie eigene Definitionen in der Datei ~/.XCompose vorgenommen haben, dann brechen Sie jetzt ab und schreiben Ihre eigenen Definitionen in eine Datei (z.B. user.module) im Ordner src.\n\nAnderenfalls können Sie das Skript bedenkenlos fortsetzen.\nWollen Sie fortfahren?" || exit
41fi
42
43
44auswahl=XCompose_enUS_base
45
46for i in src/*.module
47do
48        name=$(basename $i .module)                                     # name of modul
49        if [ ! "$name" = "base" -a ! "$name" = "enUS" ]
50        then
51                anzahl=anzahl+1
52                m[$anzahl]=$name
53                b[$anzahl]=$(sed -n "
54/^#configinfo[ \t]*/{
55    s///
56    s/^\(.\{10\}\) */\1/
57    p;q
58}
59
60\${
61    s/.*/ohne Beschreibung/
62    s/^\(.\{10\}\) */\1/
63    p
64}" $SRC/$name.module)                                                   # description of module
65                if  grep -qs $name $CONFFILE
66                then
67                        a[$anzahl]=on                                   # default value for this module
68                else
69                        a[$anzahl]=off
70                fi
71        fi
72        klist=$klist\ ${m[$anzahl]}\ ${b[$anzahl]}\ ${a[$anzahl]}
73        glist=$glist\ ${m[$anzahl]}\ ${b[$anzahl]}
74done
75
76
77while [ ! "$module" ]
78do
79 case ${1-" "} in
80  " ")
81      module=ausgewählt
82      ;;
83  *)
84      echo Aufruf: compose.sh
85      echo Mit »compose.sh« können die Compose-Module von Neo zusammengesetzt werden.
86      echo Folgende Module sind verfügbar:
87      for i in $(seq 1 $anzahl)
88      do
89       echo -e "  ${m[$i]}\t\t${b[$i]}"
90      done
91      exit;;
92 esac
93done
94
95menu=`CHECKLIST "Die Neo-Tastaturbelegung hat etliche Erweiterungen für Compose (Mod3+Tab) erstellt," "wodurch Zeichen wie ∮ έ ʒ ermöglicht werden." "Wählen Sie die Compose-Module von Neo aus, die Sie verwenden möchten." "Für mehrere Module STRG bzw. CTRL gedrückt halten." "$klist" "$glist" | sed -e 's/\"//g' | sed -e 's/\ /_/g'`
96
97if [ $menu ]
98then
99        fertig="Die neue Compose-Datei wurde erfolgreich erstellt.\nSie wird für alle neu gestarteten Programme sowie nach dem nächsten Login wirksam."
100        echo "USER_XCOMPOSE = ${auswahl}_${menu}" > .config && make install && make clean && MSGBOX "$fertig"
101fi
Note: See TracBrowser for help on using the browser.