diff options
author | Brendan Taylor <whateley@gmail.com> | 2010-10-11 12:24:33 -0600 |
---|---|---|
committer | Brendan Taylor <whateley@gmail.com> | 2010-10-11 12:24:33 -0600 |
commit | 667a68033ce72dd6b852954315f0457983f95b1b (patch) | |
tree | b6be080e4f30ed492b0957f6a17040634f3a61e4 /examples/data/scripts/util | |
parent | da00b8c3c8b65b826b91d67d5ddbe5cc07c9ebdf (diff) | |
parent | 400b23552e7a4e8f1219c677dc491f35e22d335a (diff) |
Merge remote branch 'mathstuf/dev/cleanup-scripts' into HEAD
Conflicts: (bashisms)
examples/data/scripts/formfiller.sh
examples/data/scripts/insert_bookmark.sh
examples/data/scripts/instance-select-wmii.sh
Diffstat (limited to 'examples/data/scripts/util')
-rw-r--r-- | examples/data/scripts/util/dmenu.sh | 103 | ||||
-rw-r--r-- | examples/data/scripts/util/editor.sh | 15 | ||||
-rw-r--r-- | examples/data/scripts/util/uzbl-args.sh | 17 | ||||
-rw-r--r-- | examples/data/scripts/util/uzbl-dir.sh | 19 | ||||
-rw-r--r-- | examples/data/scripts/util/uzbl-window.sh | 17 |
5 files changed, 171 insertions, 0 deletions
diff --git a/examples/data/scripts/util/dmenu.sh b/examples/data/scripts/util/dmenu.sh new file mode 100644 index 0000000..757e5cd --- /dev/null +++ b/examples/data/scripts/util/dmenu.sh @@ -0,0 +1,103 @@ +#!/bin/sh +# dmenu setup + +case "$DMENU_SCHEME" in + # wmii + "wmii" ) + NB="#303030" + NF="khaki" + SB="#ccffaa" + SF="#303030" + ;; + # Formfiller + "formfiller" ) + NB="#0f0f0f" + NF="4e7093" + SB="#003d7c" + SF="#3a9bff" + ;; + # Bookmarks + "bookmarks" ) + NB="#303030" + NF="khaki" + SB="#ccffaa" + SF="#303030" + ;; + # History + "history" ) + NB="#303030" + NF="khaki" + SB="#ccffaa" + SF="#303030" + ;; + # Default + * ) + NB="#303030" + NF="khaki" + SB="#ccffaa" + SF="#303030" + ;; +esac + +DMENU_COLORS="-nb $NB -nf $NF -sb $SB -sf $SF" + +# Default arguments +if [ -z "$DMENU_ARGS" ]; then + DMENU_ARGS="-i" +fi + +# Set the font if wanted +if [ -n "$DMENU_FONT" ]; then + DMENU_ARGS="$DMENU_ARGS -fn $DMENU_FONT" +fi + +# Set the prompt if wanted +if [ -n "$DMENU_PROMPT" ]; then + DMENU_ARGS="$DMENU_ARGS -p $DMENU_PROMPT" +fi + +# Detect the xmms patch +if dmenu --help 2>&1 | grep -q '\[-xs\]'; then + DMENU_XMMS_ARGS="-xs" + DMENU_HAS_XMMS=1 + + if echo $DMENU_OPTIONS | grep -q -w 'xmms'; then + DMENU_ARGS="$DMENU_ARGS $DMENU_XMMS_ARGS" + fi +fi + +# Detect the vertical patch +if dmenu --help 2>&1 | grep -q '\[-l <lines>\]'; then + # Default to 10 lines + if [ -z "$DMENU_LINES" ]; then + DMENU_LINES=10 + fi + + DMENU_VERTICAL_ARGS="-l $DMENU_LINES" + DMENU_HAS_VERTICAL=1 + + # Detect the resize patch + if dmenu --help 2>&1 | grep -q '\[-rs\]'; then + DMENU_RESIZE_ARGS="-rs" + DMENU_HAS_RESIZE=1 + fi + + if echo $DMENU_OPTIONS | grep -q -w 'vertical'; then + DMENU_ARGS="$DMENU_ARGS $DMENU_VERTICAL_ARGS" + + if echo $DMENU_OPTIONS | grep -q -w 'resize'; then + DMENU_ARGS="$DMENU_ARGS $DMENU_RESIZE_ARGS" + fi + fi +fi + +# Detect placement patch +if dmenu --help 2>&1 | grep -q '\[-x <xoffset>\]'; then + DMENU_PLACE_X="-x" + DMENU_PLACE_Y="-y" + DMENU_PLACE_WIDTH="-w" + DMENU_PLACE_HEIGHT="-h" + DMENU_HAS_PLACEMENT=1 +fi + +DMENU="dmenu $DMENU_ARGS $DMENU_COLORS" diff --git a/examples/data/scripts/util/editor.sh b/examples/data/scripts/util/editor.sh new file mode 100644 index 0000000..1969769 --- /dev/null +++ b/examples/data/scripts/util/editor.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# Editor selection + +if [ -z "$VTERM" ]; then + VTERM="xterm" +fi + +UZBL_EDITOR="$VISUAL" +if [ -z "$UZBL_EDITOR" ]; then + if [ -z "$EDITOR" ]; then + UZBL_EDITOR="$VTERM -e vim" + else + UZBL_EDITOR="$VTERM -e $EDITOR" + fi +fi diff --git a/examples/data/scripts/util/uzbl-args.sh b/examples/data/scripts/util/uzbl-args.sh new file mode 100644 index 0000000..7a3dbe5 --- /dev/null +++ b/examples/data/scripts/util/uzbl-args.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# Arguments from uzbl + +UZBL_CONFIG=$1 +shift +UZBL_PID=$1 +shift +UZBL_XID=$1 +shift +UZBL_FIFO=$1 +shift +UZBL_SOCKET=$1 +shift +UZBL_URL=$1 +shift +UZBL_TITLE=$1 +shift diff --git a/examples/data/scripts/util/uzbl-dir.sh b/examples/data/scripts/util/uzbl-dir.sh new file mode 100644 index 0000000..bb56954 --- /dev/null +++ b/examples/data/scripts/util/uzbl-dir.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# Common directories and files used in scripts + +# Common things first +UZBL_DATA_DIR=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl +UZBL_CONFIG_DIR=${XDG_CONFIG_DIR:-$HOME/.config}/uzbl +UZBL_FIFO_DIR=/tmp +UZBL_SOCKET_DIR=/tmp + +# Directories +UZBL_DOWNLOAD_DIR=${XDG_DOWNLOAD_DIR:-$HOME} +UZBL_FORMS_DIR=$UZBL_DATA_DIR/dforms + +# Data files +UZBL_CONFIG_FILE=$UZBL_CONFIG_DIR/config +UZBL_COOKIE_FILE=$UZBL_DATA_DIR/cookies.txt +UZBL_BOOKMARKS_FILE=$UZBL_DATA_DIR/bookmarks +UZBL_HISTORY_FILE=$UZBL_DATA_DIR/history +UZBL_SESSION_FILE=$UZBL_DATA_DIR/browser-session diff --git a/examples/data/scripts/util/uzbl-window.sh b/examples/data/scripts/util/uzbl-window.sh new file mode 100644 index 0000000..b2771e4 --- /dev/null +++ b/examples/data/scripts/util/uzbl-window.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# uzbl window detection + +if [ -z "$UZBL_XID" ]; then + echo "Error: UZBL_XID not set" + echo "Please source uzbl-args.sh first" + exit 1 +fi + +UZBL_WIN_POS=$(xwininfo -id $UZBL_XID | \ + sed -ne 's/Corners:[ ]*[+-]\([0-9]*\)[+-]\([0-9]*\).*$/\1 \2/p') +UZBL_WIN_SIZE=$(xwininfo -id $UZBL_XID | \ + sed -ne 's/-geometry[ ]*\([0-9]*\)x\([0-9]*\).*$/\1 \2/p') +UZBL_WIN_POS_X=$(echo $UZBL_WIN_POS | cut -d\ -f1) +UZBL_WIN_POS_Y=$(echo $UZBL_WIN_POS | cut -d\ -f2) +UZBL_WIN_WIDTH=$(echo $UZBL_WIN_SIZE | cut -d\ -f1) +UZBL_WIN_HEIGHT=$(echo $UZBL_WIN_SIZE | cut -d\ -f2) |