summaryrefslogtreecommitdiffstats
path: root/ximkeys
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2015-07-27 15:33:12 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-07-27 15:33:12 +0200
commit11ebc79bad89075267574a032b46eb992a0a6f32 (patch)
treebe76655e7bfae568e2f32802fffda3f4ae8421b7 /ximkeys
parent1721bd7db1775fe7df3de1837af53f5689c35ab4 (diff)
downloadbin-11ebc79bad89075267574a032b46eb992a0a6f32.tar.gz
bin-11ebc79bad89075267574a032b46eb992a0a6f32.tar.xz
add new scripts
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'ximkeys')
-rwxr-xr-xximkeys75
1 files changed, 75 insertions, 0 deletions
diff --git a/ximkeys b/ximkeys
new file mode 100755
index 0000000..6a0a5d8
--- /dev/null
+++ b/ximkeys
@@ -0,0 +1,75 @@
+#!/bin/bash
+
+# List the X compose sequences available to generate the specified character.
+# I.E. the keyboard key sequence to enter after the compose (multi) key or
+# a dead key is pressed.
+#
+# This version has been heavily modified by me (David the H.). It is now
+# bash-specific, reduces the need for external tools (only grep is needed),
+# and can handle multiple inputs.
+#
+# Original script info follows. For the original version, go here:
+# http://www.pixelbeat.org/docs/xkeyboard/
+#
+# Author:
+# P@draigBrady.com
+# Notes:
+# GTK+ apps use a different but broadly similar input method
+# to X by default. Personally I tell GTK+ to use the X one by
+# adding `export GTK_IM_MODULE=xim` to /etc/profile
+# Changes:
+# V0.1, 09 Sep 2005, Initial release
+# V0.2, 04 May 2007, Added support for ubuntu
+#
+
+if [[ -z $* ]]; then
+ echo "Usage: ${0##*/} 'character(s)'" >&2
+ echo "Multiple characters are supported." >&2
+ echo "They don't need to be space-separated." >&2
+ exit 1
+fi
+
+if [[ $LANG =~ (.*)[.]UTF.*8 ]]; then
+
+ lang="${BASH_REMATCH[1]}"
+ codeset=UTF-8
+
+else
+
+ echo "Sorry, only UTF-8 is supported at present" >&2
+ exit 1
+ #could try and normalise codeset, and get char with printf %q
+ #but would not be general enough I think.
+
+fi
+
+dir=/usr/share/X11/locale #ubuntu
+
+if [[ ! -d "$dir" ]]; then
+
+ dir=/usr/X11R6/lib/X11/locale #redhat/debian
+
+fi
+
+if [[ ! -f "$dir/locale.dir" ]]; then
+
+ echo "Sorry, couldn't find your X windows locale data" >&2
+ exit 1
+
+fi
+
+page="$( grep -m1 "${lang}.${codeset}$" <$dir/locale.dir )"
+page=${page%%/*}
+
+file="$dir/$page/Compose"
+
+while read -n 1 character; do
+
+ [[ -z $character ]] && continue
+ echo "combinations found for [$character]"
+ grep -F "\"$character\"" "$file"
+ echo
+
+done <<<"$@"
+
+exit 0 \ No newline at end of file