summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-08-21 21:45:57 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-08-21 21:45:57 -0400
commitc2e463cf2f120c6e5abf17c780312406dcbafe6c (patch)
tree7ff42148716bdf7a000b7b38b5536089e66a92d3
parenta522f9b78d4d364e61b39b35ed78a12dcef89b8c (diff)
wmii continue redo-ing config
-rwxr-xr-x.local/bin/notifyd14
-rwxr-xr-x.wmii/autostart1
-rwxr-xr-x.wmii/exec2
-rw-r--r--.wmii/include.sh70
-rwxr-xr-x.wmii/quit3
-rwxr-xr-x.wmii/rbar_battery10
-rwxr-xr-x.wmii/rbar_clock10
-rwxr-xr-x.wmii/rbar_cpu13
-rwxr-xr-x.wmii/rbar_wifi10
-rwxr-xr-x.wmii/wmiirc115
-rw-r--r--.wmii/wmiirc_local40
-rw-r--r--.xinitrc2
12 files changed, 166 insertions, 124 deletions
diff --git a/.local/bin/notifyd b/.local/bin/notifyd
new file mode 100755
index 0000000..ddd5971
--- /dev/null
+++ b/.local/bin/notifyd
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+connected_to_x_server() {
+ xdpyinfo &>/dev/null
+ return $?
+}
+
+start_backend() {
+ /usr/lib/xfce4/notifyd/xfce4-notifyd
+}
+
+while connected_to_x_server; do
+ start_backend
+done
diff --git a/.wmii/autostart b/.wmii/autostart
index b44ade8..aae23f4 100755
--- a/.wmii/autostart
+++ b/.wmii/autostart
@@ -1,3 +1,4 @@
#!/bin/bash
daemon lxpanel &> /dev/null
daemon wicd-client -t &> /dev/null
+daemon notifyd &> /dev/null
diff --git a/.wmii/exec b/.wmii/exec
deleted file mode 100755
index c83d790..0000000
--- a/.wmii/exec
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-echo exec "$@" >> $WMII_DIR/ctl
diff --git a/.wmii/include.sh b/.wmii/include.sh
new file mode 100644
index 0000000..36f8f3e
--- /dev/null
+++ b/.wmii/include.sh
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+if [ -z "$WMII_NAMESPACE" ]; then
+ export WMII_NAMESPACE=`wmiir namespace`
+fi
+if [ -z "$WMII_DIR" ]; then
+ export WMII_DIR=$WMII_NAMESPACE/mnt
+fi
+
+# a -- a work-around for buggy IO append in 9pfuse
+# useing '|a' should be just like using '>>', but will work
+# when 9pfuse decides to bug out.
+a() {
+ f="${1/#${WMII_DIR}/}"
+ if [ "$f" = "$1" ]; then
+ cat >> "$1"
+ else
+ if wmiir ls "$f" &>/dev/null; then
+ wmiir write "$f"
+ else
+ wmiir create "$f"
+ fi
+ fi
+}
+
+# I like wmiir's setsid better than linux-utils'
+setsid() { wmiir setsid "$@"; }
+
+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 '/^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
+}
diff --git a/.wmii/quit b/.wmii/quit
index d7a55c3..54f64e7 100755
--- a/.wmii/quit
+++ b/.wmii/quit
@@ -1,2 +1,3 @@
#!/bin/bash
-echo quit >> $WMII_DIR/ctl
+. "$HOME/.wmii/include.sh"
+echo quit |a $WMII_DIR/ctl
diff --git a/.wmii/rbar_battery b/.wmii/rbar_battery
new file mode 100755
index 0000000..7a7f24f
--- /dev/null
+++ b/.wmii/rbar_battery
@@ -0,0 +1,10 @@
+#!/bin/bash
+. "$HOME/.wmii/include.sh"
+
+priority=$1
+
+set -e
+while true; do
+ acpi -b |a "$WMII_DIR/rbar/${priority}_battery"
+ sleep 1
+done
diff --git a/.wmii/rbar_clock b/.wmii/rbar_clock
new file mode 100755
index 0000000..8e7d2a4
--- /dev/null
+++ b/.wmii/rbar_clock
@@ -0,0 +1,10 @@
+#!/bin/bash
+. "$HOME/.wmii/include.sh"
+
+priority=$1
+
+set -e
+while true; do
+ date |a "$WMII_DIR/rbar/${priority}_clock"
+ sleep .5
+done
diff --git a/.wmii/rbar_cpu b/.wmii/rbar_cpu
new file mode 100755
index 0000000..7f891da
--- /dev/null
+++ b/.wmii/rbar_cpu
@@ -0,0 +1,13 @@
+#!/bin/bash
+. "$HOME/.wmii/include.sh"
+
+priority=$1
+
+set -e
+while true; do
+ # This doesn't work for me, it shows capacity
+ #echo -n 'Core MHz:' $(cat /proc/cpuinfo | grep 'cpu MHz' | sed 's/.*: //g; s/\..*//g;') |a "$WMII_DIR/rbar/${priority}_cpu"
+ # This actually displays %idle
+ echo 'CPU: [ '$(tail -n3 ~/tmp/cputime|sed -ur 's/\s\s+/\t/g'|cut -f2,11|sed 's/\t\(.*\)/(\1)/')' ]' |a "$WMII_DIR/rbar/${priority}_cpu"
+ sleep 1
+done
diff --git a/.wmii/rbar_wifi b/.wmii/rbar_wifi
new file mode 100755
index 0000000..608b164
--- /dev/null
+++ b/.wmii/rbar_wifi
@@ -0,0 +1,10 @@
+#!/bin/bash
+. "$HOME/.wmii/include.sh"
+
+priority=$1
+
+set -e
+while true; do
+ echo 'Wlan0:' $(iwconfig wlan0 | sed 's/ /\n/g' | grep Quality) |a "$WMII_DIR/rbar/${priority}_wifi"
+ sleep 1
+done
diff --git a/.wmii/wmiirc b/.wmii/wmiirc
index f211d7f..82c424b 100755
--- a/.wmii/wmiirc
+++ b/.wmii/wmiirc
@@ -1,95 +1,30 @@
#!/bin/bash
# Let any running instances of wmiirc know that we're starting
-
-echo ' ==> Starting wmiirc'
wmiir xwrite /event Start
-export WMII_NAMESPACE=`wmiir namespace`
-mount9p=/opt/plan9/bin/9pfuse
+. "$HOME/.wmii/include.sh"
+echo ' ==> Starting wmiirc'
+mount9p=/opt/plan9/bin/9pfuse
mkdir -p $WMII_NAMESPACE/mnt
$mount9p $WMII_NAMESPACE/{wmii,mnt}
-export WMII_DIR=$WMII_NAMESPACE/mnt
-
-# a -- a work-around for buggy IO append in 9pfuse
-# useing '|a' should be just like using '>>', but will work
-# when 9pfuse decides to bug out.
-a() {
- f="${1/#${WMII_DIR}/}"
- if [ "$f" = "$1" ]; then
- cat >> "$1"
- else
- if wmiir ls "$f" &>/dev/null; then
- wmiir write "$f"
- else
- wmiir create "$f"
- fi
- fi
-}
-# I like wmiir's setsid better than linux-utils'
-setsid() { wmiir setsid "$@"; }
-WMII_FONT='xft:Monospace-8'
-WMII_TERM=x-terminal-emulator
-
-. $HOME/.wmii/wmiirc_local
-# Configuration Variables
+
+MODKEY=Mod4 # super
UP=p
DOWN=n
LEFT=b
RIGHT=f
# Colors tuples: "<text> <background> <border>"
-. $HOME/.wmii/theme-solarized-dark
+. `conffile theme-solarized-dark`
# Menu history
-hist="${WMII_CONFPATH%%:*}/history"
+hist="`conffile history`"
# Tagging Rules
-echo '/Emacs|Navigator/ -> +sel' |a $WMII_DIR/tagrules
-echo '/panel/ -> /.*/' |a $WMII_DIR/tagrules
-
-if [ -f "${WMII_CONFPATH%%:*}/wmiirc_local" ]; then
- . "${WMII_CONFPATH%%:*}/wmiirc_local"
-fi
-
-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 '/^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
-}
-
-Action() {
- prog=`path_which "$WMII_CONFPATH" $1`; shift
- if [ -n "$prog" ]; then
- "$prog" "$@"
- return $?
- else
- return 1
- fi
-}
+echo '/Emacs|Navigator/ -> +sel' >> $WMII_DIR/tagrules
+echo '/Eclipse/ -> +sel' >> $WMII_DIR/tagrules
+echo '/panel/ -> /.*/' >> $WMII_DIR/tagrules
Event() {
event=$1; shift;
@@ -107,10 +42,14 @@ Event() {
## WMII-meta events
Quit) ## No args
- fusermount -u $WMII_DIR
- exit $?;;
+ echo ' ==> Stopping wmiirc'
+ echo " -> unmounting WMII_DIR=$WMII_DIR..."
+ # might complain about /etc/mtab if the x server has already stopped
+ fusermount -u "$WMII_DIR" 2>>/dev/null
+ echo " -> rmdir'ing WMII_DIR=$WMII_DIR..."
+ rmdir "$WMII_DIR";;
Warning) ## $@=string
- notify-send "wmii warning: $@";;
+ notify-send "wmii warning: $*";;
Key) ## $1=keystroke
Key "$@";;
@@ -171,7 +110,7 @@ Event() {
## Tag events
CreateTag) ## $1=tag
- echo "$WMII_NORMCOLORS" $@ |a $WMII_DIR/lbar/$1;;
+ echo "$WMII_NORMCOLORS" $@ |a $WMII_DIR/lbar/$1;;
DestroyTag) ## $1=tag
rm $WMII_DIR/lbar/$1;;
FocusTag) ## $1=tag
@@ -264,7 +203,7 @@ Key() {
$MODKEY-x) ## Open program menu
setsid $(wimenu -h "${hist}.progs" -n 5000 <$progsfile) & ;;
$MODKEY-Return) ## Launch a terminal
- setsid $WMII_TERM & ;;
+ setsid x-terminal-emulator & ;;
## Other
$MODKEY-Control-t) ## Toggle all other key bindings
@@ -293,11 +232,11 @@ Key() {
} ## End Key
# WM Configuration
-echo font $WMII_FONT |a $WMII_DIR/ctl
+echo font xft:Monospace-8 |a $WMII_DIR/ctl
echo focuscolors $WMII_FOCUSCOLORS |a $WMII_DIR/ctl
-echo normcolors $WMII_NORMCOLORS |a $WMII_DIR/ctl
-echo grabmod $MODKEY |a $WMII_DIR/ctl
-echo border 1 |a $WMII_DIR/ctl
+echo normcolors $WMII_NORMCOLORS |a $WMII_DIR/ctl
+echo grabmod $MODKEY |a $WMII_DIR/ctl
+echo border 1 |a $WMII_DIR/ctl
xsetroot -solid "$WMII_BACKGROUND" &
progsfile=$WMII_NAMESPACE/.proglist
@@ -319,7 +258,13 @@ done
Action autostart 2>/dev/null &
+if [ -f "`conffile wmiirc_local`" ]; then
+ . "`conffile wmiirc_local`"
+fi
+
+trap "Event Quit" EXIT
+
# use wmiir so it doesn't look like an open file
-wmiir read /event | while read event; do
+wmiir read /event 2>/dev/null | while read event; do
Event $event
done
diff --git a/.wmii/wmiirc_local b/.wmii/wmiirc_local
index 616f569..1bcff2c 100644
--- a/.wmii/wmiirc_local
+++ b/.wmii/wmiirc_local
@@ -1,36 +1,6 @@
-#!/bin/bash
+#!/bin/bash this is included, not executed
-# wmiirc file for my HP Pavilion dv6426us laptop
-
-export MODKEY=Mod4
-
-status() {
- buffer=$(
- echo -n ' '
- # Wifi status
- echo -n 'Wlan0:' $(iwconfig wlan0 | sed 's/ /\n/g' | grep Quality)
-
- echo -n ' | '
-
- # Battery charge (not status)
- echo -n $(acpi -b | sed 's/.*, \{0,2\}\([0-9]\{1,3\}%\),.*/Bat: \1/')
-
- echo -n ' | '
- # CPU
- # This doesn't work for me, it shows capacity
- #echo -n 'Core MHz:' $(cat /proc/cpuinfo | grep 'cpu MHz' | sed 's/.*: //g; s/\..*//g;')
- # This actually displays %idle
- echo -n 'CPU: [ '$(tail -n3 ~/tmp/cputime|sed -ur 's/\s\s+/\t/g'|cut -f2,11|sed 's/\t\(.*\)/(\1)/')' ]'
-
- #echo -n ' | '
-
- #echo -n $(uptime | sed 's/.*://; s/,//g')
-
- echo -n ' | '
-
- echo -n $(date)
-
- echo -n ' '
- )
- echo "$buffer"
-}
+#Action rbar_cpu 01 &
+#Action rbar_wifi 97 &
+Action rbar_battery 98 &
+Action rbar_clock 99 &
diff --git a/.xinitrc b/.xinitrc
index 203a5cb..9c5ce55 100644
--- a/.xinitrc
+++ b/.xinitrc
@@ -11,7 +11,7 @@ if [ -d /etc/X11/xinit/xinitrc.d ]; then
[ -x "$f" ] && "$f" &
done
unset f
- echo ' -> done'
+ echo ' -> done'
fi
usermodmap="$HOME/.xmodmap"