2006-02-25 19:36:53 +01:00
|
|
|
#!/bin/sh
|
|
|
|
# configure wmii
|
|
|
|
|
|
|
|
xwrite() {
|
|
|
|
file="$1"; shift
|
|
|
|
echo -n "$@" | wmiir write "$file"
|
|
|
|
}
|
|
|
|
|
|
|
|
proglist() {
|
2006-04-19 16:19:52 +02:00
|
|
|
ls -lL "$@" 2>/dev/null | awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort -u
|
2006-02-25 19:36:53 +01:00
|
|
|
}
|
|
|
|
|
2006-04-12 08:53:06 +02:00
|
|
|
MODKEY=Mod1
|
|
|
|
UP=k
|
|
|
|
DOWN=j
|
|
|
|
LEFT=h
|
|
|
|
RIGHT=l
|
|
|
|
|
2006-04-19 16:19:52 +02:00
|
|
|
WMII_FONT='fixed'
|
2006-05-19 20:14:06 +02:00
|
|
|
WMII_SELCOLORS='#ffffff #335577 #447799'
|
2006-04-27 08:56:27 +02:00
|
|
|
WMII_NORMCOLORS='#222222 #eeeeee #666666'
|
2006-04-27 08:58:12 +02:00
|
|
|
# dark background
|
2006-05-19 18:20:26 +02:00
|
|
|
#WMII_NORMCOLORS='#eeeeee #111111 #222222'
|
2006-04-19 16:19:52 +02:00
|
|
|
|
2006-05-28 15:01:33 +02:00
|
|
|
export WMII_FONT WMII_SELCOLORS WMII_NORMCOLORS
|
2006-02-25 19:36:53 +01:00
|
|
|
|
2006-03-22 17:58:04 +01: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 19:36:53 +01:00
|
|
|
# WM CONFIGURATION
|
2006-06-20 22:06:02 -04:00
|
|
|
wmiir write /ctl << EOF
|
|
|
|
font $WMII_FONT
|
|
|
|
selcolors $WMII_SELCOLORS
|
|
|
|
normcolors $WMII_NORMCOLORS
|
2006-06-20 22:52:40 -04:00
|
|
|
grabmod $MODKEY
|
2006-06-21 14:48:39 -04:00
|
|
|
border 2
|
2006-06-20 22:06:02 -04:00
|
|
|
EOF
|
2006-05-31 19:48:44 +02:00
|
|
|
|
|
|
|
# COLUMN RULES
|
2006-06-19 09:57:16 +02:00
|
|
|
wmiir write /colrules <<EOF
|
2006-06-06 17:35:29 +02:00
|
|
|
/1/ -> 50+50
|
2006-05-31 09:51:40 +02:00
|
|
|
EOF
|
2006-02-25 19:36:53 +01:00
|
|
|
|
2006-03-10 17:17:59 +01:00
|
|
|
# TAGGING RULES
|
2006-06-19 22:40:45 -04:00
|
|
|
wmiir write /tagrules <<EOF
|
2006-04-11 18:45:40 +02:00
|
|
|
/XMMS.*/ -> ~
|
|
|
|
/Gimp.*/ -> ~
|
2006-04-26 09:32:11 +02:00
|
|
|
/MPlayer.*/ -> ~
|
2006-04-13 14:58:22 +02:00
|
|
|
/.*/ -> !
|
|
|
|
/.*/ -> 1
|
2006-03-10 17:17:59 +01:00
|
|
|
EOF
|
|
|
|
|
2006-02-25 19:36:53 +01:00
|
|
|
# MISC
|
2006-04-27 10:10:39 +02:00
|
|
|
xsetroot -solid '#333333'
|
2006-02-25 19:36:53 +01:00
|
|
|
status &
|
2006-05-28 14:15:10 +02:00
|
|
|
PROGS_FILE=`mktemp /tmp/.wmiimenu.proglist.XXXXXX` || exit 2
|
2006-05-30 22:27:11 +02:00
|
|
|
proglist `echo "$OLD_PATH" | tr : ' '` >$PROGS_FILE &
|
2006-02-25 19:36:53 +01:00
|
|
|
|
|
|
|
# SHORTCUTS
|
2006-06-19 09:57:16 +02:00
|
|
|
wmiir write /keys <<EOF
|
2006-04-12 08:53:06 +02:00
|
|
|
$MODKEY-$LEFT
|
|
|
|
$MODKEY-$RIGHT
|
|
|
|
$MODKEY-$DOWN
|
|
|
|
$MODKEY-$UP
|
2006-04-10 19:47:34 +00:00
|
|
|
$MODKEY-space
|
2006-04-07 16:08:17 +02:00
|
|
|
$MODKEY-d
|
2006-04-24 19:56:47 +02:00
|
|
|
$MODKEY-f
|
2006-04-10 19:47:34 +00:00
|
|
|
$MODKEY-s
|
|
|
|
$MODKEY-m
|
|
|
|
$MODKEY-a
|
|
|
|
$MODKEY-p
|
2006-04-11 15:32:03 +02:00
|
|
|
$MODKEY-t
|
2006-03-09 12:00:47 +01:00
|
|
|
$MODKEY-0
|
2006-03-05 23:38:50 +01:00
|
|
|
$MODKEY-1
|
|
|
|
$MODKEY-2
|
|
|
|
$MODKEY-3
|
|
|
|
$MODKEY-4
|
|
|
|
$MODKEY-5
|
|
|
|
$MODKEY-6
|
|
|
|
$MODKEY-7
|
|
|
|
$MODKEY-8
|
|
|
|
$MODKEY-9
|
2006-04-11 15:32:03 +02:00
|
|
|
$MODKEY-Return
|
2006-04-12 08:53:06 +02:00
|
|
|
$MODKEY-Shift-$LEFT
|
|
|
|
$MODKEY-Shift-$RIGHT
|
2006-05-04 14:34:44 +02:00
|
|
|
$MODKEY-Shift-$UP
|
|
|
|
$MODKEY-Shift-$DOWN
|
2006-04-10 19:47:34 +00:00
|
|
|
$MODKEY-Shift-space
|
|
|
|
$MODKEY-Shift-c
|
|
|
|
$MODKEY-Shift-t
|
2006-03-09 12:00:47 +01:00
|
|
|
$MODKEY-Shift-0
|
2006-02-25 23:44:27 +00:00
|
|
|
$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 19:36:53 +01:00
|
|
|
|
2006-06-19 22:40:45 -04:00
|
|
|
# TAG BAR
|
2006-06-21 17:12:02 -04:00
|
|
|
IFS='
|
|
|
|
'
|
|
|
|
for bar in `wmiir ls /lbar`
|
|
|
|
do
|
2006-06-22 01:48:19 -04:00
|
|
|
wmiir remove /lbar/$bar
|
2006-06-21 17:12:02 -04:00
|
|
|
done
|
|
|
|
|
2006-06-20 06:12:49 -04:00
|
|
|
seltag=`wmiir read /tag/sel/ctl`
|
2006-06-19 22:40:45 -04:00
|
|
|
for tag in `wmiir ls /tag | sed -e 's,/$,,; /^sel$/d'`
|
|
|
|
do
|
|
|
|
wmiir create /lbar/$tag
|
|
|
|
if [ "X$tag" = "X$seltag" ]; then
|
2006-06-21 17:12:02 -04:00
|
|
|
xwrite /lbar/$tag $WMII_SELCOLORS $tag
|
2006-06-19 22:40:45 -04:00
|
|
|
else
|
2006-06-21 17:12:02 -04:00
|
|
|
xwrite /lbar/$tag $WMII_NORMCOLORS $tag
|
2006-06-19 22:40:45 -04:00
|
|
|
fi
|
|
|
|
done
|
2006-06-22 01:48:19 -04:00
|
|
|
unset IFS
|
2006-06-21 17:12:02 -04:00
|
|
|
|
2006-06-19 22:40:45 -04:00
|
|
|
|
2006-02-25 19:36:53 +01:00
|
|
|
# EVENT LOOP
|
|
|
|
wmiir read /event 2>/dev/null |
|
|
|
|
while read event
|
|
|
|
do
|
2006-05-26 16:43:52 +02:00
|
|
|
set -f
|
2006-02-25 19:36:53 +01:00
|
|
|
set -- $event
|
2006-05-26 16:43:52 +02:00
|
|
|
set +f
|
2006-02-25 19:36:53 +01:00
|
|
|
type="$1"; shift
|
|
|
|
case "$type" in
|
2006-03-13 08:56:22 +01:00
|
|
|
Start)
|
2006-03-22 21:11:57 +01:00
|
|
|
if test wmiirc = "$1"
|
2006-03-13 08:56:22 +01:00
|
|
|
then
|
2006-05-25 13:17:17 +02:00
|
|
|
rm -f $PROGS_FILE
|
2006-03-22 16:05:12 +01:00
|
|
|
exit
|
|
|
|
fi;;
|
2006-06-06 21:10:30 +02:00
|
|
|
CreateTag)
|
2006-06-19 22:13:29 -04:00
|
|
|
wmiir create /lbar/$1
|
2006-06-19 23:58:20 -04:00
|
|
|
xwrite /lbar/$1 $WMII_NORMCOLORS $1
|
2006-06-06 21:10:30 +02:00
|
|
|
;;
|
|
|
|
DestroyTag)
|
2006-06-19 22:13:29 -04:00
|
|
|
wmiir remove /lbar/$1
|
2006-06-06 21:10:30 +02:00
|
|
|
;;
|
|
|
|
FocusTag)
|
2006-06-19 22:13:29 -04:00
|
|
|
xwrite /lbar/$1 $WMII_SELCOLORS $1
|
2006-06-06 21:10:30 +02:00
|
|
|
;;
|
|
|
|
UnfocusTag)
|
2006-06-19 22:13:29 -04:00
|
|
|
xwrite /lbar/$1 $WMII_NORMCOLORS $1
|
2006-06-06 21:10:30 +02:00
|
|
|
;;
|
2006-06-21 17:12:02 -04:00
|
|
|
LeftBarClick)
|
2006-05-28 15:01:33 +02:00
|
|
|
xwrite /ctl view "$1";;
|
2006-03-10 21:42:39 +01:00
|
|
|
Key)
|
2006-02-25 19:36:53 +01:00
|
|
|
case "$1" in
|
2006-04-12 08:53:06 +02:00
|
|
|
$MODKEY-$LEFT)
|
2006-06-19 18:25:49 -04:00
|
|
|
xwrite /tag/sel/ctl select left;;
|
2006-04-12 08:53:06 +02:00
|
|
|
$MODKEY-$RIGHT)
|
2006-06-19 18:25:49 -04:00
|
|
|
xwrite /tag/sel/ctl select right;;
|
2006-04-12 14:14:34 +02:00
|
|
|
$MODKEY-$DOWN)
|
2006-06-19 16:05:02 +02:00
|
|
|
xwrite /tag/sel/ctl select down;;
|
2006-04-12 08:53:06 +02:00
|
|
|
$MODKEY-$UP)
|
2006-06-19 16:05:02 +02:00
|
|
|
xwrite /tag/sel/ctl select up;;
|
2006-04-10 19:47:34 +00:00
|
|
|
$MODKEY-space)
|
2006-06-20 10:24:58 +02:00
|
|
|
xwrite /tag/sel/ctl select toggle;;
|
2006-04-10 19:47:34 +00:00
|
|
|
$MODKEY-d)
|
2006-06-20 19:43:20 -04:00
|
|
|
xwrite /tag/sel/ctl colmode sel default;;
|
2006-04-10 19:47:34 +00:00
|
|
|
$MODKEY-s)
|
2006-06-20 19:43:20 -04:00
|
|
|
xwrite /tag/sel/ctl colmode sel stack;;
|
2006-04-10 19:47:34 +00:00
|
|
|
$MODKEY-m)
|
2006-06-20 19:43:20 -04:00
|
|
|
xwrite /tag/sel/ctl colmode sel max;;
|
2006-04-24 19:56:47 +02:00
|
|
|
$MODKEY-f)
|
2006-05-26 14:16:19 +02:00
|
|
|
xwrite /tag/sel/0/sel/geom 0 0 0 0;;
|
2006-04-10 19:47:34 +00:00
|
|
|
$MODKEY-a)
|
2006-05-28 15:01:33 +02:00
|
|
|
`proglist $HOME/.wmii-4 CONFPREFIX/wmii-4 | wmiimenu` &;;
|
2006-04-10 19:47:34 +00:00
|
|
|
$MODKEY-p)
|
2006-05-29 11:08:21 +02:00
|
|
|
PATH="$OLD_PATH" wmiisetsid `wmiimenu <$PROGS_FILE` &;;
|
2006-04-11 15:32:03 +02:00
|
|
|
$MODKEY-t)
|
2006-05-28 15:01:33 +02:00
|
|
|
xwrite /ctl view "`wmiir ls /tag | sed 's,/,,; /^sel$/d' | wmiimenu`" &;;
|
2006-03-05 23:38:50 +01:00
|
|
|
$MODKEY-[0-9])
|
2006-05-24 18:15:55 +02:00
|
|
|
xwrite /ctl view `echo $1 | sed 's/.*-//'`;;
|
2006-04-11 15:32:03 +02:00
|
|
|
$MODKEY-Return)
|
2006-05-29 19:23:14 +00:00
|
|
|
PATH="$OLD_PATH" xterm &;;
|
2006-04-12 15:29:03 +02:00
|
|
|
$MODKEY-Shift-$LEFT)
|
2006-06-19 18:25:49 -04:00
|
|
|
xwrite /tag/sel/ctl send sel left;;
|
2006-04-12 15:29:03 +02:00
|
|
|
$MODKEY-Shift-$RIGHT)
|
2006-06-19 18:25:49 -04:00
|
|
|
xwrite /tag/sel/ctl send sel right;;
|
2006-05-04 14:34:44 +02:00
|
|
|
$MODKEY-Shift-$DOWN)
|
2006-06-19 13:18:09 +02:00
|
|
|
xwrite /tag/sel/ctl send sel down;;
|
2006-05-04 14:34:44 +02:00
|
|
|
$MODKEY-Shift-$UP)
|
2006-06-19 13:18:09 +02:00
|
|
|
xwrite /tag/sel/ctl send sel up;;
|
2006-04-10 19:47:34 +00:00
|
|
|
$MODKEY-Shift-space)
|
2006-06-19 13:18:09 +02:00
|
|
|
xwrite /tag/sel/ctl send sel toggle;;
|
2006-04-10 19:47:34 +00:00
|
|
|
$MODKEY-Shift-c)
|
2006-06-20 10:24:58 +02:00
|
|
|
xwrite /client/sel/ctl kill;;
|
2006-03-24 15:00:53 +01:00
|
|
|
$MODKEY-Shift-t)
|
2006-06-20 06:12:49 -04:00
|
|
|
xwrite /client/`wmiir read /client/sel/ctl`/tags \
|
2006-06-19 18:25:49 -04:00
|
|
|
"`wmiir ls /tag | sed 's,/,,; /^sel$/d' | wmiimenu`" &;;
|
2006-04-10 19:47:34 +00:00
|
|
|
$MODKEY-Shift-[0-9])
|
2006-06-19 09:57:16 +02:00
|
|
|
xwrite /client/sel/tags `echo $1 | sed 's/.*-//'`;;
|
2006-02-25 19:36:53 +01:00
|
|
|
esac;;
|
|
|
|
esac
|
2006-05-11 01:24:21 +02:00
|
|
|
done &
|