summaryrefslogtreecommitdiff
path: root/.config/wmii-hg
diff options
context:
space:
mode:
Diffstat (limited to '.config/wmii-hg')
-rw-r--r--.config/wmii-hg/config.sh12
-rw-r--r--.config/wmii-hg/util.sh31
2 files changed, 16 insertions, 27 deletions
diff --git a/.config/wmii-hg/config.sh b/.config/wmii-hg/config.sh
index 3ddc8d5..3b1b20f 100644
--- a/.config/wmii-hg/config.sh
+++ b/.config/wmii-hg/config.sh
@@ -163,9 +163,8 @@ Event() {
RightMouseDND) ## $1=button $2=bar_item
Event RightBarClick "$@";;
esac
-} ## End Event
+}
-# Key Bindings
Key() {
key=$1
case "$key" in
@@ -237,14 +236,13 @@ Key() {
echo "$tag" >> $WMII_DIR/client/$sel/tags
}& ;;
esac
-} ## End Key
+}
Action() {
- prog=`path_which "$WMII_CONFPATH" $1`; shift
+ prog=$(path_which "$WMII_CONFPATH" "$1"); shift
if [ -n "$prog" ]; then
"$prog" "$@"
- return $?
else
- return 1
+ false
fi
-} ## End Action
+}
diff --git a/.config/wmii-hg/util.sh b/.config/wmii-hg/util.sh
index 71dbc41..f15031e 100644
--- a/.config/wmii-hg/util.sh
+++ b/.config/wmii-hg/util.sh
@@ -35,7 +35,6 @@ is_mounted() {
local dir="$(readlink -m $1)"
local mntpnt="$(cut -d' ' -f2 /proc/mounts|grep -Fx -- "$dir")"
[[ $dir = "$mntpnt" ]]
- return $?
}
################################################################################
@@ -85,7 +84,6 @@ lstags() {
##
connected_to_x_server() {
xdpyinfo &>/dev/null
- return $?
}
################################################################################
@@ -93,32 +91,25 @@ connected_to_x_server() {
################################################################################
##
-# Usage: scansection [SECTION]
+# Usage: scansection SECTION
# Reads the doc comments from a section of wmiirc.
-# If SECTION is not given, it reads all doc comments.
##
scansection() {
- local file=$(conffile config.sh)
local sec=$1
- local tmp=$(mktemp --tmpdir wmii-scansecion.XXXXXXXXXX)
- # Isolate the sections we want.
- if [ -n "$sec" ]; then
- # Find the section
- < "$file" sed -n "/^\s*$sec\s*()/,/##\s*End $sec/p" | sed '1d;$d'> "$tmp"
- else
- # Remove extra lines that mark the end of a section
- < "$file" sed "/\s*}\s*##\s*End\s/d" > "$tmp"
- fi
- < "$tmp" sed -n '/##/p' | while read; do
- var="$(echo "$REPLY" | sed -nr 's/^\s*(.*)\)\s*##.*/\1/p')"
- comment="$(echo "$REPLY" | sed -r 's/.*## ?//')"
- if [ -z "$var" ]; then
+
+ local file=$(conffile config.sh)
+ # Isolate the section we want.
+ < "$file" sed -n "/^\s*$sec\s*()/,/^}/{ /##/p }" |
+ # Parse each line.
+ while read -r line; do
+ symbol="$(sed -nr 's/^\s*(.*)\)\s*##.*/\1/p' <<<"$line")"
+ comment="$(sed -r 's/.*## ?//' <<<"$line")"
+ if [ -z "$symbol" ]; then
printf '%s\n' "$comment"
else
- printf '\t%s\t%s\n' "$(echo "$var"|expand_variables)" "$comment"
+ printf '\t%s\t%s\n' "$(expand_variables <<<"$symbol")" "$comment"
fi
done
- rm -- "$tmp"
}
##