#!/bin/sh # 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. For more info please see: # http://www.pixelbeat.org/docs/xkeyboard/ # License: LGPLv2 # 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 test "$Argc" != "1" { echo "Usage: $[basename $0] 'character'" > !2 exit 1 } if echo $LANG | grep -qi 'UTF.*8' { global lang := $[echo $LANG | sed 's/\(.._..\).*/\1/] global codeset := 'UTF-8' global character := $1 } 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. } global dir := '/usr/share/X11/locale' #new Xorg location if test ! -d $dir { global dir := '/usr/X11R6/lib/X11/locale' #older X11 location } if test ! -f "$dir/locale.dir" { echo "Sorry, couldn't find your X windows locale data" > !2 exit 1 } global dir := ""$dir/$[sed -n "s#\([^/]*\)/.*:.*$lang.$codeset#\1#p" \ < $dir/locale.dir]"" env LANG=C grep -F "\"$character\"" $dir/Compose (CommandList children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Pound "$#"))} {(KW_Bang "!") (Lit_Other "=")} {(DQ (1))} {(Lit_Other "]")} ) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ ("Usage: ") (CommandSubPart command_list: (CommandList children:[(C {(basename)} {($ VSub_Number "$0")})]) left_token: spids: [73 77] ) (" 'character'") ) } ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[81])] ) (C {(exit)} {(1)}) ] spids: [-1 66] ) ] spids: [-1 89] ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [(C {(echo)} {($ VSub_Name "$LANG")}) (C {(grep)} {(-qi)} {(SQ <"UTF.*8">)})] negated: False ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:lang) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$LANG")}) (C {(sed)} {(SQ <"s/\\(.._..\\).*/\\1/">)}) ] negated: False ) ] ) left_token: spids: [113 125] ) } spids: [112] ) ] spids: [112] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:codeset) op:Equal rhs:{(UTF-8)} spids:[128])] spids: [128] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:character) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [132] ) ] spids: [132] ) ] spids: [-1 109] ) ] else_action: [ (SimpleCommand words: [{(echo)} {(DQ ("Sorry, only UTF-8 is supported at present"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[146])] ) (C {(exit)} {(1)}) ] spids: [137 162] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:dir) op:Equal rhs:{(/usr/share/X11/locale)} spids:[165])] spids: [165] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-d)} {(DQ ($ VSub_Name "$dir"))} {(Lit_Other "]")}) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dir) op: Equal rhs: {(/usr/X11R6/lib/X11/locale)} spids: [189] ) ] spids: [189] ) ] spids: [-1 186] ) ] spids: [-1 195] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-f)} {(DQ ($ VSub_Name "$dir") (/locale.dir))} {(Lit_Other "]")} ) terminator: ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ("Sorry, couldn't find your X windows locale data"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[222])] ) (C {(exit)} {(1)}) ] spids: [-1 213] ) ] spids: [-1 230] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dir) op: Equal rhs: { (DQ ($ VSub_Name "$dir") (/) (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [ {(sed)} {(-n)} { (DQ ("s#") (EscapedLiteralPart token:) ("[^/]*") (EscapedLiteralPart token: ) ("/.*:.*") ($ VSub_Name "$lang") (.) ($ VSub_Name "$codeset") ("#") (EscapedLiteralPart token: ) ("#p") ) } ] redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {($ VSub_Name "$dir") (/locale.dir)} spids: [257] ) ] ) ] ) left_token: spids: [237 261] ) ) } spids: [233] ) ] spids: [233] ) (SimpleCommand words: [ {(grep)} {(-F)} { (DQ (EscapedLiteralPart token:) ($ VSub_Name "$character") (EscapedLiteralPart token:) ) } {($ VSub_Name "$dir") (/Compose)} ] more_env: [(env_pair name:LANG val:{(C)} spids:[264])] ) ] )