wmii/rc/wmiirc

208 lines
3.8 KiB
Plaintext
Raw Normal View History

2006-02-25 21:36:53 +03:00
#!/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
2006-02-25 21:36:53 +03:00
}
MODKEY=Mod1
UP=k
DOWN=j
LEFT=h
RIGHT=l
WMII_FONT='fixed'
WMII_SELCOLORS='#ffffff #335577 #447799'
WMII_NORMCOLORS='#222222 #eeeeee #666666'
2006-04-27 10:58:12 +04:00
# dark background
2006-05-19 20:20:26 +04:00
#WMII_NORMCOLORS='#eeeeee #111111 #222222'
2006-05-28 17:01:33 +04:00
export WMII_FONT WMII_SELCOLORS WMII_NORMCOLORS
2006-02-25 21:36:53 +03:00
2006-03-22 19:58:04 +03:00
# give wmiiwm a chance to start
while :
do
echo Start wmiirc | wmiir write /event >/dev/null 2>&1 && break
sleep 1
done
2006-02-25 21:36:53 +03:00
# WM CONFIGURATION
wmiir write /ctl << EOF
font $WMII_FONT
selcolors $WMII_SELCOLORS
normcolors $WMII_NORMCOLORS
grabmod $MODKEY
2006-06-21 22:48:39 +04:00
border 2
EOF
# COLUMN RULES
wmiir write /colrules <<EOF
/1/ -> 50+50
EOF
2006-02-25 21:36:53 +03:00
# TAGGING RULES
wmiir write /tagrules <<EOF
2006-04-11 20:45:40 +04:00
/XMMS.*/ -> ~
/Gimp.*/ -> ~
/MPlayer.*/ -> ~
2006-04-13 16:58:22 +04:00
/.*/ -> !
/.*/ -> 1
EOF
2006-02-25 21:36:53 +03:00
# MISC
2006-04-27 12:10:39 +04:00
xsetroot -solid '#333333'
2006-02-25 21:36:53 +03:00
status &
2006-05-28 16:15:10 +04:00
PROGS_FILE=`mktemp /tmp/.wmiimenu.proglist.XXXXXX` || exit 2
proglist `echo "$OLD_PATH" | tr : ' '` >$PROGS_FILE &
2006-02-25 21:36:53 +03:00
# SHORTCUTS
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
2006-04-11 17:32:03 +04:00
$MODKEY-t
$MODKEY-0
2006-03-06 01:38:50 +03:00
$MODKEY-1
$MODKEY-2
$MODKEY-3
$MODKEY-4
$MODKEY-5
$MODKEY-6
$MODKEY-7
$MODKEY-8
$MODKEY-9
2006-04-11 17:32:03 +04:00
$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
2006-02-25 21:36:53 +03:00
# TAG BAR
IFS='
'
for bar in `wmiir ls /lbar`
do
2006-06-22 09:48:19 +04:00
wmiir remove /lbar/$bar
done
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
2006-06-22 09:48:19 +04:00
unset IFS
2006-02-25 21:36:53 +03:00
# EVENT LOOP
wmiir read /event 2>/dev/null |
while read event
do
set -f
2006-02-25 21:36:53 +03:00
set -- $event
set +f
2006-02-25 21:36:53 +03:00
type="$1"; shift
case "$type" in
Start)
if test wmiirc = "$1"
then
rm -f $PROGS_FILE
2006-03-22 18:05:12 +03:00
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
;;
LeftBarClick)
2006-05-28 17:01:33 +04:00
xwrite /ctl view "$1";;
Key)
2006-02-25 21:36:53 +03:00
case "$1" in
$MODKEY-$LEFT)
2006-06-20 02:25:49 +04:00
xwrite /tag/sel/ctl select left;;
$MODKEY-$RIGHT)
2006-06-20 02:25:49 +04:00
xwrite /tag/sel/ctl select right;;
$MODKEY-$DOWN)
xwrite /tag/sel/ctl select down;;
$MODKEY-$UP)
xwrite /tag/sel/ctl select up;;
$MODKEY-space)
2006-06-20 12:24:58 +04:00
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)
2006-05-28 17:01:33 +04:00
`proglist $HOME/.wmii-4 CONFPREFIX/wmii-4 | wmiimenu` &;;
$MODKEY-p)
2006-05-29 13:08:21 +04:00
PATH="$OLD_PATH" wmiisetsid `wmiimenu <$PROGS_FILE` &;;
2006-04-11 17:32:03 +04:00
$MODKEY-t)
2006-05-28 17:01:33 +04:00
xwrite /ctl view "`wmiir ls /tag | sed 's,/,,; /^sel$/d' | wmiimenu`" &;;
2006-03-06 01:38:50 +03:00
$MODKEY-[0-9])
2006-05-24 20:15:55 +04:00
xwrite /ctl view `echo $1 | sed 's/.*-//'`;;
2006-04-11 17:32:03 +04:00
$MODKEY-Return)
PATH="$OLD_PATH" xterm &;;
2006-04-12 17:29:03 +04:00
$MODKEY-Shift-$LEFT)
2006-06-20 02:25:49 +04:00
xwrite /tag/sel/ctl send sel left;;
2006-04-12 17:29:03 +04:00
$MODKEY-Shift-$RIGHT)
2006-06-20 02:25:49 +04:00
xwrite /tag/sel/ctl send sel right;;
$MODKEY-Shift-$DOWN)
2006-06-19 15:18:09 +04:00
xwrite /tag/sel/ctl send sel down;;
$MODKEY-Shift-$UP)
2006-06-19 15:18:09 +04:00
xwrite /tag/sel/ctl send sel up;;
$MODKEY-Shift-space)
2006-06-19 15:18:09 +04:00
xwrite /tag/sel/ctl send sel toggle;;
$MODKEY-Shift-c)
2006-06-20 12:24:58 +04:00
xwrite /client/sel/ctl kill;;
$MODKEY-Shift-t)
xwrite /client/`wmiir read /client/sel/ctl`/tags \
2006-06-20 02:25:49 +04:00
"`wmiir ls /tag | sed 's,/,,; /^sel$/d' | wmiimenu`" &;;
$MODKEY-Shift-[0-9])
xwrite /client/sel/tags `echo $1 | sed 's/.*-//'`;;
2006-02-25 21:36:53 +03:00
esac;;
esac
done &