mirror of
https://github.com/0intro/wmii
synced 2024-11-22 22:02:30 +03:00
163 lines
3.1 KiB
Bash
163 lines
3.1 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_NORMCOLORS='#222222 #eeeeee #666666'
|
|
WMII_SELCOLORS='#ffffff #285577 #4c7899'
|
|
|
|
export WMII_FONT WMII_NORMCOLORS WMII_SELCOLORS
|
|
|
|
# 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 /def/border 2
|
|
xwrite /def/font $WMII_FONT
|
|
xwrite /def/selcolors $WMII_SELCOLORS
|
|
xwrite /def/normcolors $WMII_NORMCOLORS
|
|
|
|
# TAGGING RULES
|
|
wmiir write /def/rules <<EOF
|
|
/XMMS.*/ -> ~
|
|
/Gimp.*/ -> ~
|
|
/.*/ -> !
|
|
/.*/ -> 1
|
|
EOF
|
|
|
|
# MISC
|
|
xsetroot -solid '#0b1014'
|
|
status &
|
|
PROGS_FILE=/tmp/.wmiimenu.$USER.progs
|
|
proglist `echo "$PATH" | tr : ' '` >$PROGS_FILE &
|
|
|
|
# SHORTCUTS
|
|
xwrite /def/grabmod $MODKEY
|
|
wmiir write /def/keys <<EOF
|
|
$MODKEY-$LEFT
|
|
$MODKEY-$RIGHT
|
|
$MODKEY-$DOWN
|
|
$MODKEY-$UP
|
|
$MODKEY-space
|
|
$MODKEY-d
|
|
$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-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
|
|
$MODKEY-Control-$LEFT
|
|
$MODKEY-Control-$RIGHT
|
|
$MODKEY-Control-$DOWN
|
|
$MODKEY-Control-$UP
|
|
EOF
|
|
|
|
# EVENT LOOP
|
|
wmiir read /event 2>/dev/null |
|
|
while read event
|
|
do
|
|
set -- $event
|
|
type="$1"; shift
|
|
case "$type" in
|
|
Start)
|
|
if test wmiirc = "$1"
|
|
then
|
|
exit
|
|
fi;;
|
|
BarClick)
|
|
xwrite /ctl view "$1";;
|
|
Key)
|
|
case "$1" in
|
|
$MODKEY-$LEFT)
|
|
xwrite /view/ctl select prev;;
|
|
$MODKEY-$RIGHT)
|
|
xwrite /view/ctl select next;;
|
|
$MODKEY-$DOWN)
|
|
xwrite /view/sel/ctl select next;;
|
|
$MODKEY-$UP)
|
|
xwrite /view/sel/ctl select prev;;
|
|
$MODKEY-space)
|
|
xwrite /view/ctl select toggle;;
|
|
$MODKEY-d)
|
|
xwrite /view/sel/mode default;;
|
|
$MODKEY-s)
|
|
xwrite /view/sel/mode stack;;
|
|
$MODKEY-m)
|
|
xwrite /view/sel/mode max;;
|
|
$MODKEY-a)
|
|
`proglist CONFPREFIX/wmii-3 $HOME/.wmii-3 | wmiimenu` &;;
|
|
$MODKEY-p)
|
|
`wmiimenu <$PROGS_FILE` &;;
|
|
$MODKEY-t)
|
|
xwrite /ctl view "`wmiir read /tags | wmiimenu`" &;;
|
|
$MODKEY-[0-9])
|
|
xwrite /ctl view `echo $1 | sed 's/.*-//'`;;
|
|
$MODKEY-Return)
|
|
xterm &;;
|
|
$MODKEY-Shift-$LEFT)
|
|
xwrite /view/sel/sel/ctl sendto prev;;
|
|
$MODKEY-Shift-$RIGHT)
|
|
xwrite /view/sel/sel/ctl sendto next;;
|
|
$MODKEY-Shift-space)
|
|
xwrite /view/sel/sel/ctl sendto toggle;;
|
|
$MODKEY-Shift-c)
|
|
xwrite /view/sel/sel/ctl kill;;
|
|
$MODKEY-Shift-t)
|
|
xwrite /view/sel/sel/tags "`wmiir read /tags | wmiimenu`" &;;
|
|
$MODKEY-Shift-[0-9])
|
|
xwrite /view/sel/sel/tags `echo $1 | sed 's/.*-//'`;;
|
|
$MODKEY-Control-$LEFT)
|
|
xwrite /view/sel/sel/ctl swap prev;;
|
|
$MODKEY-Control-$RIGHT)
|
|
xwrite /view/sel/sel/ctl swap next;;
|
|
$MODKEY-Control-$DOWN)
|
|
xwrite /view/sel/sel/ctl swap down;;
|
|
$MODKEY-Control-$UP)
|
|
xwrite /view/sel/sel/ctl swap up;;
|
|
esac;;
|
|
esac
|
|
done
|