summaryrefslogtreecommitdiff
path: root/.config/wmii
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-03-27 15:24:05 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-03-27 15:24:05 -0400
commit674efbf431f2c1c879c9bfed05f7ed6adce22351 (patch)
treeb873ec80e45fb1bd9a414bb25c4e27d68c8861cf /.config/wmii
parentde9c3e08412ae13cc8a2d1e4418d9e9257f67518 (diff)
pre-merge move
Diffstat (limited to '.config/wmii')
-rwxr-xr-x.config/wmii/autostart4
-rw-r--r--.config/wmii/include.sh70
-rwxr-xr-x.config/wmii/quit3
-rwxr-xr-x.config/wmii/rbar_battery10
-rwxr-xr-x.config/wmii/rbar_clock10
-rwxr-xr-x.config/wmii/rbar_cpu13
-rwxr-xr-x.config/wmii/rbar_wifi10
-rw-r--r--.config/wmii/theme-solarized16
-rw-r--r--.config/wmii/theme-solarized-dark12
-rwxr-xr-x.config/wmii/wmiirc271
10 files changed, 419 insertions, 0 deletions
diff --git a/.config/wmii/autostart b/.config/wmii/autostart
new file mode 100755
index 0000000..aae23f4
--- /dev/null
+++ b/.config/wmii/autostart
@@ -0,0 +1,4 @@
+#!/bin/bash
+daemon lxpanel &> /dev/null
+daemon wicd-client -t &> /dev/null
+daemon notifyd &> /dev/null
diff --git a/.config/wmii/include.sh b/.config/wmii/include.sh
new file mode 100644
index 0000000..36f8f3e
--- /dev/null
+++ b/.config/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/.config/wmii/quit b/.config/wmii/quit
new file mode 100755
index 0000000..54f64e7
--- /dev/null
+++ b/.config/wmii/quit
@@ -0,0 +1,3 @@
+#!/bin/bash
+. "$HOME/.wmii/include.sh"
+echo quit |a $WMII_DIR/ctl
diff --git a/.config/wmii/rbar_battery b/.config/wmii/rbar_battery
new file mode 100755
index 0000000..7a7f24f
--- /dev/null
+++ b/.config/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/.config/wmii/rbar_clock b/.config/wmii/rbar_clock
new file mode 100755
index 0000000..8e7d2a4
--- /dev/null
+++ b/.config/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/.config/wmii/rbar_cpu b/.config/wmii/rbar_cpu
new file mode 100755
index 0000000..7f891da
--- /dev/null
+++ b/.config/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/.config/wmii/rbar_wifi b/.config/wmii/rbar_wifi
new file mode 100755
index 0000000..608b164
--- /dev/null
+++ b/.config/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/.config/wmii/theme-solarized b/.config/wmii/theme-solarized
new file mode 100644
index 0000000..5dc830d
--- /dev/null
+++ b/.config/wmii/theme-solarized
@@ -0,0 +1,16 @@
+SOL_BASE03='#002b36'
+SOL_BASE02='#073642'
+SOL_BASE01='#586e75'
+SOL_BASE00='#657b83'
+SOL_BASE0='#839496'
+SOL_BASE1='#93a1a1'
+SOL_BASE2='#eee8d5'
+SOL_BASE3='#fdf6e3'
+SOL_YELLOW='#b58900'
+SOL_ORANGE='#cb4b16'
+SOL_RED='#dc322f'
+SOL_MAGENTA='#d33682'
+SOL_VIOLET='#6c71c4'
+SOL_BLUE='#268bd2'
+SOL_CYAN='#2aa198'
+SOL_GREEN='#859900'
diff --git a/.config/wmii/theme-solarized-dark b/.config/wmii/theme-solarized-dark
new file mode 100644
index 0000000..83285ba
--- /dev/null
+++ b/.config/wmii/theme-solarized-dark
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Solarized-dark
+
+. $HOME/.wmii/theme-solarized
+
+WMII_BACKGROUND="$SOL_BASE02"
+
+# ="<text> <background> <border>"
+WMII_NORMCOLORS="$SOL_BASE0 $SOL_BASE03 $SOL_BASE02"
+WMII_FOCUSCOLORS="$SOL_BASE0 $SOL_BASE02 $SOL_BASE0"
+WMII_URGENTCOLORS="$SOL_RED $SOL_BASE03 $SOL_RED"
+
diff --git a/.config/wmii/wmiirc b/.config/wmii/wmiirc
new file mode 100755
index 0000000..92adb8b
--- /dev/null
+++ b/.config/wmii/wmiirc
@@ -0,0 +1,271 @@
+#!/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"
+ exit;;
+ 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 &
+
+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 2>/dev/null | while read event; do
+ Event $event
+done