mirror of
https://github.com/0intro/wmii
synced 2024-11-27 00:00:36 +03:00
197 lines
3.7 KiB
Bash
197 lines
3.7 KiB
Bash
#!/bin/sh
|
|
# configure wmii
|
|
|
|
xwrite() {
|
|
file="$1"; shift
|
|
echo -n "$@" | wmiir write "$file"
|
|
}
|
|
|
|
proglist() {
|
|
ls -lL "$@" 2>/dev/null | awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort -u
|
|
}
|
|
|
|
MODKEY=Mod1
|
|
UP=k
|
|
DOWN=j
|
|
LEFT=h
|
|
RIGHT=l
|
|
|
|
WMII_FONT='fixed'
|
|
WMII_SELCOLORS='#ffffff #335577 #447799'
|
|
WMII_NORMCOLORS='#222222 #eeeeee #666666'
|
|
# dark background
|
|
#WMII_NORMCOLORS='#eeeeee #111111 #222222'
|
|
|
|
export WMII_FONT WMII_SELCOLORS WMII_NORMCOLORS
|
|
|
|
# give wmiiwm a chance to start
|
|
while :
|
|
do
|
|
echo Start wmiirc | wmiir write /event >/dev/null 2>&1 && break
|
|
sleep 1
|
|
done
|
|
|
|
# WM CONFIGURATION
|
|
xwrite /border 2
|
|
xwrite /font $WMII_FONT
|
|
xwrite /selcolors $WMII_SELCOLORS
|
|
xwrite /normcolors $WMII_NORMCOLORS
|
|
|
|
# COLUMN RULES
|
|
wmiir write /colrules <<EOF
|
|
/1/ -> 50+50
|
|
EOF
|
|
|
|
# TAGGING RULES
|
|
wmiir write /tagrules <<EOF
|
|
/XMMS.*/ -> ~
|
|
/Gimp.*/ -> ~
|
|
/MPlayer.*/ -> ~
|
|
/.*/ -> !
|
|
/.*/ -> 1
|
|
EOF
|
|
|
|
# MISC
|
|
xsetroot -solid '#333333'
|
|
status &
|
|
PROGS_FILE=`mktemp /tmp/.wmiimenu.proglist.XXXXXX` || exit 2
|
|
proglist `echo "$OLD_PATH" | tr : ' '` >$PROGS_FILE &
|
|
|
|
# SHORTCUTS
|
|
xwrite /grabmod Mod1
|
|
wmiir write /keys <<EOF
|
|
$MODKEY-$LEFT
|
|
$MODKEY-$RIGHT
|
|
$MODKEY-$DOWN
|
|
$MODKEY-$UP
|
|
$MODKEY-space
|
|
$MODKEY-d
|
|
$MODKEY-f
|
|
$MODKEY-s
|
|
$MODKEY-m
|
|
$MODKEY-a
|
|
$MODKEY-p
|
|
$MODKEY-t
|
|
$MODKEY-0
|
|
$MODKEY-1
|
|
$MODKEY-2
|
|
$MODKEY-3
|
|
$MODKEY-4
|
|
$MODKEY-5
|
|
$MODKEY-6
|
|
$MODKEY-7
|
|
$MODKEY-8
|
|
$MODKEY-9
|
|
$MODKEY-Return
|
|
$MODKEY-Shift-$LEFT
|
|
$MODKEY-Shift-$RIGHT
|
|
$MODKEY-Shift-$UP
|
|
$MODKEY-Shift-$DOWN
|
|
$MODKEY-Shift-space
|
|
$MODKEY-Shift-c
|
|
$MODKEY-Shift-t
|
|
$MODKEY-Shift-0
|
|
$MODKEY-Shift-1
|
|
$MODKEY-Shift-2
|
|
$MODKEY-Shift-3
|
|
$MODKEY-Shift-4
|
|
$MODKEY-Shift-5
|
|
$MODKEY-Shift-6
|
|
$MODKEY-Shift-7
|
|
$MODKEY-Shift-8
|
|
$MODKEY-Shift-9
|
|
EOF
|
|
|
|
# TAG BAR
|
|
seltag=`wmiir read /tag/sel/ctl`
|
|
for tag in `wmiir ls /tag | sed -e 's,/$,,; /^sel$/d'`
|
|
do
|
|
wmiir create /lbar/$tag
|
|
if [ "X$tag" = "X$seltag" ]; then
|
|
xwrite "/lbar/$tag" $WMII_SELCOLORS $tag
|
|
else
|
|
xwrite "/lbar/$tag" $WMII_NORMCOLORS $tag
|
|
fi
|
|
done
|
|
|
|
# EVENT LOOP
|
|
wmiir read /event 2>/dev/null |
|
|
while read event
|
|
do
|
|
set -f
|
|
set -- $event
|
|
set +f
|
|
type="$1"; shift
|
|
case "$type" in
|
|
Start)
|
|
if test wmiirc = "$1"
|
|
then
|
|
rm -f $PROGS_FILE
|
|
exit
|
|
fi;;
|
|
CreateTag)
|
|
wmiir create /lbar/$1
|
|
xwrite /lbar/$1 $WMII_NORMCOLORS $1
|
|
;;
|
|
DestroyTag)
|
|
wmiir remove /lbar/$1
|
|
;;
|
|
FocusTag)
|
|
xwrite /lbar/$1 $WMII_SELCOLORS $1
|
|
;;
|
|
UnfocusTag)
|
|
xwrite /lbar/$1 $WMII_NORMCOLORS $1
|
|
;;
|
|
BarClick)
|
|
xwrite /ctl view "$1";;
|
|
Key)
|
|
case "$1" in
|
|
$MODKEY-$LEFT)
|
|
xwrite /tag/sel/ctl select left;;
|
|
$MODKEY-$RIGHT)
|
|
xwrite /tag/sel/ctl select right;;
|
|
$MODKEY-$DOWN)
|
|
xwrite /tag/sel/ctl select down;;
|
|
$MODKEY-$UP)
|
|
xwrite /tag/sel/ctl select up;;
|
|
$MODKEY-space)
|
|
xwrite /tag/sel/ctl select toggle;;
|
|
$MODKEY-d)
|
|
xwrite /tag/sel/ctl colmode sel default;;
|
|
$MODKEY-s)
|
|
xwrite /tag/sel/ctl colmode sel stack;;
|
|
$MODKEY-m)
|
|
xwrite /tag/sel/ctl colmode sel max;;
|
|
$MODKEY-f)
|
|
xwrite /tag/sel/0/sel/geom 0 0 0 0;;
|
|
$MODKEY-a)
|
|
`proglist $HOME/.wmii-4 CONFPREFIX/wmii-4 | wmiimenu` &;;
|
|
$MODKEY-p)
|
|
PATH="$OLD_PATH" wmiisetsid `wmiimenu <$PROGS_FILE` &;;
|
|
$MODKEY-t)
|
|
xwrite /ctl view "`wmiir ls /tag | sed 's,/,,; /^sel$/d' | wmiimenu`" &;;
|
|
$MODKEY-[0-9])
|
|
xwrite /ctl view `echo $1 | sed 's/.*-//'`;;
|
|
$MODKEY-Return)
|
|
PATH="$OLD_PATH" xterm &;;
|
|
$MODKEY-Shift-$LEFT)
|
|
xwrite /tag/sel/ctl send sel left;;
|
|
$MODKEY-Shift-$RIGHT)
|
|
xwrite /tag/sel/ctl send sel right;;
|
|
$MODKEY-Shift-$DOWN)
|
|
xwrite /tag/sel/ctl send sel down;;
|
|
$MODKEY-Shift-$UP)
|
|
xwrite /tag/sel/ctl send sel up;;
|
|
$MODKEY-Shift-space)
|
|
xwrite /tag/sel/ctl send sel toggle;;
|
|
$MODKEY-Shift-c)
|
|
xwrite /client/sel/ctl kill;;
|
|
$MODKEY-Shift-t)
|
|
xwrite /client/`wmiir read /client/sel/ctl`/tags \
|
|
"`wmiir ls /tag | sed 's,/,,; /^sel$/d' | wmiimenu`" &;;
|
|
$MODKEY-Shift-[0-9])
|
|
xwrite /client/sel/tags `echo $1 | sed 's/.*-//'`;;
|
|
esac;;
|
|
esac
|
|
done &
|