summaryrefslogtreecommitdiff
path: root/.wmii
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-10-16 19:09:42 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-10-16 19:09:42 -0400
commit1ff883371700757696efafefe266572776ac9558 (patch)
treed2104f7f405f4fe7a8957e86f53300ee6d4b1aeb /.wmii
parent3d607ee3f5dc7fd27bbce6c447e02778310a4b9d (diff)
parent3515a46d330af1d09bf1e0b963c13a86c2dbe8a8 (diff)
Merge branch 'master' into build64-par
Conflicts: .login-daemons
Diffstat (limited to '.wmii')
-rwxr-xr-x.wmii/autostart13
-rw-r--r--.wmii/config.sh249
-rw-r--r--.wmii/ctl-init5
-rw-r--r--.wmii/fixes.sh24
-rwxr-xr-x.wmii/help-events3
-rwxr-xr-x.wmii/help-keys3
-rw-r--r--.wmii/include.sh67
-rwxr-xr-x.wmii/quit2
-rwxr-xr-x.wmii/rbar_battery5
-rwxr-xr-x.wmii/rbar_clock5
-rwxr-xr-x.wmii/rbar_cpu7
-rwxr-xr-x.wmii/rbar_wifi5
-rw-r--r--.wmii/tagrules3
-rw-r--r--.wmii/util.sh128
-rwxr-xr-x.wmii/wmiirc262
-rwxr-xr-x.wmii/wmiirc_local37
16 files changed, 441 insertions, 377 deletions
diff --git a/.wmii/autostart b/.wmii/autostart
index aae23f4..e78b22b 100755
--- a/.wmii/autostart
+++ b/.wmii/autostart
@@ -1,4 +1,11 @@
#!/bin/bash
-daemon lxpanel &> /dev/null
-daemon wicd-client -t &> /dev/null
-daemon notifyd &> /dev/null
+. "$HOME/.wmii/include.sh"
+
+daemon lxpanel &> /dev/null
+#daemon nm-applet &> /dev/null
+daemon notifyd &> /dev/null
+daemon blueman-applet &> /dev/null
+#daemon linphone --iconified &> /dev/null
+
+Action rbar_cpu 01
+Action rbar_clock 99
diff --git a/.wmii/config.sh b/.wmii/config.sh
new file mode 100644
index 0000000..1dac0ad
--- /dev/null
+++ b/.wmii/config.sh
@@ -0,0 +1,249 @@
+#!/bin/bash
+
+MODKEY=Mod4 # "super"
+UP=p
+DOWN=n
+LEFT=b
+RIGHT=f
+
+HIST="`conffile history`"
+
+# Colors tuples: "<text> <background> <border>"
+. `conffile theme-solarized-dark`
+
+Event() {
+ event=$1; shift;
+ case "$event" in
+ ## Mouse event meanings:
+ ## MouseDown = mouse down
+ ## Click = mouse up
+ ## DND = hover, while dragging something (Drag 'n' Drop)
+ ## The associated mouse button is always "1"
+ ##
+ ## Mouse-button IDs:
+ ## 1 = left
+ ## 2 = middle
+ ## 3 = right
+
+ ## Custom (non-WMII-generated) events
+ WmiircStart) ## No args
+ echo ' ==> Starting wmiirc'
+ is_mounted $WMII_DIR && Event WmiircUnmount
+ Event WmiircMount
+
+ # Configure wmii
+ < "`conffile tagrules`" expand_variables >> $WMII_DIR/tagrules
+ < "`conffile ctl-init`" expand_variables >> $WMII_DIR/ctl
+ scansection Key | cut -sf2 >> $WMII_DIR/keys
+ # Configure X11
+ xsetroot -solid "$WMII_BACKGROUND"
+
+ # Clear the LBar and RBar
+ find $WMII_DIR/{l,r}bar -type f -delete
+ # Populate the LBar by emulating [Create|Focus]Tag events
+ seltag=`sed 1q $WMII_DIR/tag/sel/ctl`
+ lstags | while read tag; do
+ Event CreateTag "$tag"
+ if [ "$tag" = "$seltag" ]; then
+ Event FocusTag "$tag"
+ fi
+ done
+
+ # Run the autostart action
+ Action autostart 2>/dev/null &
+ ;;
+ WmiircQuit) ## No args
+ echo ' ==> Stopping wmiirc'
+ exit;;
+ WmiircMount) ## No args
+ echo " -> Creating mountpoint WMII_DIR=$WMII_DIR..."
+ mkdir -p "$WMII_DIR"
+ echo " -> Mounting WMII_DIR=$WMII_DIR..."
+ 9mount -i "unix!$WMII_NAMESPACE/wmii" "$WMII_DIR";;
+ WmiircUnmount) ## No args
+ echo " -> Unmounting WMII_DIR=$WMII_DIR..."
+ 9umount "$WMII_DIR"
+ echo " -> Removing mountpoint WMII_DIR=$WMII_DIR..."
+ rmdir "$WMII_DIR";;
+ ## WMII-meta events
+ Quit) ## No args
+ echo ' ==> wmii quit: unmounting'
+ trap - EXIT
+ Event WmiircUnmount
+ Event WmiircQuit;;
+ Warning) ## $@=string
+ notify-send "wmii warning: $*";;
+ Key) ## $1=keystroke
+ Key "$@";;
+
+ ## WMII Window management events
+ FocusFloating) ## No args
+ ;;
+ AreaFocus) ## $1=area
+ ;;
+ DestroyArea) ## $1=area
+ ;;
+ ColumnFocus) ## $1=column
+ ;;
+ CreateColumn) ## $1=column
+ ;;
+
+ ## Client events
+ CreateClient) ## $1=client
+ ;;
+ DestroyClient) ## $1=client
+ ;;
+ Urgent) ## $1=client $2=[Manager|Client]
+ ;;
+ NotUrgent) ## $1=client $2=[Manager|Client]
+ ;;
+ ClientMouseDown) ## $1=client $2=button
+ client=$1
+ button=$2
+ case $button in
+ 1) ;;
+ 2) ;;
+ 3)
+ {
+ case `wmii9menu Delete Fullscreen` in
+ Delete)
+ echo kill >> $WMII_DIR/client/$client/ctl;;
+ Fullscreen)
+ echo Fullscreen on >> $WMII_DIR/client/$1/ctl;;
+ esac
+ }& ;;
+ esac;;
+ ClientClick) ## $1=client $2=button
+ ;;
+ Unresponsive) ## $1=client
+ client=$1
+ client_name=`cat $WMII_DIR/client/$client/label`
+ msg="The client \`${client_name}' is not responding."
+ msg+=" What would you like to do?"
+ {
+ resp=$(wihack -transient $client \
+ xmessage -nearmouse -buttons Kill,Wait -print "$msg")
+ if [ "$resp" = Kill ]; then
+ echo slay >> $WMII_DIR/client/$client/ctl
+ fi
+ }& ;;
+ Fullscreen) ## $1=client $2=[on|off]
+ # TODO: hide any clients with the 'panel' class
+ ;;
+
+ ## Tag events
+ CreateTag) ## $1=tag
+ echo "$WMII_NORMCOLORS" $@ >> $WMII_DIR/lbar/$1;;
+ DestroyTag) ## $1=tag
+ rm $WMII_DIR/lbar/$1;;
+ FocusTag) ## $1=tag
+ echo "$WMII_FOCUSCOLORS" $1 >> $WMII_DIR/lbar/$1;;
+ UnfocusTag) ## $1=tag
+ echo "$WMII_NORMCOLORS" $1 >> $WMII_DIR/lbar/$1;;
+ UrgentTag) ## $1=tag $2=[Manager|Client]
+ echo "$WMII_URGENTCOLORS" $1 >> $WMII_DIR/lbar/$1;;
+ NotUrgentTag) ## $1=tag $2=[Manager|Client]
+ echo "$WMII_NORMCOLORS" $1 >> $WMII_DIR/lbar/$1;;
+
+ ## LeftBar events (usually tag buttons)
+ LeftBarMouseDown) ## $1=button $2=bar_item
+ ;;
+ LeftBarClick) ## $1=button $2=bar_item
+ shift # ignore the button
+ echo view "$@" >> $WMII_DIR/ctl;;
+ LeftMouseDND) ## $1=button $2=bar_item
+ Event LeftBarClick "$@";;
+
+ ## RightBar events
+ RightBarMouseDown) ## $1=button $2=bar_item
+ ;;
+ RightBarClick) ## $1=button $2=bar_item
+ ;;
+ RightMouseDND) ## $1=button $2=bar_item
+ Event RightBarClick "$@";;
+ esac
+} ## End Event
+
+# Key Bindings
+Key() {
+ key=$1
+ case "$key" in
+ ## Moving around
+
+ $MODKEY-$LEFT) ## Select the client to the left
+ echo select left >> $WMII_DIR/tag/sel/ctl;;
+ $MODKEY-$RIGHT) ## Select the client to the right
+ echo select right >> $WMII_DIR/tag/sel/ctl;;
+ $MODKEY-$UP) ## Select the client above
+ echo select up >> $WMII_DIR/tag/sel/ctl;;
+ $MODKEY-$DOWN) ## Select the client below
+ echo select down >> $WMII_DIR/tag/sel/ctl;;
+
+ $MODKEY-space) ## Toggle between floating and managed layers
+ echo select toggle >> $WMII_DIR/tag/sel/ctl;;
+
+ ## Moving clients around
+
+ $MODKEY-Shift-$LEFT) ## Move selected client to the left
+ echo send sel left >> $WMII_DIR/tag/sel/ctl;;
+ $MODKEY-Shift-$RIGHT) ## Move selected client to the right
+ echo send sel right >> $WMII_DIR/tag/sel/ctl;;
+ $MODKEY-Shift-$UP) ## Move selected client up
+ echo send sel up >> $WMII_DIR/tag/sel/ctl;;
+ $MODKEY-Shift-$DOWN) ## Move selected client down
+ echo send sel down >> $WMII_DIR/tag/sel/ctl;;
+ $MODKEY-Shift-space) ## Toggle selected client between floating and managed layers
+ echo send sel toggle >> $WMII_DIR/tag/sel/ctl;;
+
+ ## Moving through stacks
+ $MODKEY-Control-$UP) ## Select the stack above
+ echo select up stack >> $WMII_DIR/tag/sel/ctl;;
+ $MODKEY-Control-$DOWN) ## Select the stack below
+ echo select down stack >> $WMII_DIR/tag/sel/ctl;;
+
+ ## Client actions
+ $MODKEY-shift-1) ## Toggle selected client's fullsceen state
+ echo Fullscreen toggle >> $WMII_DIR/client/sel/ctl;;
+ $MODKEY-shift-0) ## Close client
+ echo kill >> $WMII_DIR/client/sel/ctl;;
+
+ ## Changing column modes
+ $MODKEY-d) ## Set column to default mode
+ echo colmode sel default-max >> $WMII_DIR/tag/sel/ctl;;
+ $MODKEY-s) ## Set column to stack mode
+ echo colmode sel stack-max >> $WMII_DIR/tag/sel/ctl;;
+ $MODKEY-m) ## Set column to max mode
+ echo colmode sel stack+max >> $WMII_DIR/tag/sel/ctl;;
+
+ ## Running programs
+ $MODKEY-a) ## Open wmii actions menu
+ Action $(path_ls $WMII_CONFPATH | wimenu -h "${HIST}.actions" -n 5000) & ;;
+ $MODKEY-x) ## Open program menu
+ setsid $(path_ls $PATH | wimenu -h "${HIST}.progs" -n 5000) & ;;
+ $MODKEY-Return) ## Launch a terminal
+ setsid x-terminal-emulator & ;;
+
+ ## Tag actions
+ $MODKEY-t) ## Change to another tag
+ {
+ tag=$(lstags | wimenu -h "${HIST}.tags" -n 50) || return
+ echo view $tag >> $WMII_DIR/ctl
+ }& ;;
+ $MODKEY-Shift-t) ## Retag the selected client
+ sel=$(sed 1q $WMII_DIR/client/sel/ctl)
+ {
+ tag=$(lstags | wimenu -h "${HIST}.tags" -n 50) || return
+ echo "$tag" >> $WMII_DIR/client/$sel/tags
+ }& ;;
+ esac
+} ## End Key
+
+Action() {
+ prog=`path_which "$WMII_CONFPATH" $1`; shift
+ if [ -n "$prog" ]; then
+ "$prog" "$@"
+ return $?
+ else
+ return 1
+ fi
+} ## End Action
diff --git a/.wmii/ctl-init b/.wmii/ctl-init
new file mode 100644
index 0000000..026c0d5
--- /dev/null
+++ b/.wmii/ctl-init
@@ -0,0 +1,5 @@
+font xft:Monospace-8
+focuscolors $WMII_FOCUSCOLORS
+normcolors $WMII_NORMCOLORS
+grabmod $MODKEY
+border 1
diff --git a/.wmii/fixes.sh b/.wmii/fixes.sh
new file mode 100644
index 0000000..aa09157
--- /dev/null
+++ b/.wmii/fixes.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+# Fix various deficiencies in either the shell or the filesystem
+
+##
+# Usage: ls DIRECTORY
+# Linux's 9p kernel module sometimes omits entries in directory listings
+##
+unalias ls &>/dev/null
+ls() {
+ real_ls="`which ls` -1F"
+ [ $# = 0 ] && set -- "`pwd`"
+ f="${1/#${WMII_DIR}/}"
+ if [ "$f" = "$1" ]; then
+ $real_ls "$f"
+ else
+ wmiir ls "$f"
+ fi
+}
+
+##
+# Usage: setsid cmd [arguments...]
+# I like wmiir's setsid better than linux-utils'
+##
+setsid() { wmiir setsid "$@"; }
diff --git a/.wmii/help-events b/.wmii/help-events
new file mode 100755
index 0000000..25b7d41
--- /dev/null
+++ b/.wmii/help-events
@@ -0,0 +1,3 @@
+#!/bin/bash
+. "$HOME/.wmii/include.sh"
+scansection Event | xmessage -file -
diff --git a/.wmii/help-keys b/.wmii/help-keys
new file mode 100755
index 0000000..c6e7038
--- /dev/null
+++ b/.wmii/help-keys
@@ -0,0 +1,3 @@
+#!/bin/bash
+. "$HOME/.wmii/include.sh"
+scansection Key | xmessage -file -
diff --git a/.wmii/include.sh b/.wmii/include.sh
index 36f8f3e..d4e58c3 100644
--- a/.wmii/include.sh
+++ b/.wmii/include.sh
@@ -1,70 +1,11 @@
#!/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=$WMII_NAMESPACE/mnt
+ export WMII_DIR="$HOME/n/wmii"
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
-}
+. "$HOME/.wmii/util.sh"
+. "$HOME/.wmii/config.sh"
diff --git a/.wmii/quit b/.wmii/quit
index 54f64e7..876a60e 100755
--- a/.wmii/quit
+++ b/.wmii/quit
@@ -1,3 +1,3 @@
#!/bin/bash
. "$HOME/.wmii/include.sh"
-echo quit |a $WMII_DIR/ctl
+echo quit >> $WMII_DIR/ctl
diff --git a/.wmii/rbar_battery b/.wmii/rbar_battery
index 7a7f24f..ae8980a 100755
--- a/.wmii/rbar_battery
+++ b/.wmii/rbar_battery
@@ -3,8 +3,7 @@
priority=$1
-set -e
-while true; do
- acpi -b |a "$WMII_DIR/rbar/${priority}_battery"
+while connected_to_x_server; do
+ acpi -b >> "$WMII_DIR/rbar/${priority}_battery"
sleep 1
done
diff --git a/.wmii/rbar_clock b/.wmii/rbar_clock
index 8e7d2a4..18c4493 100755
--- a/.wmii/rbar_clock
+++ b/.wmii/rbar_clock
@@ -3,8 +3,7 @@
priority=$1
-set -e
-while true; do
- date |a "$WMII_DIR/rbar/${priority}_clock"
+while connected_to_x_server; do
+ date >> "$WMII_DIR/rbar/${priority}_clock"
sleep .5
done
diff --git a/.wmii/rbar_cpu b/.wmii/rbar_cpu
index 7f891da..22da985 100755
--- a/.wmii/rbar_cpu
+++ b/.wmii/rbar_cpu
@@ -3,11 +3,10 @@
priority=$1
-set -e
-while true; do
+while connected_to_x_server; 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"
+ #echo -n 'Core MHz:' $(cat /proc/cpuinfo | grep 'cpu MHz' | sed 's/.*: //g; s/\..*//g;') >> "$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"
+ echo 'CPU: [ '$(tail -n3 ~/tmp/cputime|sed -ur 's/\s\s+/\t/g'|cut -f2,11|sed 's/\t\(.*\)/(\1)/')' ]' >> "$WMII_DIR/rbar/${priority}_cpu"
sleep 1
done
diff --git a/.wmii/rbar_wifi b/.wmii/rbar_wifi
index 608b164..2ada834 100755
--- a/.wmii/rbar_wifi
+++ b/.wmii/rbar_wifi
@@ -3,8 +3,7 @@
priority=$1
-set -e
-while true; do
- echo 'Wlan0:' $(iwconfig wlan0 | sed 's/ /\n/g' | grep Quality) |a "$WMII_DIR/rbar/${priority}_wifi"
+while connected_to_x_server; do
+ echo 'Wlan0:' $(iwconfig wlan0 | sed 's/ /\n/g' | grep Quality) >> "$WMII_DIR/rbar/${priority}_wifi"
sleep 1
done
diff --git a/.wmii/tagrules b/.wmii/tagrules
new file mode 100644
index 0000000..990151f
--- /dev/null
+++ b/.wmii/tagrules
@@ -0,0 +1,3 @@
+/Emacs|Navigator/ -> +sel
+/Eclipse/ -> +sel
+/panel/ -> /.*/
diff --git a/.wmii/util.sh b/.wmii/util.sh
new file mode 100644
index 0000000..43d7d4a
--- /dev/null
+++ b/.wmii/util.sh
@@ -0,0 +1,128 @@
+#!/bin/bash
+
+# I moved "fixes" into a separate file because it isn't so much configuration...
+. "$HOME/.wmii/fixes.sh"
+
+################################################################################
+# Added shell features #
+################################################################################
+
+##
+# Usage: dquote STRING
+# Safely double-quotes a string.
+# It escapes ways to execute code, but not variables.
+##
+dquote() {
+ str=$1
+ str="${str//\\/\\\\}" # backslash
+ str="${str//\"/\\\"}" # dquote
+ str="${str//\$(/\\\$(}" # $(...)
+ str="${str//\`/\\\`}" # backtick
+ printf '"%s"\n' "$str"
+}
+
+##
+# Usage: expand_variables
+# Expands variables read from /dev/stdin
+##
+expand_variables() {
+ while read; do
+ eval printf "'%s\n'" "$(dquote "$REPLY")"
+ done
+}
+
+is_mounted() {
+ dir="$(readlink -m $1)"
+ mntpnt="$(cut -d' ' -f2 /proc/mounts|grep -- "$dir")"
+ [[ $dir = "$mntpnt" ]]
+ return $?
+}
+
+################################################################################
+# PATH manipulation #
+################################################################################
+
+##
+# Usage: path_ls PATH
+# List executables in PATH (PATH is delimited by `:')
+##
+path_ls() {
+ dirs="`echo "$@"|sed 'y/:/ /'`"
+ find -L $dirs -maxdepth 1 -type f -executable -printf '%f\n' 2>/dev/null | sort -u
+}
+
+##
+# Usage: path_which PATH PROGRAM
+# Find the full path of PROGRAM by searching PATH
+##
+path_which() {
+ mypath=$1
+ prog=$2
+ which=`which which`
+ PATH="$mypath" "$which" -- "$prog" 2>/dev/null
+}
+
+################################################################################
+# wmii convenience functions #
+################################################################################
+
+##
+# Usage: lstags
+# Lists wmii tags
+##
+lstags() {
+ ls $WMII_DIR/tag | sed -e 's@/@@' -e '/^sel$/d'
+}
+
+################################################################################
+# X11 functions #
+################################################################################
+
+##
+# Usage: connected_to_x_server
+# Return status indicates whether there is an X server at $DISPLAY
+##
+connected_to_x_server() {
+ xdpyinfo &>/dev/null
+ return $?
+}
+
+################################################################################
+# My wmii configuration #
+################################################################################
+
+##
+# Usage: scansection [SECTION]
+# Reads the doc comments from a section of wmiirc.
+# If SECTION is not given, it reads all doc comments.
+##
+scansection() {
+ file=`conffile config.sh`
+ sec=$1
+ tmp=`mktemp`
+ # 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
+ printf '%s\n' "$comment"
+ else
+ printf '\t%s\t%s\n' "$(echo "$var"|expand_variables)" "$comment"
+ fi
+ done
+ rm $tmp
+}
+
+##
+# Usage: conffile FILE
+##
+conffile() {
+ echo "$HOME/.wmii/$@"
+}
diff --git a/.wmii/wmiirc b/.wmii/wmiirc
index 82c424b..1f1ea18 100755
--- a/.wmii/wmiirc
+++ b/.wmii/wmiirc
@@ -1,270 +1,12 @@
#!/bin/bash
-# Let any running instances of wmiirc know that we're starting
-wmiir xwrite /event Start
-
. "$HOME/.wmii/include.sh"
-echo ' ==> Starting wmiirc'
-mount9p=/opt/plan9/bin/9pfuse
-mkdir -p $WMII_NAMESPACE/mnt
-$mount9p $WMII_NAMESPACE/{wmii,mnt}
-
-MODKEY=Mod4 # super
-UP=p
-DOWN=n
-LEFT=b
-RIGHT=f
-
-# Colors tuples: "<text> <background> <border>"
-. `conffile theme-solarized-dark`
-
-# Menu history
-hist="`conffile history`"
-
-# Tagging Rules
-echo '/Emacs|Navigator/ -> +sel' >> $WMII_DIR/tagrules
-echo '/Eclipse/ -> +sel' >> $WMII_DIR/tagrules
-echo '/panel/ -> /.*/' >> $WMII_DIR/tagrules
-
-Event() {
- event=$1; shift;
- case "$event" in
- ## Mouse event meanings:
- ## MouseDown = mouse down
- ## Click = mouse up
- ## DND = hover, while dragging something (Drag 'n' Drop)
- ## The associated mouse button is always "1"
- ##
- ## Mouse-button IDs:
- ## 1 = left
- ## 2 = middle
- ## 3 = right
-
- ## WMII-meta events
- Quit) ## No args
- 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: $*";;
- Key) ## $1=keystroke
- Key "$@";;
-
- ## WMII Window management events
- FocusFloating) ## No args
- ;;
- AreaFocus) ## $1=area
- ;;
- DestroyArea) ## $1=area
- ;;
- ColumnFocus) ## $1=column
- ;;
- CreateColumn) ## $1=column
- ;;
-
- ## Client events
- CreateClient) ## $1=client
- ;;
- DestroyClient) ## $1=client
- ;;
- Urgent) ## $1=client $2=[Manager|Client]
- ;;
- NotUrgent) ## $1=client $2=[Manager|Client]
- ;;
- ClientMouseDown) ## $1=client $2=button
- client=$1
- button=$2
- case $button in
- 1) ;;
- 2) ;;
- 3)
- {
- case `wmii9menu Delete Fullscreen` in
- Delete)
- echo kill |a $WMII_DIR/client/$client/ctl;;
- Fullscreen)
- echo Fullscreen on |a $WMII_DIR/client/$1/ctl;;
- esac
- }& ;;
- esac;;
- ClientClick) ## $1=client $2=button
- ;;
- Unresponsive) ## $1=client
- client=$1
- client_name=`cat $WMII_DIR/client/$client/label`
- msg="The client \`${client_name}' is not responding."
- msg+=" What would you like to do?"
- {
- resp=$(wihack -transient $client \
- xmessage -nearmouse -buttons Kill,Wait -print "$msg")
- if [ "$resp" = Kill ]; then
- echo slay |a $WMII_DIR/client/$client/ctl
- fi
- }& ;;
- Fullscreen) ## $1=client $2=[on|off]
- # TODO: hide any clients with the 'panel' class
- ;;
-
- ## Tag events
- CreateTag) ## $1=tag
- echo "$WMII_NORMCOLORS" $@ |a $WMII_DIR/lbar/$1;;
- DestroyTag) ## $1=tag
- rm $WMII_DIR/lbar/$1;;
- FocusTag) ## $1=tag
- echo "$WMII_FOCUSCOLORS" $1 |a $WMII_DIR/lbar/$1;;
- UnfocusTag) ## $1=tag
- echo "$WMII_NORMCOLORS" $1 |a $WMII_DIR/lbar/$1;;
- UrgentTag) ## $1=tag $2=[Manager|Client]
- echo "$WMII_URGENTCOLORS" $1 |a $WMII_DIR/lbar/$1;;
- NotUrgentTag) ## $1=tag $2=[Manager|Client]
- echo "$WMII_NORMCOLORS" $1 |a $WMII_DIR/lbar/$1;;
-
- ## LeftBar events (usually tag buttons)
- LeftBarMouseDown) ## $1=button $2=bar_item
- ;;
- LeftBarClick) ## $1=button $2=bar_item
- shift # ignore the button
- echo view "$@" |a $WMII_DIR/ctl;;
- LeftMouseDND) ## $1=button $2=bar_item
- Event LeftBarClick "$@";;
-
- ## RightBar events
- RightBarMouseDown) ## $1=button $2=bar_item
- ;;
- RightBarClick) ## $1=button $2=bar_item
- ;;
- RightMouseDND) ## $1=button $2=bar_item
- Event RightBarClick "$@";;
-
- ## Custom (non-WMII-generated) events
- Start) ## No args
- Event Quit;; # get out of the way for a new event loop
- esac
-} ## End Event
-
-# Key Bindings
-Key() {
- key=$1
- case "$key" in
- ## Moving around
-
- $MODKEY-$LEFT) ## Select the client to the left
- echo select left |a $WMII_DIR/tag/sel/ctl;;
- $MODKEY-$RIGHT) ## Select the client to the right
- echo select right |a $WMII_DIR/tag/sel/ctl;;
- $MODKEY-$UP) ## Select the client above
- echo select up |a $WMII_DIR/tag/sel/ctl;;
- $MODKEY-$DOWN) ## Select the client below
- echo select down |a $WMII_DIR/tag/sel/ctl;;
-
- $MODKEY-space) ## Toggle between floating and managed layers
- echo select toggle |a $WMII_DIR/tag/sel/ctl;;
-
- ## Moving clients around
-
- $MODKEY-Shift-$LEFT) ## Move selected client to the left
- wmiir xwrite /tag/sel/ctl send sel left;;
- $MODKEY-Shift-$RIGHT) ## Move selected client to the right
- wmiir xwrite /tag/sel/ctl send sel right;;
- $MODKEY-Shift-$UP) ## Move selected client up
- wmiir xwrite /tag/sel/ctl send sel up;;
- $MODKEY-Shift-$DOWN) ## Move selected client down
- wmiir xwrite /tag/sel/ctl send sel down;;
-
- $MODKEY-Shift-space) ## Toggle selected client between floating and managed layers
- wmiir xwrite /tag/sel/ctl send sel toggle;;
-
- ## Moving through stacks
- $MODKEY-Control-$UP) ## Select the stack above
- wmiir xwrite /tag/sel/ctl select up stack;;
- $MODKEY-Control-$DOWN) # Select the stack below
- wmiir xwrite /tag/sel/ctl select down stack;;
-
- ## Client actions
- $MODKEY-shift-1) ## Toggle selected client's fullsceen state
- wmiir xwrite /client/sel/ctl Fullscreen toggle;;
- $MODKEY-shift-0) ## Close client
- wmiir xwrite /client/sel/ctl kill;;
-
- ## Changing column modes
- $MODKEY-d) ## Set column to default mode
- wmiir xwrite /tag/sel/ctl colmode sel default-max;;
- $MODKEY-s) ## Set column to stack mode
- wmiir xwrite /tag/sel/ctl colmode sel stack-max;;
- $MODKEY-m) ## Set column to max mode
- wmiir xwrite /tag/sel/ctl colmode sel stack+max;;
-
- ## Running programs
- $MODKEY-a) ## Open wmii actions menu
- Action $(path_ls $WMII_CONFPATH | wimenu -h "${hist}.actions" -n 5000) & ;;
- $MODKEY-x) ## Open program menu
- setsid $(wimenu -h "${hist}.progs" -n 5000 <$progsfile) & ;;
- $MODKEY-Return) ## Launch a terminal
- setsid x-terminal-emulator & ;;
-
- ## Other
- $MODKEY-Control-t) ## Toggle all other key bindings
- case $(wmiir read /keys | wc -l | tr -d ' \t\n') in
- 0|1)
- echo -n "$Keys" | wmiir write /keys
- wmiir xwrite /ctl grabmod $MODKEY;;
- *)
- wmiir xwrite /keys $MODKEY-Control-t
- wmiir xwrite /ctl grabmod Mod3;;
- esac;;
-
- ## Tag actions
- $MODKEY-t) ## Change to another tag
- {
- tag=$(lstags | wimenu -h "${hist}.tags" -n 50) || return
- wmiir xwrite /ctl view $tag
- }& ;;
- $MODKEY-Shift-t) ## Retag the selected client
- sel=$(sed 1q $WMII_DIR/client/sel/ctl)
- {
- tag=$(lstags | wimenu -h "${hist}.tags" -n 50) || return
- wmiir xwrite /client/$sel/tags $tag
- }& ;;
- esac
-} ## End Key
-
-# WM Configuration
-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
-xsetroot -solid "$WMII_BACKGROUND" &
-
-progsfile=$WMII_NAMESPACE/.proglist
-path_ls $PATH > $progsfile &
-
-eval arg `scansection Key|cut -sf2` |a $WMII_DIR/keys
-
-# Clear the LBar
-find $WMII_DIR/lbar -type f -delete
-
-# Emulate [Create|Focus]Tag events
-seltag=`sed 1q $WMII_DIR/tag/sel/ctl`
-lstags | while read tag; do
- Event CreateTag "$tag"
- if [ "$tag" = "$seltag" ]; then
- Event FocusTag "$tag"
- fi
-done
-
-Action autostart 2>/dev/null &
+wmiir xwrite /event WmiircQuit # close any existing wmiirc's
-if [ -f "`conffile wmiirc_local`" ]; then
- . "`conffile wmiirc_local`"
-fi
+Event WmiircStart
trap "Event Quit" EXIT
-# use wmiir so it doesn't look like an open file
wmiir read /event 2>/dev/null | while read event; do
Event $event
done
diff --git a/.wmii/wmiirc_local b/.wmii/wmiirc_local
deleted file mode 100755
index 8e1321c..0000000
--- a/.wmii/wmiirc_local
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/dash -f
-# -*- mode: sh; -*-
-
-# wmiirc file for my HP Pavilion dv6426us laptop
-
-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 -u '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"
-}