2006-11-04 01:00:23 +03:00
|
|
|
#!/bin/sh
|
2007-02-03 01:57:40 +03:00
|
|
|
# Configure wmii
|
2006-02-25 21:36:53 +03:00
|
|
|
|
2007-02-11 06:04:13 +03:00
|
|
|
# Contents
|
|
|
|
# Configuration Variables
|
|
|
|
# WM Configuration
|
|
|
|
# Column Rules
|
|
|
|
# Tagging Rules
|
|
|
|
# Utility Functions
|
|
|
|
# Tag Bar Setup
|
|
|
|
# List of Bound Keys
|
|
|
|
# Event Processing Loop
|
2006-12-18 13:50:18 +03:00
|
|
|
|
2007-02-03 01:57:40 +03:00
|
|
|
# CONFIGURATION VARIABLES
|
2006-04-12 10:53:06 +04:00
|
|
|
MODKEY=Mod1
|
|
|
|
UP=k
|
|
|
|
DOWN=j
|
|
|
|
LEFT=h
|
|
|
|
RIGHT=l
|
|
|
|
|
2006-12-13 13:26:38 +03:00
|
|
|
WMII_FONT='-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*'
|
2007-02-03 01:57:40 +03:00
|
|
|
# Colors tuples are "<text> <background> <border>"
|
2006-11-04 01:00:23 +03:00
|
|
|
WMII_NORMCOLORS='#222222 #eeeeee #666666'
|
2007-02-15 21:22:24 +03:00
|
|
|
WMII_FOCUSCOLORS='#ffffff #335577 #447799'
|
2006-12-18 13:50:18 +03:00
|
|
|
WMII_BACKGROUND='#333333'
|
|
|
|
|
2007-02-22 19:48:34 +03:00
|
|
|
WMII_MENU="dmenu -b -fn $WMII_FONT -nb #eeeeee -nf #222222 -sb #335577 -sf #ffffff"
|
2006-12-18 13:50:18 +03:00
|
|
|
WMII_TERM="xterm"
|
2006-02-25 21:36:53 +03:00
|
|
|
|
2007-02-22 19:48:34 +03:00
|
|
|
export WMII_MENU WMII_FONT WMII_FOCUSCOLORS WMII_SELCOLORS WMII_NORMCOLORS WMII_TERM
|
2006-10-30 11:54:22 +03:00
|
|
|
|
2006-02-25 21:36:53 +03:00
|
|
|
# WM CONFIGURATION
|
2006-12-24 02:20:28 +03:00
|
|
|
wmiir write /ctl << EOF
|
2006-06-21 06:06:02 +04:00
|
|
|
font $WMII_FONT
|
2007-02-15 21:22:24 +03:00
|
|
|
focuscolors $WMII_FOCUSCOLORS
|
2006-06-21 06:06:02 +04:00
|
|
|
normcolors $WMII_NORMCOLORS
|
2006-06-21 06:52:40 +04:00
|
|
|
grabmod $MODKEY
|
2007-02-09 09:01:54 +03:00
|
|
|
border 1
|
2006-06-21 06:06:02 +04:00
|
|
|
EOF
|
2006-05-31 21:48:44 +04:00
|
|
|
|
|
|
|
# COLUMN RULES
|
2006-12-24 02:20:28 +03:00
|
|
|
wmiir write /colrules <<EOF
|
2007-02-06 10:12:21 +03:00
|
|
|
/.*/ -> 58+42
|
2006-05-31 11:51:40 +04:00
|
|
|
EOF
|
2006-02-25 21:36:53 +03:00
|
|
|
|
2006-03-10 19:17:59 +03:00
|
|
|
# TAGGING RULES
|
2006-12-24 02:20:28 +03:00
|
|
|
wmiir write /tagrules <<EOF
|
2006-04-11 20:45:40 +04:00
|
|
|
/XMMS.*/ -> ~
|
2006-12-24 17:52:00 +03:00
|
|
|
/Gimp.*/ -> gimp
|
2006-04-26 11:32:11 +04:00
|
|
|
/MPlayer.*/ -> ~
|
2006-04-13 16:58:22 +04:00
|
|
|
/.*/ -> !
|
|
|
|
/.*/ -> 1
|
2006-03-10 19:17:59 +03:00
|
|
|
EOF
|
|
|
|
|
2007-02-11 06:04:13 +03:00
|
|
|
# FUNCTIONS
|
|
|
|
proglist() {
|
2007-02-22 19:48:34 +03:00
|
|
|
ls -lL "$@" 2>/dev/null | awk '$1 ~ /^[^d].*x/ {print $NF}' | sort | uniq
|
2007-02-11 06:04:13 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
conf_which () {
|
|
|
|
prog=$1; shift
|
|
|
|
if [ -n "$prog" ]; then
|
|
|
|
echo `PATH="$WMII_CONFPATH:$PATH" which $prog` "$@"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
tagsmenu() {
|
|
|
|
tag=`wmiir read /tag/sel/ctl`
|
2007-02-22 19:48:34 +03:00
|
|
|
wmiir ls /tag | sed "s|/||; /^sel\$/d" | $WMII_MENU
|
2007-02-11 06:04:13 +03:00
|
|
|
}
|
|
|
|
|
2006-02-25 21:36:53 +03:00
|
|
|
# MISC
|
2006-09-27 19:40:39 +04:00
|
|
|
PROGS_FILE="$WMII_NS_DIR/.dmenu.proglist"
|
2006-06-24 14:45:27 +04:00
|
|
|
ACTIONS_DIRS=`echo "$WMII_CONFPATH" | tr : ' '`
|
2007-02-03 01:57:40 +03:00
|
|
|
|
|
|
|
`conf_which status` &
|
2007-02-11 06:04:13 +03:00
|
|
|
xsetroot -solid $WMII_BACKGROUND &
|
|
|
|
proglist `echo "$PATH" | sed 'y/:/ /'` >$PROGS_FILE &
|
2006-02-25 21:36:53 +03:00
|
|
|
|
2007-02-03 01:57:40 +03:00
|
|
|
# Stop any running instances of wmiirc
|
|
|
|
echo Start wmiirc | wmiir write /event || exit 1
|
|
|
|
|
2007-02-11 06:04:13 +03:00
|
|
|
# SETUP TAG BAR
|
|
|
|
wmiir ls /lbar |
|
|
|
|
while read bar
|
|
|
|
do
|
|
|
|
wmiir remove "/lbar/$bar"
|
|
|
|
done
|
|
|
|
|
|
|
|
seltag="`wmiir read /tag/sel/ctl 2>/dev/null`"
|
|
|
|
wmiir ls /tag | sed -e 's|/||; /^sel$/d' |
|
|
|
|
while read tag
|
|
|
|
do
|
|
|
|
if [ "X$tag" = "X$seltag" ]; then
|
2007-02-15 21:22:24 +03:00
|
|
|
echo "$WMII_FOCUSCOLORS" "$tag" | wmiir create "/lbar/$tag"
|
2007-02-11 06:04:13 +03:00
|
|
|
else
|
|
|
|
echo "$WMII_NORMCOLORS" "$tag" | wmiir create "/lbar/$tag"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2007-02-03 01:57:40 +03:00
|
|
|
# BOUND KEYS
|
2006-12-24 02:20:28 +03:00
|
|
|
wmiir write /keys <<EOF
|
2006-04-12 10:53:06 +04:00
|
|
|
$MODKEY-$LEFT
|
|
|
|
$MODKEY-$RIGHT
|
|
|
|
$MODKEY-$DOWN
|
|
|
|
$MODKEY-$UP
|
2006-04-10 23:47:34 +04:00
|
|
|
$MODKEY-space
|
2006-04-07 18:08:17 +04:00
|
|
|
$MODKEY-d
|
2006-04-10 23:47:34 +04:00
|
|
|
$MODKEY-s
|
|
|
|
$MODKEY-m
|
|
|
|
$MODKEY-a
|
|
|
|
$MODKEY-p
|
2006-04-11 17:32:03 +04:00
|
|
|
$MODKEY-t
|
2006-03-09 14:00:47 +03:00
|
|
|
$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
|
2006-04-12 10:53:06 +04:00
|
|
|
$MODKEY-Shift-$LEFT
|
|
|
|
$MODKEY-Shift-$RIGHT
|
2006-05-04 16:34:44 +04:00
|
|
|
$MODKEY-Shift-$UP
|
|
|
|
$MODKEY-Shift-$DOWN
|
2006-04-10 23:47:34 +04:00
|
|
|
$MODKEY-Shift-space
|
|
|
|
$MODKEY-Shift-c
|
|
|
|
$MODKEY-Shift-t
|
2006-03-09 14:00:47 +03:00
|
|
|
$MODKEY-Shift-0
|
2006-02-26 02:44:27 +03: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 21:36:53 +03:00
|
|
|
|
|
|
|
# EVENT LOOP
|
2006-12-24 02:20:28 +03:00
|
|
|
wmiir read /event 2>/dev/null |
|
2006-02-25 21:36:53 +03:00
|
|
|
while read event
|
|
|
|
do
|
2006-05-26 18:43:52 +04:00
|
|
|
set -f
|
2006-02-25 21:36:53 +03:00
|
|
|
set -- $event
|
2006-05-26 18:43:52 +04:00
|
|
|
set +f
|
2006-02-25 21:36:53 +03:00
|
|
|
type="$1"; shift
|
2006-06-30 02:03:35 +04:00
|
|
|
parms="$@"
|
2006-02-25 21:36:53 +03:00
|
|
|
case "$type" in
|
2006-03-13 10:56:22 +03:00
|
|
|
Start)
|
2007-02-03 22:22:20 +03:00
|
|
|
if test "$1" = "wmiirc"
|
2006-03-13 10:56:22 +03:00
|
|
|
then
|
2006-03-22 18:05:12 +03:00
|
|
|
exit
|
|
|
|
fi;;
|
2006-06-06 23:10:30 +04:00
|
|
|
CreateTag)
|
2006-12-24 02:20:28 +03:00
|
|
|
echo "$WMII_NORMCOLORS" "$parms" | wmiir create "/lbar/$parms"
|
2006-06-06 23:10:30 +04:00
|
|
|
;;
|
|
|
|
DestroyTag)
|
2006-12-24 02:20:28 +03:00
|
|
|
wmiir remove "/lbar/$parms"
|
2006-06-06 23:10:30 +04:00
|
|
|
;;
|
|
|
|
FocusTag)
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite "/lbar/$parms" "$WMII_FOCUSCOLORS" "$parms"
|
2006-06-06 23:10:30 +04:00
|
|
|
;;
|
|
|
|
UnfocusTag)
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite "/lbar/$parms" "$WMII_NORMCOLORS" "$parms"
|
2006-06-06 23:10:30 +04:00
|
|
|
;;
|
2007-02-13 07:32:00 +03:00
|
|
|
UrgentTag)
|
|
|
|
shift
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite "/lbar/$@" "*$@"
|
2007-02-13 07:32:00 +03:00
|
|
|
;;
|
|
|
|
NotUrgentTag)
|
|
|
|
shift
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite "/lbar/$@" "$@"
|
2007-02-13 07:32:00 +03:00
|
|
|
;;
|
2006-06-22 01:12:02 +04:00
|
|
|
LeftBarClick)
|
2006-06-23 08:37:59 +04:00
|
|
|
shift
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite /ctl view "$@";;
|
2006-03-10 23:42:39 +03:00
|
|
|
Key)
|
2007-02-03 01:57:40 +03:00
|
|
|
key="$1"
|
|
|
|
case "$key" in
|
2006-04-12 10:53:06 +04:00
|
|
|
$MODKEY-$LEFT)
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite /tag/sel/ctl select left;;
|
2006-04-12 10:53:06 +04:00
|
|
|
$MODKEY-$RIGHT)
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite /tag/sel/ctl select right;;
|
2006-04-12 16:14:34 +04:00
|
|
|
$MODKEY-$DOWN)
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite /tag/sel/ctl select down;;
|
2006-04-12 10:53:06 +04:00
|
|
|
$MODKEY-$UP)
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite /tag/sel/ctl select up;;
|
2006-04-10 23:47:34 +04:00
|
|
|
$MODKEY-space)
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite /tag/sel/ctl select toggle;;
|
2006-04-10 23:47:34 +04:00
|
|
|
$MODKEY-d)
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite /tag/sel/ctl colmode sel default;;
|
2006-04-10 23:47:34 +04:00
|
|
|
$MODKEY-s)
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite /tag/sel/ctl colmode sel stack;;
|
2006-04-10 23:47:34 +04:00
|
|
|
$MODKEY-m)
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite /tag/sel/ctl colmode sel max;;
|
2006-04-10 23:47:34 +04:00
|
|
|
$MODKEY-a)
|
2007-02-22 19:48:34 +03:00
|
|
|
`conf_which "$(proglist $ACTIONS_DIRS | $WMII_MENU)"` &;;
|
2006-04-10 23:47:34 +04:00
|
|
|
$MODKEY-p)
|
2007-02-22 19:48:34 +03:00
|
|
|
sh -c "`$WMII_MENU <$PROGS_FILE`" &;;
|
2006-04-11 17:32:03 +04:00
|
|
|
$MODKEY-t)
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite /ctl "view `tagsmenu`" &;;
|
2006-03-06 01:38:50 +03:00
|
|
|
$MODKEY-[0-9])
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite /ctl view "`echo $key | sed 's/.*-//'`";;
|
2006-04-11 17:32:03 +04:00
|
|
|
$MODKEY-Return)
|
2006-12-18 13:50:18 +03:00
|
|
|
$WMII_TERM &;;
|
2006-04-12 17:29:03 +04:00
|
|
|
$MODKEY-Shift-$LEFT)
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite /tag/sel/ctl send sel left;;
|
2006-04-12 17:29:03 +04:00
|
|
|
$MODKEY-Shift-$RIGHT)
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite /tag/sel/ctl send sel right;;
|
2006-05-04 16:34:44 +04:00
|
|
|
$MODKEY-Shift-$DOWN)
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite /tag/sel/ctl send sel down;;
|
2006-05-04 16:34:44 +04:00
|
|
|
$MODKEY-Shift-$UP)
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite /tag/sel/ctl send sel up;;
|
2006-04-10 23:47:34 +04:00
|
|
|
$MODKEY-Shift-space)
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite /tag/sel/ctl send sel toggle;;
|
2006-04-10 23:47:34 +04:00
|
|
|
$MODKEY-Shift-c)
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite /client/sel/ctl kill;;
|
2006-03-24 17:00:53 +03:00
|
|
|
$MODKEY-Shift-t)
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite "/client/`wmiir read /client/sel/ctl`/tags" "`tagsmenu`" &;;
|
2006-04-10 23:47:34 +04:00
|
|
|
$MODKEY-Shift-[0-9])
|
2007-02-15 21:22:24 +03:00
|
|
|
wmiir xwrite /client/sel/tags "`echo $key | sed 's/.*-//'`";;
|
2006-02-25 21:36:53 +03:00
|
|
|
esac;;
|
|
|
|
esac
|
2006-05-11 03:24:21 +04:00
|
|
|
done &
|