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