testbox.sh (944B)
1 #!/bin/sh 2 3 export LTKDIR="`pwd`/.ltk" 4 ltk_id=`./src/ltkd -t "Cool Window"` 5 if [ $? -ne 0 ]; then 6 echo "Unable to start ltkd." >&2 7 exit 1 8 fi 9 10 cmds="box box1 create vertical\nset-root-widget box1\nlabel lblbla create \"Hi\"\nbox box1 add lblbla w\nbutton exit_btn create \"Exit\"\nmask-add exit_btn button press\nbox box1 add exit_btn 11 $(curl -s gopher://lumidify.org | awk -F'\t' ' 12 BEGIN {btn = 0; lbl = 0;} 13 /^i/ { printf "label lbl%s create \"%s\"\nbox box1 add lbl%s w\n", lbl, substr($1, 2), lbl; lbl++ } 14 /^[1gI]/ { printf "button btn%s create \"%s\"\nbox box1 add btn%s w\n", btn, substr($1, 2), btn; btn++ }') 15 mask-add btn0 button press" 16 echo "$cmds" | ./src/ltkc $ltk_id | while read cmd 17 do 18 case "$cmd" in 19 *"event exit_btn button press") 20 echo "quit" 21 ;; 22 *"event btn0 button press") 23 echo "button bla create \"safhaskfldshk\"\nbox box1 add bla w" 24 ;; 25 *) 26 printf "%s\n" "$cmd" >&2 27 ;; 28 esac 29 done | ./src/ltkc $ltk_id > /dev/null