From 4414160a4cce0080f3f2b33f9e7a7583c77c7062 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 15 Oct 2012 17:36:00 -0400 Subject: wmii: refactor --- .wmii/include.sh | 71 ++++---------------------------------------------------- 1 file changed, 5 insertions(+), 66 deletions(-) (limited to '.wmii/include.sh') diff --git a/.wmii/include.sh b/.wmii/include.sh index b1ec901..43855e6 100644 --- a/.wmii/include.sh +++ b/.wmii/include.sh @@ -1,76 +1,15 @@ #!/bin/bash if [ -z "$WMII_NAMESPACE" ]; then - export WMII_NAMESPACE=`wmiir namespace` + export WMII_NAMESPACE="`wmiir namespace`" fi if [ -z "$WMII_DIR" ]; then export WMII_DIR="$HOME/n/wmii" fi -# Linux's 9p kernel module sometimes omits entries in directory listings -unalias ls 2>/dev/null -ls() { - real_ls="`which ls` -1F" - [ $# = 0 ] && set -- "`pwd`" - case $# in - 1) - f="${1/#${WMII_DIR}/}" - if [ "$f" = "$1" ]; then - $real_ls "$f" - else - wmiir ls "$f" - fi - ;; - *) $real_ls "$f";; - esac -} +. "$HOME/.wmii/util.sh" -# I like wmiir's setsid better than linux-utils' -setsid() { wmiir setsid "$@"; } +hist="`conffile history`" +progsfile=$WMII_NAMESPACE/.proglist -path_ls() { - find -L `echo "$@"|sed 'y/:/ /'` -maxdepth 1 -type f -executable -printf '%f\n' 2>/dev/null| sort -u -} - -path_which() { - mypath=$1 - prog=$2 - which=`which which` - PATH="$mypath" "$which" -- "$prog" 2>/dev/null -} - -lstags() { - ls $WMII_DIR/tag | sed -e 's@/@@' -e '/^sel$/d' -} - -scansection() { - file=`path_which "$WMII_CONFPATH" wmiirc` - sec=$1 - tmp=`mktemp` - if [ -n "$sec" ]; then - < "$file" sed -n "/^\s*$sec\s*()/,/##\s*End $sec/p" | sed '1d;$d'> $tmp - else - < "$file" sed "/\s*}\s*##\s*End\s/d" > $tmp - fi - < $tmp sed -n '/##/p'|sed -r 's/^\s*(.*)\)\s*## ?/\t\1\t/;s/\s*## ?//' - rm $tmp -} - -conffile() { - echo "$HOME/.wmii/$@" -} - -Action() { - prog=`path_which "$WMII_CONFPATH" $1`; shift - if [ -n "$prog" ]; then - "$prog" "$@" - return $? - else - return 1 - fi -} - -connected_to_x_server() { - xdpyinfo &>/dev/null - return $? -} +. "$HOME/.wmii/config.sh" -- cgit v1.2.3-2-g168b