From 03e2f59ec0959ba4dec30a903ac060d74e5fdac5 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 10 Mar 2011 20:48:54 -0500 Subject: Add padding inside of braces --- examples/data/scripts/download.sh | 2 +- examples/data/scripts/follow.sh | 2 +- examples/data/scripts/formfiller.sh | 24 ++++++++++++------------ examples/data/scripts/go_input.sh | 2 +- examples/data/scripts/insert_bookmark.sh | 2 +- examples/data/scripts/instance-select-wmii.sh | 14 +++++++------- examples/data/scripts/load_url_from_bookmarks.sh | 4 ++-- examples/data/scripts/load_url_from_history.sh | 7 +++---- examples/data/scripts/session.sh | 6 +++--- examples/data/scripts/util/uzbl-window.sh | 16 ++++++++-------- 10 files changed, 39 insertions(+), 40 deletions(-) diff --git a/examples/data/scripts/download.sh b/examples/data/scripts/download.sh index 6bcd9d1..7753bd6 100755 --- a/examples/data/scripts/download.sh +++ b/examples/data/scripts/download.sh @@ -11,7 +11,7 @@ # the URL that is being downloaded uri="$1" -safe_uri="$(echo "$uri" | sed -e 's/\W/-/g')" +safe_uri="$( echo "$uri" | sed -e 's/\W/-/g' )" # a filename suggested by the server or based on the URL suggested_filename="${2:-$safe_uri}" diff --git a/examples/data/scripts/follow.sh b/examples/data/scripts/follow.sh index 83db395..9754778 100755 --- a/examples/data/scripts/follow.sh +++ b/examples/data/scripts/follow.sh @@ -13,7 +13,7 @@ if ! which socat >/dev/null 2>&1; then exit fi -result="$(echo "script @scripts_dir/follow.js \"@{follow_hint_keys} $keys\"" | socat - "unix-connect:$UZBL_SOCKET")" +result="$( echo "script @scripts_dir/follow.js \"@{follow_hint_keys} $keys\"" | socat - "unix-connect:$UZBL_SOCKET" )" case $result in *XXXEMIT_FORM_ACTIVEXXX*) # a form element was selected diff --git a/examples/data/scripts/formfiller.sh b/examples/data/scripts/formfiller.sh index 907ceef..637a98f 100755 --- a/examples/data/scripts/formfiller.sh +++ b/examples/data/scripts/formfiller.sh @@ -47,16 +47,16 @@ DMENU_OPTIONS="vertical resize" . "$UZBL_UTIL_DIR/editor.sh" . "$UZBL_UTIL_DIR/uzbl-dir.sh" -RAND="$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -c 1-5)" +RAND="$( dd if=/dev/urandom count=1 2>/dev/null | cksum | cut -c 1-5 )" MODELINE="> vim:ft=formfiller" -[ -d "$(dirname "$UZBL_FORMS_DIR")" ] || exit 1 +[ -d "$( dirname "$UZBL_FORMS_DIR" )" ] || exit 1 [ -d "$UZBL_FORMS_DIR" ] || mkdir "$UZBL_FORMS_DIR" || exit 1 action="$1" shift -domain="$(echo "$UZBL_URI" | sed -e 's/\(http\|https\):\/\/\([^\/]\+\)\/.*/\2/')" +domain="$( echo "$UZBL_URI" | sed -e 's/\(http\|https\):\/\/\([^\/]\+\)\/.*/\2/' )" if [ "$action" != 'edit' -a "$action" != 'new' -a "$action" != 'load' -a "$action" != 'add' -a "$action" != 'once' ]; then action="new" @@ -123,23 +123,23 @@ insertFunction="function insert(fname, ftype, fvalue, fchecked) { \ if [ "$action" = 'load' ]; then [ -e "$UZBL_FORMS_DIR/$domain" ] || exit 2 - if [ "$(cat "$UZBL_FORMS_DIR/$domain" | grep "!profile" | wc -l)" -gt 1 ]; then - menu="$(cat "$UZBL_FORMS_DIR/$domain" | \ - sed -n -e 's/^!profile=\([^[:blank:]]\+\)/\1/p')" - option="$(printf "$menu" | $DMENU)" + if [ "$( cat "$UZBL_FORMS_DIR/$domain" | grep "!profile" | wc -l )" -gt 1 ]; then + menu="$( cat "$UZBL_FORMS_DIR/$domain" | \ + sed -n -e 's/^!profile=\([^[:blank:]]\+\)/\1/p' )" + option="$( printf "$menu" | $DMENU )" fi # Remove comments sed -i -e '/^>/d' "$tmpfile" sed -i -e 's/^\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):\(off\|no\|false\|unchecked\|0\|$\)/\1{\2}(\3):0/I;s/^\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):[^0]\+/\1{\2}(\3):1/I' "$UZBL_FORMS_DIR/$domain" - fields="$(cat "$UZBL_FORMS_DIR/$domain" | \ + fields="$( cat "$UZBL_FORMS_DIR/$domain" | \ sed -n -e "/^!profile=${option}/,/^!profile=/p" | \ sed -e '/^!profile=/d' | \ sed -e 's/^\([^(]\+(\)\(radio\|checkbox\|text\|search\|textarea\|password\)):/%{>\1\2):<}%/' | \ sed -e 's/^\(.\+\)$/<{br}>\1/' | \ tr -d '\n' | \ - sed -e 's/<{br}>%{>\([^(]\+(\)\(radio\|checkbox\|text\|search\|textarea\|password\)):<}%/\\n\1\2):/g')" + sed -e 's/<{br}>%{>\([^(]\+(\)\(radio\|checkbox\|text\|search\|textarea\|password\)):<}%/\\n\1\2):/g' )" printf '%s\n' "${fields}" | \ sed -n -e "s/\([^(]\+\)(\(password\|text\|search\|textarea\)\+):[ ]*\(.\+\)/js $insertFunction; insert('\1', '\2', '\3', 0);/p" | \ sed -e 's/@/\\@/g;s/<{br}>/\\\\n/g' | socat - "unix-connect:$UZBL_SOCKET" @@ -147,7 +147,7 @@ if [ "$action" = 'load' ]; then sed -n -e "s/\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):[ ]*\(.\+\)/js $insertFunction; insert('\1', '\3', '\2', \4);/p" | \ sed -e 's/@/\\@/g' | socat - "unix-connect:$UZBL_SOCKET" elif [ "$action" = "once" ]; then - tmpfile="$(mktemp)" + tmpfile="$( mktemp )" printf 'js %s dump(); \n' "$dumpFunction" | \ socat - "unix-connect:$UZBL_SOCKET" | \ sed -n -e '/^[^(]\+([^)]\+):/p' > "$tmpfile" @@ -160,11 +160,11 @@ elif [ "$action" = "once" ]; then sed -i -e '/^>/d' "$tmpfile" sed -i -e 's/^\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):\(off\|no\|false\|unchecked\|0\|$\)/\1{\2}(\3):0/I;s/^\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):[^0]\+/\1{\2}(\3):1/I' "$tmpfile" - fields="$(cat "$tmpfile" | \ + fields="$( cat "$tmpfile" | \ sed -e 's/^\([^(]\+(\)\(radio\|checkbox\|text\|search\|textarea\|password\)):/%{>\1\2):<}%/' | \ sed -e 's/^\(.\+\)$/<{br}>\1/' | \ tr -d '\n' | \ - sed -e 's/<{br}>%{>\([^(]\+(\)\(radio\|checkbox\|text\|search\|textarea\|password\)):<}%/\\n\1\2):/g')" + sed -e 's/<{br}>%{>\([^(]\+(\)\(radio\|checkbox\|text\|search\|textarea\|password\)):<}%/\\n\1\2):/g' )" printf '%s\n' "${fields}" | \ sed -n -e "s/\([^(]\+\)(\(password\|text\|search\|textarea\)\+):[ ]*\(.\+\)/js $insertFunction; insert('\1', '\2', '\3', 0);/p" | \ sed -e 's/@/\\@/g;s/<{br}>/\\\\n/g' | socat - "unix-connect:$UZBL_SOCKET" diff --git a/examples/data/scripts/go_input.sh b/examples/data/scripts/go_input.sh index a09c604..8d9ac84 100755 --- a/examples/data/scripts/go_input.sh +++ b/examples/data/scripts/go_input.sh @@ -1,5 +1,5 @@ #!/bin/sh -case "$(echo 'script @scripts_dir/go_input.js' | socat - "unix-connect:$UZBL_SOCKET")" in +case "$( echo 'script @scripts_dir/go_input.js' | socat - "unix-connect:$UZBL_SOCKET" )" in *XXXEMIT_FORM_ACTIVEXXX*) echo 'event FORM_ACTIVE' > "$UZBL_FIFO" ;; esac diff --git a/examples/data/scripts/insert_bookmark.sh b/examples/data/scripts/insert_bookmark.sh index 374bea0..b1ea07d 100755 --- a/examples/data/scripts/insert_bookmark.sh +++ b/examples/data/scripts/insert_bookmark.sh @@ -7,7 +7,7 @@ which zenity >/dev/null 2>&1 || exit 2 -tags="$(zenity --entry --text="Enter space-separated tags for bookmark $UZBL_URI:")" +tags="$( zenity --entry --text="Enter space-separated tags for bookmark $UZBL_URI:" )" exitstatus="$?" [ "$exitstatus" -eq 0 ] || exit "$exitstatus" diff --git a/examples/data/scripts/instance-select-wmii.sh b/examples/data/scripts/instance-select-wmii.sh index 57ef0cb..f0a7bef 100755 --- a/examples/data/scripts/instance-select-wmii.sh +++ b/examples/data/scripts/instance-select-wmii.sh @@ -18,24 +18,24 @@ case "$1" in "list" ) list="" # get window id's of uzbl clients. we could also get the label in one shot but it's pretty tricky - for i in $(wmiir read /tag/sel/index | grep uzbl |cut -d ' ' -f2); do - label="$(wmiir read /client/$i/label)" + for i in $( wmiir read /tag/sel/index | grep uzbl | cut -d ' ' -f2 ); do + label="$( wmiir read /client/$i/label )" list="$list$i : $label\n" done - window="$(printf "$list\n" | $DMENU | cut -d ' ' -f1)" + window="$( printf "$list\n" | $DMENU | cut -d ' ' -f1 )" wmiir xwrite /tag/sel/ctl "select client $window" ;; "next" ) - current="$(wmiir read /client/sel/ctl | head -n 1)" + current="$( wmiir read /client/sel/ctl | head -n 1 )" # find the next uzbl window and focus it - next="$(wmiir read /tag/sel/index | grep -A 10000 " $current " | grep -m 1 uzbl | cut -d ' ' -f2)" + next="$( wmiir read /tag/sel/index | grep -A 10000 " $current " | grep -m 1 uzbl | cut -d ' ' -f2 )" if [ -n "$next" ]; then wmiir xwrite /tag/sel/ctl "select client $next" fi ;; "prev" ) - current="$(wmiir read /client/sel/ctl | head -n 1)" - prev="$(wmiir read /tag/sel/index | grep -B 10000 " $current " | tac | grep -m 1 uzbl | cut -d ' ' -f2)" + current="$( wmiir read /client/sel/ctl | head -n 1 )" + prev="$( wmiir read /tag/sel/index | grep -B 10000 " $current " | tac | grep -m 1 uzbl | cut -d ' ' -f2 )" if [ -n "$prev" ]; then wmiir xwrite /tag/sel/ctl "select client $prev" fi diff --git a/examples/data/scripts/load_url_from_bookmarks.sh b/examples/data/scripts/load_url_from_bookmarks.sh index d47d189..5ba0d90 100755 --- a/examples/data/scripts/load_url_from_bookmarks.sh +++ b/examples/data/scripts/load_url_from_bookmarks.sh @@ -12,10 +12,10 @@ DMENU_OPTIONS="xmms vertical resize" if [ -z "$DMENU_HAS_VERTICAL" ]; then # because they are all after each other, just show the url, not their tags. - goto="$(awk '{print $1}' "$UZBL_BOOKMARKS_FILE" | $DMENU)" + goto="$( awk '{ print $1 }' "$UZBL_BOOKMARKS_FILE" | $DMENU )" else # show tags as well - goto="$($DMENU < "$UZBL_BOOKMARKS_FILE" | awk '{print $1}')" + goto="$( $DMENU < "$UZBL_BOOKMARKS_FILE" | awk '{ print $1 }' )" fi [ -n "$goto" ] && echo "uri $goto" > "$UZBL_FIFO" diff --git a/examples/data/scripts/load_url_from_history.sh b/examples/data/scripts/load_url_from_history.sh index 9cca356..5388680 100755 --- a/examples/data/scripts/load_url_from_history.sh +++ b/examples/data/scripts/load_url_from_history.sh @@ -9,14 +9,13 @@ DMENU_OPTIONS="xmms vertical resize" [ -r "$UZBL_HISTORY_FILE" ] || exit 1 # choose from all entries, sorted and uniqued -# goto=$(awk '{print $3}' $history_file | sort -u | dmenu -i) if [ -z "$DMENU_HAS_VERTICAL" ]; then - current="$(tail -n 1 "$UZBL_HISTORY_FILE" | awk '{print $3}')" - goto="$( (echo "$current"; awk '{print $3}' "$UZBL_HISTORY_FILE" | grep -v "^$current\$" | sort -u) | $DMENU)" + current="$( tail -n 1 "$UZBL_HISTORY_FILE" | awk '{ print $3 }' )" + goto="$( ( echo "$current"; awk '{ print $3 }' "$UZBL_HISTORY_FILE" | grep -v "^$current\$" | sort -u ) | $DMENU )" else # choose an item in reverse order, showing also the date and page titles # pick the last field from the first 3 fields. this way you can pick a url (prefixed with date & time) or type just a new url. - goto="$(tac "$UZBL_HISTORY_FILE" | $DMENU | cut -d ' ' -f -3 | awk '{print $NF}')" + goto="$( tac "$UZBL_HISTORY_FILE" | $DMENU | cut -d ' ' -f -3 | awk '{ print $NF }' )" fi [ -n "$goto" ] && echo "uri $goto" > "$UZBL_FIFO" diff --git a/examples/data/scripts/session.sh b/examples/data/scripts/session.sh index 73ee99b..ea84da5 100755 --- a/examples/data/scripts/session.sh +++ b/examples/data/scripts/session.sh @@ -20,7 +20,7 @@ if [ -z "$UZBL_UTIL_DIR" ]; then # using the same logic as uzbl-browser does. UZBL_UTIL_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/scripts/util" if ! [ -d "$UZBL_UTIL_DIR" ]; then - PREFIX="$(grep '^PREFIX' "$(which uzbl-browser)" | sed -e 's/.*=//')" + PREFIX="$( grep '^PREFIX' "$( which uzbl-browser )" | sed -e 's/.*=//' )" UZBL_UTIL_DIR="$PREFIX/share/uzbl/examples/data/scripts/util" fi fi @@ -30,7 +30,7 @@ fi UZBL="uzbl-browser -c \"$UZBL_CONFIG_FILE\"" # add custom flags and whatever here. -scriptfile="$(readlink -f "$0")" # this script +scriptfile="$( readlink -f "$0" )" # this script act="$1" shift @@ -40,7 +40,7 @@ fi case $act in "launch" ) - urls="$(cat "$UZBL_SESSION_FILE")" + urls="$( cat "$UZBL_SESSION_FILE" )" if [ -z "$urls" ]; then $UZBL else diff --git a/examples/data/scripts/util/uzbl-window.sh b/examples/data/scripts/util/uzbl-window.sh index 35ce013..077887b 100644 --- a/examples/data/scripts/util/uzbl-window.sh +++ b/examples/data/scripts/util/uzbl-window.sh @@ -1,11 +1,11 @@ #!/bin/sh # uzbl window detection -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)" +UZBL_WIN_POS="$( xwininfo -id "$UZBL_XID" | \ + sed -n -e 's/Corners:[ ]*[+-]\([0-9]*\)[+-]\([0-9]*\).*$/\1 \2/p' )" +UZBL_WIN_SIZE="$( xwininfo -id "$UZBL_XID" | \ + sed -n -e '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 )" -- cgit v1.2.3