aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorGravatar Ben Boeckel <MathStuf@gmail.com>2010-08-21 11:37:25 -0400
committerGravatar Ben Boeckel <MathStuf@gmail.com>2010-10-02 11:56:29 -0400
commit8eed5f24a0d40574433c3f3a945e6aac75e06aba (patch)
tree645929e6973c68958196a60c3ae25423980876a4 /examples
parenteeab3def726000c36cc0ba36ca0506b2eecbaf49 (diff)
Migrate to using the dmenu util script
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/data/scripts/formfiller.sh19
-rwxr-xr-xexamples/data/scripts/instance-select-wmii.sh10
-rwxr-xr-xexamples/data/scripts/load_url_from_bookmarks.sh14
-rwxr-xr-xexamples/data/scripts/load_url_from_history.sh21
4 files changed, 23 insertions, 41 deletions
diff --git a/examples/data/scripts/formfiller.sh b/examples/data/scripts/formfiller.sh
index 2c792bc..cf8e46b 100755
--- a/examples/data/scripts/formfiller.sh
+++ b/examples/data/scripts/formfiller.sh
@@ -37,22 +37,15 @@
# something else (or empty): if file not available: new, otherwise load.
#
-# config dmenu colors and prompt
-NB="#0f0f0f"
-NF="#4e7093"
-SB="#003d7c"
-SF="#3a9bff"
-
-if [ "$(dmenu --help 2>&1 | grep lines)x" != "x" ]; then
- LINES=" -l 3 "
-else
- LINES=""
-fi
+DMENU_ARGS="-i"
+DMENU_SCHEMA="formfiller"
+DMENU_LINES="3"
+DMENU_PROMPT="Choose profile"
+source $UZBL_UTIL_DIR/dmenu.sh
source $UZBL_UTIL_DIR/uzbl-args.sh
source $UZBL_UTIL_DIR/uzbl-dir.sh
-PROMPT="Choose profile"
MODELINE="> vim:ft=formfiller"
[ -d "$(dirname $UZBL_FORMS_DIR)" ] || exit 1
@@ -139,7 +132,7 @@ if [ "$action" = 'load' ]; then
if [ $(cat $UZBL_FORMS_DIR/$domain | grep "!profile" | wc -l) -gt 1 ]; then
menu=$(cat $UZBL_FORMS_DIR/$domain | \
sed -n 's/^!profile=\([^[:blank:]]\+\)/\1/p')
- option=$(echo -e -n "$menu" | dmenu ${LINES} -nb "${NB}" -nf "${NF}" -sb "${SB}" -sf "${SF}" -p "${PROMPT}")
+ option=$(echo -e -n "$menu" | $DMENU)
fi
# Remove comments
diff --git a/examples/data/scripts/instance-select-wmii.sh b/examples/data/scripts/instance-select-wmii.sh
index 1340351..82acf3b 100755
--- a/examples/data/scripts/instance-select-wmii.sh
+++ b/examples/data/scripts/instance-select-wmii.sh
@@ -11,13 +11,7 @@
# See http://www.uzbl.org/wiki/wmii for more info
# $1 must be one of 'list', 'next', 'prev'
-COLORS=" -nb #303030 -nf khaki -sb #CCFFAA -sf #303030"
-
-if dmenu --help 2>&1 | grep -q '\[-rs\] \[-ni\] \[-nl\] \[-xs\]'; then
- DMENU="dmenu -i -xs -rs -l 10" # vertical patch
-else
- DMENU="dmenu -i"
-fi
+source $UZBL_UTIL_DIR/dmenu.sh
if [ "$1" == 'list' ]; then
list=
@@ -26,7 +20,7 @@ if [ "$1" == 'list' ]; then
label=$(wmiir read /client/$i/label)
list="$list$i : $label\n"
done
- window=$(echo -e "$list" | $DMENU $COLORS | cut -d ' ' -f1)
+ window=$(echo -e "$list" | $DMENU | cut -d ' ' -f1)
wmiir xwrite /tag/sel/ctl "select client $window"
elif [ "$1" == 'next' ]; then
current=$(wmiir read /client/sel/ctl | head -n 1)
diff --git a/examples/data/scripts/load_url_from_bookmarks.sh b/examples/data/scripts/load_url_from_bookmarks.sh
index 3bcb60f..1cf8ea4 100755
--- a/examples/data/scripts/load_url_from_bookmarks.sh
+++ b/examples/data/scripts/load_url_from_bookmarks.sh
@@ -2,20 +2,18 @@
#NOTE: it's the job of the script that inserts bookmarks to make sure there are no dupes.
+source $UZBL_UTIL_DIR/dmenu.sh
source $UZBL_UTIL_DIR/uzbl-args.sh
source $UZBL_UTIL_DIR/uzbl-dir.sh
[ -r "$UZBL_BOOKMARKS_FILE" ] || exit 1
-COLORS=" -nb #303030 -nf khaki -sb #CCFFAA -sf #303030"
-if dmenu --help 2>&1 | grep -q '\[-rs\] \[-ni\] \[-nl\] \[-xs\]'; then
- DMENU="dmenu -i -xs -rs -l 10" # vertical patch
- # show tags as well
- goto=$($DMENU $COLORS < $UZBL_BOOKMARKS_FILE | awk '{print $1}')
+if [ "x$DMENU_HAS_VERTICAL" = "x" ]; then
+ # because they are all after each other, just show the url, not their tags.
+ goto=$(awk '{print $1}' $UZBL_BOOKMARKS_FILE | $DMENU)
else
- DMENU="dmenu -i"
- # because they are all after each other, just show the url, not their tags.
- goto=$(awk '{print $1}' $UZBL_BOOKMARKS_FILE | $DMENU $COLORS)
+ # show tags as well
+ 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 5aba844..f79e018 100755
--- a/examples/data/scripts/load_url_from_history.sh
+++ b/examples/data/scripts/load_url_from_history.sh
@@ -1,24 +1,21 @@
#!/bin/sh
+source $UZBL_UTIL_DIR/dmenu.sh
source $UZBL_UTIL_DIR/uzbl-args.sh
source $UZBL_UTIL_DIR/uzbl-dir.sh
[ -r "$UZBL_HISTORY_FILE" ] || exit 1
# choose from all entries, sorted and uniqued
-# goto=$(awk '{print $3}' $UZBL_HISTORY_FILE | sort -u | dmenu -i)
-COLORS=" -nb #303030 -nf khaki -sb #CCFFAA -sf #303030"
-if dmenu --help 2>&1 | grep -q '\[-rs\] \[-ni\] \[-nl\] \[-xs\]'; then
- DMENU="dmenu -i -xs -rs -l 10" # vertical patch
- # 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 $COLORS | cut -d ' ' -f -3 | awk '{print $NF}')
+# goto=$(awk '{print $3}' $history_file | sort -u | dmenu -i)
+if [ "x$DMENU_HAS_VERTICAL" = "x" ]; 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)
else
- DMENU="dmenu -i"
- # choose from all entries (no date or title), the first one being current url, and after that all others, sorted and uniqued, in ascending order
- 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 $COLORS)
+ # 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}')
fi
[ -n "$goto" ] && echo "uri $goto" > $UZBL_FIFO