wmii/rc/wmiirc
2006-01-30 00:15:50 +02:00

153 lines
5.3 KiB
Bash
Executable File

#!9PREFIX/bin/rc
# configure wmii
TAB=0
HANDLEINC=1
BAR_ALIGN=south
SEL_BG_COLOR='#204060'
SEL_FG_COLOR='#eeeeee'
SEL_BORDER_COLOR='#406080'
NORM_BG_COLOR='#000000'
NORM_FG_COLOR='#eeeeee'
NORM_BORDER_COLOR='#111111'
FONT='-artwiz-snap-normal-*-*-*-*-*-*-*-*-*-*-*'
MODKEY=M
NORTHKEY=k
SOUTHKEY=j
WESTKEY=h
EASTKEY=l
nl='
'
fn kbind {
wmiir create /keys/mode/$1/$2 $3
}
fn selstyle {
wmiir write $1/fgcolor $SEL_FG_COLOR
wmiir write $1/bgcolor $SEL_BG_COLOR
wmiir write $1/bordercolor $SEL_BORDER_COLOR
}
fn normstyle {
wmiir write $1/fgcolor $NORM_FG_COLOR
wmiir write $1/bgcolor $NORM_BG_COLOR
wmiir write $1/bordercolor $NORM_BORDER_COLOR
}
fn items {
ifs=:$nl { dirs=`{echo $2} }
{
for(dir in $dirs) {
for(file in $dir/*) {
if(! ~ $file $dir^'/*' && ! test -d $file && test -x $file) {
file=`{basename $file}
echo create /menu/items/$1/$"file $"file
}
}
}
} | sort | wmiir -f &
}
fn clientsconf {
for(client in `{wmiir read $1 | grep '^[0-9]'}) {
wmiir write $1/$client/tab $TAB
wmiir write $1/$client/handleinc $HANDLEINC
wmiir write $1/$client/geometry '+0 +0 +0 +0' # causes refresh
}
}
# WMIIWM CONFIGURATION
wmiir write /wm/default/font $FONT
wmiir write /wm/default/transcolor $SEL_BORDER_COLOR
wmiir write /wm/default/handleinc $HANDLEINC
wmiir write /wm/default/tab $TAB
wmiir write /wm/default/border 1
for(page in `{wmiir read /wm | grep '^[0-9]'})
clientsconf /wm/$page/client
wmiir write /wm/default/sstyle/fgcolor $SEL_FG_COLOR
wmiir write /wm/default/sstyle/bgcolor $SEL_BG_COLOR
wmiir write /wm/default/sstyle/bordercolor $SEL_BORDER_COLOR
wmiir write /wm/default/nstyle/fgcolor $NORM_FG_COLOR
wmiir write /wm/default/nstyle/bgcolor $NORM_BG_COLOR
wmiir write /wm/default/nstyle/bordercolor $NORM_BORDER_COLOR
wmiir write /wm/default/event/b2press 'wmiir write /wm/ctl close'
# WMIIKEYS CONFIGURATION
kbind bare $MODKEY-Escape 'kmode normal'
kbind move Escape 'kmode normal'
kbind move $MODKEY-C-r 'kmode resize'
kbind move $NORTHKEY 'wmiir write /wm/sel/client/sel/geometry ''-0 -30 -0 -0'''
kbind move $SOUTHKEY 'wmiir write /wm/sel/client/sel/geometry ''+0 +30 +0 +0'''
kbind move $WESTKEY 'wmiir write /wm/sel/client/sel/geometry ''-40 -0 -0 -0'''
kbind move $EASTKEY 'wmiir write /wm/sel/client/sel/geometry ''+40 +0 +0 +0'''
kbind move S-$NORTHKEY 'wmiir write /wm/sel/client/sel/geometry ''-0 north -0 -0'''
kbind move S-$SOUTHKEY 'wmiir write /wm/sel/client/sel/geometry ''+0 south +0 +0'''
kbind move S-$WESTKEY 'wmiir write /wm/sel/client/sel/geometry ''west -0 -0 -0'''
kbind move S-$EASTKEY 'wmiir write /wm/sel/client/sel/geometry ''east +0 +0 +0'''
kbind resize Escape 'kmode normal'
kbind resize $MODKEY-C-m 'kmode move'
kbind resize $NORTHKEY 'wmiir write /wm/sel/client/sel/geometry ''+0 +0 +0 -30'''
kbind resize $SOUTHKEY 'wmiir write /wm/sel/client/sel/geometry ''+0 +0 +0 +30'''
kbind resize $WESTKEY 'wmiir write /wm/sel/client/sel/geometry ''+0 +0 -40 +0'''
kbind resize $EASTKEY 'wmiir write /wm/sel/client/sel/geometry ''+0 +0 +40 +0'''
kbind normal $MODKEY-C-b 'kmode bare'
kbind normal $MODKEY-C-m 'kmode move'
kbind normal $MODKEY-C-r 'kmode resize'
kbind normal $MODKEY-C-a 'wmiir write /menu/precmd ''''; wmiir write /menu/lookup /items/actions; wmiir write /menu/ctl ''display 1'''
kbind normal $MODKEY-C-p 'wmiir write /menu/precmd extern; wmiir write /menu/lookup /items/programs; wmiir write /menu/ctl ''display 1'''
kbind normal $MODKEY-C-c 'wmiir write /wm/ctl close'
kbind normal $MODKEY-C-q,y quit
kbind normal $MODKEY-C-w,y wmiirc
kbind normal $MODKEY-t 'extern xterm ''+sb'' -bg ''#000000'' -fg ''#ffffff'' -cr ''#ffffff'' -sl 4000'
kbind normal $MODKEY-d 'wmiir write /wm/ctl detach'
kbind normal $MODKEY-a 'wmiir write /wm/ctl attach'
kbind normal $MODKEY-S-a 'wmiir write /wm/ctl detclients'
kbind normal $MODKEY-n 'wmiir write /wm/sel/ctl newcol'
kbind normal $MODKEY-m 'wmiir write /wm/sel/client/sel/ctl max'
kbind normal $MODKEY-Return 'wmiir write /wm/sel/ctl ''swap west'''
kbind normal $MODKEY-S-Return 'wmiir write /wm/sel/ctl ''swap east'''
kbind normal $MODKEY-C-y 'wmiir write /wm/ctl new'
kbind normal $MODKEY-$WESTKEY 'wmiir write /wm/sel/ctl ''select west'''
kbind normal $MODKEY-$EASTKEY 'wmiir write /wm/sel/ctl ''select east'''
kbind normal $MODKEY-Tab 'wmiir write /wm/sel/ctl ''select next'''
kbind normal $MODKEY-$SOUTHKEY 'wmiir write /wm/sel/ctl ''select next'''
kbind normal $MODKEY-$NORTHKEY 'wmiir write /wm/sel/ctl ''select prev'''
kbind normal $MODKEY-S-$WESTKEY 'wmiir write /wm/ctl ''select prev'''
kbind normal $MODKEY-S-$EASTKEY 'wmiir write /wm/ctl ''select next'''
kbind normal $MODKEY-space 'wmiir write /wm/sel/ctl toggle'
kbind normal $MODKEY-S-p 'wmiir write /wm/ctl pager'
for(i in 0 1 2 3 4 5 6 7 8 9) {
kbind normal $MODKEY-S-$i 'wmiir write /wm/ctl ''select '^$i^''''
}
wmiir write /keys/box/font $FONT
selstyle /keys/box
kmode normal
# WMIIMENU CONFIGURATION
wmiir write /menu/geometry $BAR_ALIGN
items actions $WMII_CONFDIR:$HOME/.wmii-3
wmiir create /menu/items/actions/rmpage 'wmiir write /wm/ctl destroy'
items programs $OLD_PATH
wmiir write /menu/font $FONT
normstyle /menu/nstyle >[2]/dev/null
selstyle /menu/sstyle >[2]/dev/null
# MISC
xsetroot -solid black
status&