wmii/rc/wmiirc

178 lines
6.1 KiB
Bash

#!9PREFIX/bin/rc
# configure wmii
TAB=0
HANDLEINC=1
BAR_ALIGN=south
SEL_BG_COLOR='#002200'
SEL_FG_COLOR='#66ff00'
SEL_BORDER_COLOR='#66ff00'
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|sed ''s/,/ /g''|awk ''{print $4}''} wmiir write /wm/default/area/geometry ''+0,+0,+0,-''^$val'
if not
wmiir write /bar/event/resize 'val=`{wmiir read /bar/geometry|sed ''s/,/ /g''|awk ''{print $4}''} wmiir write /wm/default/area/geometry ''+0,+''^$val^'',+0,-''^$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'
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/border 1
wmiir write /wm/event/clientupdate \
'text=`{wmiir read /wm/sel/layout/sel/frame/sel/name} \
wmiir write /bar/'^$clab^'/data $"text'
wmiir write /wm/event/pageupdate \
'wmiir write /bar/'^$plab^'/data `{wmiir read /wm/sel/name} &&' ^ \
'wmiir write /bar/'^$llab^'/data `{wmiir read /wm/sel/layout/sel/name}'
for(layout in /wm/sel/layout/float /wm/sel/layout/managed) {
framesconf $layout
}
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 normal $MODKEY-C-b 'kmode bare'
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-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 detached_clients'
kbind normal $MODKEY-S-c 'wmiir write /wm/sel/layout/manage/name column'
kbind normal $MODKEY-n 'wmiir write /wm/sel/layout/sel/ctl new'
kbind normal $MODKEY-S-f 'wmiir write /wm/sel/layout/sel/name 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 ''select next'''
kbind normal $MODKEY-S-Tab 'wmiir write /wm/sel/layout/sel/frame/sel/ctl ''select next'''
kbind normal $MODKEY-S-$SOUTHKEY 'wmiir write /wm/sel/layout/sel/frame/sel/ctl ''select next'''
kbind normal $MODKEY-S-$NORTHKEY 'wmiir write /wm/sel/layout/sel/frame/sel/ctl ''select prev'''
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&