mirror of
https://github.com/0intro/wmii
synced 2025-01-06 02:22:01 +03:00
140 lines
3.0 KiB
Bash
Executable File
140 lines
3.0 KiB
Bash
Executable File
#!9PREFIX/bin/rc
|
|
# configure wmii
|
|
|
|
PIDFILE=/tmp/ns.$USER.$DISPLAY/wmiircpid-$DISPLAY
|
|
|
|
fn xwrite { echo -n $2 | wmiir write $1 }
|
|
|
|
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)
|
|
rm -f $PIDFILE
|
|
exit
|
|
}
|
|
|
|
WMII_FONT='fixed'
|
|
WMII_SELCOLORS='#ffffff #555588 #8888bb'
|
|
WMII_NORMCOLORS='#dddddd #666666 #999999'
|
|
|
|
CLIENT_BAR=0
|
|
CLIENT_BORDER=3
|
|
MODKEY=Alt
|
|
|
|
|
|
# WMIIWM CONFIGURATION
|
|
xwrite /def/bar $CLIENT_BAR
|
|
xwrite /def/border $CLIENT_BORDER
|
|
xwrite /def/inc 1
|
|
xwrite /def/snap 20
|
|
xwrite /def/font $WMII_FONT
|
|
xwrite /def/selcolors $WMII_SELCOLORS
|
|
xwrite /def/normcolors $WMII_NORMCOLORS
|
|
for(page in `{wmiir read / | grep '^d' | awk '{print $10}' | grep -v new}) {
|
|
for(area in `{wmiir read /$page | grep '^d' | awk '{print $10}' | grep -v new}) {
|
|
for(client in `{wmiir read /$page/$area | grep '^d' | awk '{print $10}'}) {
|
|
xwrite /$page/$area/$client/bar $CLIENT_BAR
|
|
xwrite /$page/$area/$client/border $CLIENT_BORDER
|
|
}
|
|
}
|
|
}
|
|
|
|
for(i in \
|
|
$MODKEY-Control-q,y \
|
|
$MODKEY-Control-w,y \
|
|
$MODKEY-Control-c \
|
|
$MODKEY-t \
|
|
$MODKEY-d \
|
|
$MODKEY-a \
|
|
$MODKEY-Shift-a \
|
|
$MODKEY-n \
|
|
$MODKEY-m \
|
|
$MODKEY-Return \
|
|
$MODKEY-Shift-Return \
|
|
$MODKEY-Control-y \
|
|
$MODKEY-h \
|
|
$MODKEY-l \
|
|
$MODKEY-Tab \
|
|
$MODKEY-j \
|
|
$MODKEY-k \
|
|
$MODKEY-Shift-h \
|
|
$MODKEY-Shift-l \
|
|
$MODKEY-Shift-p)
|
|
xwrite /ctl 'grab '^$i
|
|
|
|
for(i in 1 2 3 4 5 6 7 8 9)
|
|
xwrite /ctl 'grab '^$MODKEY^'-Shift-'^$i
|
|
|
|
|
|
# WMIIBAR CONFIGURATION
|
|
xwrite /bar/new/data 1
|
|
xwrite /bar/new/data ''
|
|
xwrite /bar/new/data fnord
|
|
xwrite /bar/expand 2
|
|
|
|
|
|
# MISC
|
|
xsetroot -mod 2 2 -bg '#444466' -fg '#555555'
|
|
status &
|
|
|
|
# EVENT LOOP
|
|
wmiir read /event | \
|
|
while(event=`{read}) {
|
|
if(~ $event(1) P)
|
|
xwrite /bar/1/data $event(2)
|
|
if(~ $event(1) C) {
|
|
text=`{echo $"event | sed 's/^C //g'}
|
|
xwrite /bar/2/data $"text
|
|
}
|
|
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-t
|
|
extern xterm -rv &
|
|
case $MODKEY-d
|
|
xwrite /sel/sel/sel/ctl detach
|
|
case $MODKEY-a
|
|
xwrite /ctl attach
|
|
case $MODKEY-Shift-a
|
|
xwrite /ctl detached
|
|
case $MODKEY-n
|
|
wmiir read /sel/new >/dev/null >[2=1]
|
|
case $MODKEY-m
|
|
xwrite /sel/sel/sel/ctl max
|
|
case $MODKEY-Return
|
|
xwrite /sel/sel/ctl 'swap east'
|
|
case $MODKEY-Shift-Return
|
|
xwrite /sel/sel/ctl 'swap west'
|
|
case $MODKEY-Control-y
|
|
wmiir read /new >/dev/null >[2=1]
|
|
case $MODKEY-h
|
|
xwrite /sel/ctl 'select next'
|
|
case $MODKEY-l
|
|
xwrite /sel/ctl 'select prev'
|
|
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]
|
|
xwrite /ctl 'select '^`{echo $k|sed 's/.*-//g'}
|
|
}
|
|
}
|
|
}
|