📄 mozilla.ksh
字号:
#!/bin/ksh## Testing GtkMozEmbed - PvE - april 22, 2008 GPL.##------------------------------------------------## Communication function; assignment functionfunction gtk { print -p $1; read -p GTK; }function define { $2 "$3"; eval $1="$GTK"; }# -------------------------------------------------------------------------------------# IMPORTANT!## The script 'run-mozilla.sh' sets some environment variables before executing the# webbrowser binary. The 'gtkembedmoz' widget must be linked together with the other# Mozilla libs using 'LD_LIBRARY_PATH' in order to be used successfully.# -------------------------------------------------------------------------------------LIB=`locate -n 1 libgtkembedmoz.so`if [[ -z $LIB ]]then echo "No Mozilla library found!" exit 1else export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${LIB%/*}fi# Start GTK-server in STDIN modegtk-server -stdin |&# Define GUIgtk "gtk_init NULL NULL"define WINDOW gtk "gtk_window_new 0"gtk "gtk_window_set_title $WINDOW 'My own webbrowser'"gtk "gtk_window_set_position $WINDOW 1"gtk "gtk_widget_set_size_request $WINDOW 700 500"gtk "gtk_window_set_icon_name $WINDOW mozilla"# Set the componentpath of gtkembedmoz alsogtk "gtk_moz_embed_set_comp_path ${LIB%/*}"# Store a temporary profile in /tmp so my profile will be savegtk "gtk_moz_embed_set_profile_path /tmp mozilla"# Create the widgetdefine MOZ gtk "gtk_moz_embed_new"gtk "gtk_container_add $WINDOW $MOZ"gtk "gtk_server_connect $MOZ open-uri open-uri 1"# Load some URLgtk "gtk_moz_embed_load_url $MOZ 'http://www.gtk-server.org'"gtk "gtk_widget_show_all $WINDOW"# Load external file example.#gtk "gtk_moz_embed_open_stream $MOZ \"file://\" \"text/html\""#while read LINE#do# gtk "gtk_moz_embed_append_data $MOZ '$LINE' ${#LINE}"#done < somepage.html# Initialize variablesEVENT=0# Mainloopwhile [[ $EVENT != $WINDOW ]]do define EVENT gtk "gtk_server_callback WAIT" if [[ $EVENT = "open-uri" ]] then define URI gtk "gtk_server_callback_value 1 STRING" echo "You are going to $URI" fidone# Exit GTKgtk "gtk_server_exit"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -