2006-02-10 19:09:59 +03:00
|
|
|
#!9PREFIX/bin/rc
|
2005-12-12 17:08:16 +03:00
|
|
|
# configure wmii
|
|
|
|
|
2006-02-10 23:26:16 +03:00
|
|
|
PIDFILE=/tmp/ns.$USER.$DISPLAY/wmiircpid
|
2006-02-10 11:13:35 +03:00
|
|
|
|
2006-02-18 23:23:49 +03:00
|
|
|
fn xwrite {
|
|
|
|
echo -n $2 | wmiir write $1
|
|
|
|
}
|
2006-02-19 14:48:29 +03:00
|
|
|
fn maxlab {
|
|
|
|
awk '/[0-9]+$/ {if($10>max) max=$10} END{print max}'
|
|
|
|
}
|
2006-02-10 11:13:35 +03:00
|
|
|
|
|
|
|
if(test -r $PIDFILE) {
|
|
|
|
kill -2 `{cat $PIDFILE} >[2]/dev/null
|
|
|
|
}
|
|
|
|
echo $pid >$PIDFILE
|
|
|
|
|
|
|
|
# install signal handler for artificial sigexit:
|
|
|
|
fn sigint {
|
|
|
|
if(test -f $PIDFILE && ~ `{cat $PIDFILE} $pid)
|
2006-02-18 23:23:49 +03:00
|
|
|
rm -f $PIDFILE
|
2006-02-10 11:13:35 +03:00
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
2006-02-10 20:32:35 +03:00
|
|
|
|
2006-02-11 00:33:46 +03:00
|
|
|
CLIENT_BAR=1
|
2006-02-08 19:34:13 +03:00
|
|
|
CLIENT_BORDER=3
|
2006-02-10 11:13:35 +03:00
|
|
|
MODKEY=Alt
|
2006-02-18 23:23:49 +03:00
|
|
|
WMII_FONT='fixed'
|
|
|
|
WMII_NORMCOLORS='#222222 #eeeeee #666666'
|
|
|
|
WMII_SELCOLORS='#ffffff #285577 #4c7899'
|
2005-12-12 17:08:16 +03:00
|
|
|
|
2006-02-10 19:13:26 +03:00
|
|
|
|
2006-02-11 16:07:36 +03:00
|
|
|
# WM CONFIGURATION
|
2006-02-10 11:13:35 +03:00
|
|
|
xwrite /def/bar $CLIENT_BAR
|
|
|
|
xwrite /def/border $CLIENT_BORDER
|
2006-02-10 19:51:20 +03:00
|
|
|
xwrite /def/inc 1
|
2006-02-10 19:13:26 +03:00
|
|
|
xwrite /def/snap 20
|
2006-02-10 20:32:35 +03:00
|
|
|
xwrite /def/font $WMII_FONT
|
|
|
|
xwrite /def/selcolors $WMII_SELCOLORS
|
|
|
|
xwrite /def/normcolors $WMII_NORMCOLORS
|
2006-02-18 23:23:49 +03:00
|
|
|
for(page in `{wmiir read / | awk '/^d/ && !/new$/ {print $NF}'}) {
|
|
|
|
for(area in `{wmiir read /$page | awk '/^d/ && !/new$/ {print $NF}'}) {
|
|
|
|
for(client in `{wmiir read /$page/$area | awk '/^d/ {print $NF}'}) {
|
|
|
|
xwrite /$page/$area/$client/bar $CLIENT_BAR
|
|
|
|
xwrite /$page/$area/$client/border $CLIENT_BORDER
|
|
|
|
}
|
|
|
|
}
|
2006-02-08 19:34:13 +03:00
|
|
|
}
|
2005-12-12 17:08:16 +03:00
|
|
|
|
2006-02-11 16:07:36 +03:00
|
|
|
# BAR CONFIGURATION
|
2006-02-19 14:48:29 +03:00
|
|
|
for(i in `{seq 1 `{wmiir read /bar|maxlab}})
|
2006-02-18 23:23:49 +03:00
|
|
|
wmiir remove /bar/1 >/dev/null >[2=1]
|
2006-02-10 22:52:32 +03:00
|
|
|
xwrite /bar/new/colors $WMII_NORMCOLORS
|
|
|
|
xwrite /bar/new/colors $WMII_SELCOLORS
|
|
|
|
xwrite /bar/1/data 1
|
2006-02-10 19:51:20 +03:00
|
|
|
xwrite /bar/expand 2
|
2006-02-10 19:13:26 +03:00
|
|
|
|
2006-02-11 16:07:36 +03:00
|
|
|
# MENU CONFIGURATION
|
|
|
|
nl='
|
|
|
|
'
|
|
|
|
fn items {
|
2006-02-19 00:35:43 +03:00
|
|
|
ls -lpQ $* | awk '!/^d/ && $1 ~ /x/ {print $NF}' | sort | uniq
|
2006-02-11 16:07:36 +03:00
|
|
|
}
|
2006-02-19 00:35:43 +03:00
|
|
|
items $old_path >/tmp/ns.$USER.$DISPLAY/p.menu &
|
2006-02-08 19:59:57 +03:00
|
|
|
|
2005-12-12 17:08:16 +03:00
|
|
|
# MISC
|
2006-02-13 12:31:38 +03:00
|
|
|
xsetroot -solid '#0b1014'
|
2006-02-10 11:13:35 +03:00
|
|
|
status &
|
2006-02-09 21:40:12 +03:00
|
|
|
|
2006-02-19 14:13:35 +03:00
|
|
|
# KEYS CONFIGURATION
|
|
|
|
for(i in \
|
|
|
|
$MODKEY-Control-^(c w,y q,y p a y) \
|
|
|
|
$MODKEY-^(t d a n m Return) \
|
|
|
|
$MODKEY-^(h l j k Tab ) \
|
|
|
|
$MODKEY-Shift-^(a h l p Return) \
|
2006-02-24 09:29:09 +03:00
|
|
|
$MODKEY-Shift-^`{seq 1 9} \
|
|
|
|
$MODKEY-Control-^`{seq 1 9})
|
2006-02-19 14:13:35 +03:00
|
|
|
echo -n | wmiir create /keys/$i
|
|
|
|
|
2006-02-10 19:13:26 +03:00
|
|
|
# EVENT LOOP
|
2006-02-18 23:23:49 +03:00
|
|
|
wmiir read /event |
|
2006-02-10 18:10:21 +03:00
|
|
|
while(event=`{read}) {
|
2006-02-18 23:23:49 +03:00
|
|
|
if(~ $event(1) PN)
|
|
|
|
xwrite /bar/1/data $event(2)
|
|
|
|
if(~ $event(1) CN) {
|
|
|
|
buf=`{echo $"event | sed 's/^CN //'}
|
|
|
|
xwrite /bar/2/data $"buf
|
|
|
|
}
|
|
|
|
if(~ $event(1) CF) {
|
2006-02-19 14:13:35 +03:00
|
|
|
buf=`{echo $event| awk '{print "warp "$2+4" "$3+4}'}
|
2006-02-18 23:23:49 +03:00
|
|
|
xwrite /ctl $"buf
|
|
|
|
}
|
|
|
|
if(~ $event(1) LB) { # label button press
|
|
|
|
switch($event(3)) { # button
|
|
|
|
case 1
|
|
|
|
if(~ $event(2) 1) { # label
|
|
|
|
xwrite /ctl pager
|
|
|
|
}
|
|
|
|
if not {
|
|
|
|
xwrite /ctl 'select prev'
|
|
|
|
}
|
|
|
|
case 3
|
|
|
|
xwrite /ctl 'select next'
|
|
|
|
case 4
|
|
|
|
xwrite /ctl 'select next'
|
|
|
|
case 5
|
|
|
|
xwrite /ctl 'select prev'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(~ $event(1) K) { # key press
|
|
|
|
switch($event(2)) {
|
|
|
|
case $MODKEY-Control-c
|
|
|
|
xwrite /sel/sel/sel/ctl kill
|
|
|
|
case $MODKEY-Control-w,y
|
|
|
|
wmiirc &
|
|
|
|
case $MODKEY-Control-q,y
|
|
|
|
xwrite /ctl quit
|
|
|
|
case $MODKEY-Control-p
|
2006-02-19 00:00:00 +03:00
|
|
|
{
|
|
|
|
cmd=`{cat /tmp/ns.$USER.$DISPLAY/p.menu | wmiimenu}
|
|
|
|
if(! ~ $#cmd 0)
|
|
|
|
extern $cmd
|
|
|
|
} &
|
2006-02-18 23:23:49 +03:00
|
|
|
case $MODKEY-Control-a
|
2006-02-19 00:00:00 +03:00
|
|
|
{
|
2006-02-19 00:35:43 +03:00
|
|
|
cmd=`{items CONFPREFIX/wmii-3 $HOME/.wmii-3 | wmiimenu}
|
2006-02-19 00:00:00 +03:00
|
|
|
if(! ~ $#cmd 0)
|
|
|
|
$cmd
|
|
|
|
} &
|
2006-02-18 23:23:49 +03:00
|
|
|
case $MODKEY-t
|
|
|
|
extern xterm -rv &
|
|
|
|
case $MODKEY-n
|
|
|
|
wmiir read /sel/new >/dev/null >[2=1]
|
|
|
|
case $MODKEY-m
|
|
|
|
xwrite /sel/sel/sel/ctl max
|
|
|
|
case $MODKEY-Return
|
2006-02-24 11:52:20 +03:00
|
|
|
xwrite /sel/sel/sel/ctl 'sendtoarea prev'
|
2006-02-18 23:23:49 +03:00
|
|
|
case $MODKEY-Shift-Return
|
2006-02-24 11:52:20 +03:00
|
|
|
xwrite /sel/sel/sel/ctl 'sendtoarea next'
|
2006-02-18 23:23:49 +03:00
|
|
|
case $MODKEY-Control-y
|
|
|
|
wmiir read /new >/dev/null >[2=1]
|
|
|
|
case $MODKEY-h
|
|
|
|
xwrite /sel/ctl 'select prev'
|
2006-02-19 18:21:01 +03:00
|
|
|
case $MODKEY-l
|
|
|
|
xwrite /sel/ctl 'select next'
|
2006-02-18 23:23:49 +03:00
|
|
|
case $MODKEY-Tab
|
|
|
|
xwrite /sel/sel/ctl 'select next'
|
|
|
|
case $MODKEY-j
|
|
|
|
xwrite /sel/sel/ctl 'select next'
|
|
|
|
case $MODKEY-k
|
|
|
|
xwrite /sel/sel/ctl 'select prev'
|
|
|
|
case $MODKEY-Shift-h
|
|
|
|
xwrite /ctl 'select prev'
|
|
|
|
case $MODKEY-Shift-l
|
|
|
|
xwrite /ctl 'select next'
|
|
|
|
case $MODKEY-Shift-p
|
|
|
|
xwrite /ctl pager
|
|
|
|
case $MODKEY-Shift-[1-9]
|
2006-02-19 14:13:35 +03:00
|
|
|
xwrite /ctl 'select '^`{echo $event|awk -F- '{print $3}'}
|
2006-02-24 09:29:09 +03:00
|
|
|
case $MODKEY-Control-[1-9]
|
2006-02-24 11:52:20 +03:00
|
|
|
xwrite /sel/sel/sel/ctl 'sendtopage '^`{echo $event|awk -F- '{print $3}'}
|
2006-02-18 23:23:49 +03:00
|
|
|
}
|
|
|
|
}
|
2006-02-09 21:40:12 +03:00
|
|
|
}
|