#!fish # # FISH named pipe demo with the GTK-server # Based on the BASH demo # Tested with FISH shell 1.2.2 on Zenwalk Linux 3.0 # # November 6, 2006 by Peter van Eerten: initial version #------------------------------------------------------ # Communicate with GTK-server function gtk echo $argv > /tmp/fish.pipe read RESULT < /tmp/fish.pipe end #------------------------ Main starts here # Declare global variable to store results from GTK-server set RESULT 0 # Start gtk-server gtk-server -fifo=/tmp/fish.pipe -detach # Setup GUI gtk "gtk_init NULL NULL" gtk "gtk_window_new 0" set WIN $RESULT gtk "gtk_window_set_title" $WIN "'FishSHELL GTK-server demo with FIFO'" gtk "gtk_window_set_default_size" $WIN 400 200 gtk "gtk_window_set_position" $WIN 1 gtk "gtk_table_new" 10 10 1 set TBL $RESULT gtk "gtk_container_add" $WIN $TBL gtk "gtk_button_new_with_label 'Click to Quit'" set BUT $RESULT gtk "gtk_table_attach_defaults" $TBL $BUT 5 9 5 9 gtk "gtk_widget_show_all" $WIN # Initialize first set EVENT 0 # Mainloop while test $EVENT != $BUT gtk "gtk_server_callback wait" set EVENT $RESULT end # Exit GTK gtk "gtk_server_exit"