wmii/rc/wmiirc

208 lines
7.4 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 framesconf {
for(frame in `{wmiir read $1 | grep '^[0-9]'}) {
wmiir write $1/$frame/tab $TAB
wmiir write $1/$frame/handleinc $HANDLEINC
wmiir write $1/$frame/geometry '+0 +0 +0 +0' # causes refresh
}
}
# WMIIBAR CONFIGURATION
fn barsucks {
wmiir write /bar/$1/b1press 'wmiir write /wm/ctl ''select prev'''
wmiir write /bar/$1/b3press 'wmiir write /wm/ctl ''select next'''
wmiir write /bar/$1/b4press 'wmiir write /wm/ctl ''select prev'''
wmiir write /bar/$1/b5press 'wmiir write /wm/ctl ''select next'''
}
wmiir write /bar/geometry $BAR_ALIGN
if(~ $BAR_ALIGN south)
wmiir write /bar/event/resize \
'val=`{wmiir read /bar/geometry | ' ^\
'awk ''{print "+0 +0 +0 -"$4}''} wmiir write /wm/default/geometry $"val'
if not
wmiir write /bar/event/resize \
'val=`{wmiir read /bar/geometry | ' ^\
'awk ''{print "+0 +"$4" +0 -"$4}''} wmiir write /wm/default/geometry $"val'
wmiir write /bar/ctl reset
wmiir write /bar/font $FONT
wmiir write /bar/fgcolor $NORM_FG_COLOR
wmiir write /bar/bgcolor $NORM_BG_COLOR
wmiir write /bar/bordercolor $NORM_BORDER_COLOR
plab=`{wmiir read /bar/new}
wmiir write /bar/$plab/b1press 'wmiir write /wm/ctl pager'
llab=`{wmiir read /bar/new}
wmiir write /bar/$llab/b1press 'wmiir write /wm/ctl pager'
klab=`{wmiir read /bar/new}
clab=`{wmiir read /bar/new}
wmiir write /bar/$clab/fgcolor $SEL_FG_COLOR
wmiir write /bar/$clab/bgcolor $SEL_BG_COLOR
wmiir write /bar/$clab/bordercolor $SEL_BG_COLOR
barsucks $clab
wmiir write /bar/expandable $clab
wmiir write /bar/ctl 'display 1'
# 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
wmiir write /wm/event/clientupdate \
's=`{wmiir read /wm/sel/layout/sel/frame/sel/name} ' ^\
'wmiir write /bar/'^$clab^'/data $"s'
wmiir write /wm/event/pageupdate \
's=`{wmiir read /wm/sel/name} wmiir write /bar/'$plab'/data $"s && ' ^\
's=`{wmiir read /keys/lookup | sed s,/mode/,,} wmiir write /bar/'$klab'/data $"s && ' ^\
's=`{wmiir read /wm/sel/layoutname} wmiir write /bar/'$llab'/data $"s'
for(page in `{wmiir read /wm | grep '^[0-9]'}) {
framesconf /wm/$page/layout/float/frame
framesconf /wm/$page/layout/managed/frame
}
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/layout/sel/frame/sel/geometry ''-0 -30 -0 -0'''
kbind move $SOUTHKEY 'wmiir write /wm/sel/layout/sel/frame/sel/geometry ''+0 +30 +0 +0'''
kbind move $WESTKEY 'wmiir write /wm/sel/layout/sel/frame/sel/geometry ''-40 -0 -0 -0'''
kbind move $EASTKEY 'wmiir write /wm/sel/layout/sel/frame/sel/geometry ''+40 +0 +0 +0'''
kbind move S-$NORTHKEY 'wmiir write /wm/sel/layout/sel/frame/sel/geometry ''-0 north -0 -0'''
kbind move S-$SOUTHKEY 'wmiir write /wm/sel/layout/sel/frame/sel/geometry ''+0 south +0 +0'''
kbind move S-$WESTKEY 'wmiir write /wm/sel/layout/sel/frame/sel/geometry ''west -0 -0 -0'''
kbind move S-$EASTKEY 'wmiir write /wm/sel/layout/sel/frame/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/layout/sel/frame/sel/geometry ''+0 +0 +0 -30'''
kbind resize $SOUTHKEY 'wmiir write /wm/sel/layout/sel/frame/sel/geometry ''+0 +0 +0 +30'''
kbind resize $WESTKEY 'wmiir write /wm/sel/layout/sel/frame/sel/geometry ''+0 +0 -40 +0'''
kbind resize $EASTKEY 'wmiir write /wm/sel/layout/sel/frame/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-S-c 'wmiir write /wm/sel/layoutname column'
kbind normal $MODKEY-n 'wmiir write /wm/sel/layout/sel/ctl new'
kbind normal $MODKEY-m 'wmiir write /wm/sel/layout/sel/ctl max'
kbind normal $MODKEY-S-f 'wmiir write /wm/sel/layoutname float'
kbind normal $MODKEY-Return 'wmiir write /wm/sel/layout/sel/ctl ''swap west'''
kbind normal $MODKEY-S-Return 'wmiir write /wm/sel/layout/sel/ctl ''swap east'''
kbind normal $MODKEY-C-y 'wmiir write /wm/ctl new'
kbind normal $MODKEY-$WESTKEY 'wmiir write /wm/sel/layout/sel/ctl ''select west'''
kbind normal $MODKEY-$EASTKEY 'wmiir write /wm/sel/layout/sel/ctl ''select east'''
kbind normal $MODKEY-Tab 'wmiir write /wm/sel/layout/sel/ctl ''select next'''
kbind normal $MODKEY-$SOUTHKEY 'wmiir write /wm/sel/layout/sel/ctl ''select next'''
kbind normal $MODKEY-$NORTHKEY 'wmiir write /wm/sel/layout/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&