wmii/rc/wmirc

167 lines
5.1 KiB
Bash

#!9PREFIX/bin/rc
# configure wmii
TAB=1
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 {
wmir create /keys/mode/$1/$2 $3
}
fn selstyle {
wmir write $1/fgcolor $SEL_FG_COLOR
wmir write $1/bgcolor $SEL_BG_COLOR
wmir write $1/bordercolor $SEL_BORDER_COLOR
}
fn normstyle {
wmir write $1/fgcolor $NORM_FG_COLOR
wmir write $1/bgcolor $NORM_BG_COLOR
wmir 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 | wmir -f &
}
fn frameconf {
wmir write $1/event/b2press 'wmir write /wm/ctl close'
normstyle $1/nstyle
selstyle $1/sstyle
wmir write $1/tab $TAB
if(~ $2 refresh)
wmir write $1/geometry +0,+0,+0,+0 # causes refresh
}
fn framesconf {
for(frame in `{wmir read $1 | grep '^[0-9]'})
frameconf $1/$frame $2
}
# WMIBAR CONFIGURATION
fn barsucks {
wmir write /bar/$1/b1press 'wmir write /wm/ctl ''select prev'''
wmir write /bar/$1/b3press 'wmir write /wm/ctl ''select next'''
wmir write /bar/$1/b4press 'wmir write /wm/ctl ''select prev'''
wmir write /bar/$1/b5press 'wmir write /wm/ctl ''select next'''
}
wmir write /bar/ctl reset
wmir write /bar/font $FONT
wmir write /bar/fgcolor $NORM_FG_COLOR
wmir write /bar/bgcolor $NORM_BG_COLOR
wmir write /bar/bordercolor $NORM_BORDER_COLOR
plab=`{wmir read /bar/new}
wmir write /bar/$plab/b1press 'wmir write /wm/ctl pager'
llab=`{wmir read /bar/new}
wmir write /bar/$llab/b1press 'wmir write /wm/ctl pager'
clab=`{wmir read /bar/new}
wmir write /bar/$clab/fgcolor $SEL_FG_COLOR
wmir write /bar/$clab/bgcolor $SEL_BG_COLOR
wmir write /bar/$clab/bordercolor $SEL_BG_COLOR
barsucks $clab
wmir write /bar/expandable $clab
wmir write /bar/ctl 'display 1'
# WMIIWM CONFIGURATION
# default layout (column, float):
wmir write /wm/default/layout column
wmir write /wm/default/font $FONT
wmir write /wm/default/transcolor $SEL_BORDER_COLOR
wmir write /wm/default/handleinc 1
wmir write /wm/default/border 1
wmir write /wm/event/clientupdate \
'text=`{wmir read /wm/sel/layout/sel/frame/sel/client/sel/name} \
wmir write /bar/'^$clab^'/data $"text'
wmir write /wm/event/pageupdate \
'wmir write /bar/'^$plab^'/data `{wmir read /wm/sel/name} &&' ^ \
'wmir write /bar/'^$llab^'/data `{wmir read /wm/sel/layout/sel/name}'
for(frame in `{wmir read /wm/sel/layout/sel | grep '^[0-9]'})
framesconf /wm/sel/layout/sel/$frame refresh
frameconf /wm/default norefresh
# WMIKEYS CONFIGURATION
kbind bare $MODKEY-Escape 'kmode normal'
kbind normal $MODKEY-C-b 'kmode bare'
kbind normal $MODKEY-C-a 'wmir write /menu/precmd ''''; wmir write /menu/lookup /items/actions; wmir write /menu/ctl ''display 1'''
kbind normal $MODKEY-C-p 'wmir write /menu/precmd extern; wmir write /menu/lookup /items/programs; wmir write /menu/ctl ''display 1'''
kbind normal $MODKEY-C-c 'wmir write /wm/ctl close'
kbind normal $MODKEY-C-q,y quit
kbind normal $MODKEY-C-w,y wmirc
kbind normal $MODKEY-t 'extern xterm ''+sb'' -bg ''#000000'' -fg ''#ffffff'' -cr ''#ffffff'' -sl 4000 -fn -artwiz-smoothansi-*-*-*-*-*-*-*-*-*-*-*-*'
kbind normal $MODKEY-d 'wmir write /wm/ctl detach'
kbind normal $MODKEY-a 'wmir write /wm/ctl attach'
kbind normal $MODKEY-S-a 'wmir write /wm/ctl ''detached clients'''
kbind normal $MODKEY-Return 'wmir write /wm/sel/ctl ''select zoomed'''
kbind normal $MODKEY-C-y 'wmir write /wm/ctl new'
kbind normal $MODKEY-u 'wmir write /wm/sel/layout/sel/frame/sel/locked 0'
kbind normal $MODKEY-S-u 'wmir write /wm/sel/layout/sel/frame/sel/locked 1'
kbind normal $MODKEY-$WESTKEY 'wmir write /wm/ctl ''select prev'''
kbind normal $MODKEY-$EASTKEY 'wmir write /wm/ctl ''select next'''
kbind normal $MODKEY-Tab 'wmir write /wm/sel/ctl ''select next'''
kbind normal $MODKEY-$SOUTHKEY 'wmir write /wm/sel/ctl ''select next'''
kbind normal $MODKEY-$NORTHKEY 'wmir write /wm/sel/ctl ''select prev'''
kbind normal $MODKEY-S-Tab 'wmir write /wm/sel/layout/sel/frame/sel/ctl ''select next'''
kbind normal $MODKEY-S-$SOUTHKEY 'wmir write /wm/sel/layout/sel/frame/sel/ctl ''select next'''
kbind normal $MODKEY-S-$NORTHKEY 'wmir write /wm/sel/layout/sel/frame/sel/ctl ''select prev'''
kbind normal $MODKEY-space 'wmir write /wm/sel/ctl ''select toggled'''
kbind normal $MODKEY-S-p 'wmir write /wm/ctl pager'
for(i in 0 1 2 3 4 5 6 7 8 9) {
kbind normal $MODKEY-S-$i 'wmir write /wm/ctl ''select '^$i^''''
}
wmir write /keys/box/font $FONT
selstyle /keys/box
kmode normal
# WMIMENU CONFIGURATION
items actions $WMII_CONFDIR:$HOME/.wmii-3
wmir create /menu/items/actions/rmpage 'wmir write /wm/ctl destroy'
items programs $OLD_PATH
wmir write /menu/font $FONT
normstyle /menu/nstyle >[2]/dev/null
selstyle /menu/sstyle >[2]/dev/null
# MISC
xsetroot -solid black
status&