mirror of
https://github.com/0intro/wmii
synced 2024-11-22 05:42:05 +03:00
Allow for wmiirc_local
This commit is contained in:
parent
ed9fb216e6
commit
4ec3dc80e6
@ -4,10 +4,6 @@ if [ -z "$scriptname" ]; then
|
||||
echo Start $wmiiscript | wmiir write /event 2>/dev/null ||
|
||||
exit 1
|
||||
|
||||
Keys=""
|
||||
Actions=""
|
||||
Events=""
|
||||
|
||||
wi_nl='
|
||||
'
|
||||
|
||||
@ -21,10 +17,13 @@ _wi_script() {
|
||||
function addevent() {
|
||||
var = arg[1] "s"
|
||||
for(i=2; i <= narg; i++) {
|
||||
printf "%s=\"$%s\n%s\"\n", var, var, arg[i]
|
||||
gsub("[^a-zA-Z_0-9]", "_", arg[i]);
|
||||
if(body != "") {
|
||||
printf "%s_%s() { %s\n }\n", arg[1], arg[i], body
|
||||
if(body == "")
|
||||
delete a[arg[1],arg[i]]
|
||||
else
|
||||
a[arg[1],arg[i]] = body
|
||||
if(i == 2) {
|
||||
# There's a bug here. Can you spot it?
|
||||
gsub("[^a-zA-Z_0-9]", "_", arg[2]);
|
||||
body = sprintf("%s_%s \"$@\"", arg[1], arg[2])
|
||||
}
|
||||
}
|
||||
@ -41,11 +40,31 @@ _wi_script() {
|
||||
|
||||
END {
|
||||
addevent()
|
||||
for(k in a) {
|
||||
split(k, b, SUBSEP)
|
||||
c[b[1]] = c[b[1]] b[2] "\n"
|
||||
gsub("[^a-zA-Z_0-9]", "_", b[2]);
|
||||
if(body != "")
|
||||
printf "%s_%s() { %s\n }\n", b[1], b[2], a[k]
|
||||
}
|
||||
for(k in c) {
|
||||
gsub("'", "'\"'\"'", c[k])
|
||||
printf "%ss='%s'\n", k, c[k]
|
||||
}
|
||||
}
|
||||
!
|
||||
}
|
||||
|
||||
_wi_text() {
|
||||
cat <<'!'
|
||||
Event Start
|
||||
if [ "$1" = "$wmiiscript" ]; then
|
||||
exit
|
||||
fi
|
||||
Event Key
|
||||
fn=$(echo "$@" | sed 's/[^a-zA-Z_0-9]/_/g')
|
||||
Key_$fn "$@"
|
||||
!
|
||||
eval "cat <<!
|
||||
$(sed "$_sed" | sed '/^[ ]/s/\([$`]\)/\\\1/g')
|
||||
"
|
||||
@ -57,6 +76,7 @@ wi_events() {
|
||||
_sed="s/^$2//"
|
||||
shift 2
|
||||
fi
|
||||
#cho "$(_wi_text | awk "$(_wi_script)")"
|
||||
eval "$(_wi_text | awk "$(_wi_script)")"
|
||||
}
|
||||
|
||||
@ -94,14 +114,21 @@ wi_proglist() {
|
||||
|
||||
wi_actions() {
|
||||
{ wi_proglist $WMII_CONFPATH
|
||||
wi_getfuns Action
|
||||
echo -n "$Actions"
|
||||
} | sort | uniq
|
||||
}
|
||||
|
||||
conf_which() {
|
||||
which=$(which which)
|
||||
prog=$(PATH="$WMII_CONFPATH" $which $1); shift
|
||||
[ -n "$prog" ] && $prog "$@"
|
||||
wi_runconf() {
|
||||
sflag=""; if [ "$1" = -s ]; then sflag=1; shift; fi
|
||||
which="$(which which)"
|
||||
prog=$(PATH="$WMII_CONFPATH" "$which" -- $1 2>/dev/null); shift
|
||||
if [ -n "$prog" ]; then
|
||||
if [ -z "$sflag" ]
|
||||
then "$prog" "$@"
|
||||
else . "$prog"
|
||||
fi
|
||||
else return 1
|
||||
fi
|
||||
}
|
||||
|
||||
wi_script() {
|
||||
@ -120,7 +147,7 @@ wi_runcmd() {
|
||||
shift
|
||||
set -- wihack -tags $(wmiir read /tag/sel/ctl | sed 1q) "$*"
|
||||
fi
|
||||
eval exec $* &
|
||||
eval exec "$*" &
|
||||
}
|
||||
|
||||
wi_tags() {
|
||||
@ -141,21 +168,11 @@ wi_eventloop() {
|
||||
done 2>/dev/null
|
||||
}
|
||||
|
||||
wi_events <<'!'
|
||||
Event Start
|
||||
if [ "$1" = "$wmiiscript" ]; then
|
||||
exit
|
||||
fi
|
||||
Event Key
|
||||
fn=$(echo "$@" | sed 's/[^a-zA-Z_0-9]/_/g')
|
||||
Key_$fn "$@"
|
||||
!
|
||||
|
||||
Action() {
|
||||
action=$1; shift
|
||||
if [ -n "$action" ]; then
|
||||
Action_$action "$@" \
|
||||
|| conf_which $action "$@"
|
||||
|| wi_runconf $action "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ path=$PLAN9/bin $path
|
||||
eps = wmii.eps
|
||||
|
||||
epsbox = `{sed -n '/^%%BoundingBox:/{s/.*://p; q;}' $eps}
|
||||
iconwidth = 32
|
||||
iconwidth = 154
|
||||
iconscale = `{*=$epsbox; hoc -e $iconwidth/'('$3-' '$1')'}
|
||||
iconheight = `{*=$epsbox; hoc -e '('$4-' '$2')*'$iconscale}
|
||||
|
||||
@ -12,7 +12,7 @@ iconheight = `{*=$epsbox; hoc -e '('$4-' '$2')*'$iconscale}
|
||||
* = `{hoc -e'-('$epsbox')'}
|
||||
x = $1
|
||||
y = $2
|
||||
gs -q -dBATCH -dNOPAUSE -sDEVICE=pngalpha -sOutputFile=$target -g$iconwidth'x'$iconheight - <<!
|
||||
gs -q -dBATCH -dNOPAUSE -s'DEVICE=pngalpha' -s'OutputFile='$target -g$iconwidth'x'$iconheight - <<!
|
||||
$iconscale $iconscale scale
|
||||
$x $y translate
|
||||
($eps) run
|
||||
@ -27,7 +27,7 @@ iconheight = `{*=$epsbox; hoc -e '('$4-' '$2')*'$iconscale}
|
||||
* = `{hoc -e'-('$epsbox')'}
|
||||
x = $1
|
||||
y = $2
|
||||
gs -q -dBATCH -dNOPAUSE -sDEVICE=pngalpha -sOutputFile=$target -g$iconwidth'x'$iconheight - <<!
|
||||
gs -q -dBATCH -dNOPAUSE -s'DEVICE=pngalpha' -s'OutputFile='$target -g$iconwidth'x'$iconheight - <<!
|
||||
$iconscale $iconscale scale
|
||||
$x $y translate
|
||||
($eps) run
|
||||
|
BIN
img/wmii.png
BIN
img/wmii.png
Binary file not shown.
Before Width: | Height: | Size: 515 B After Width: | Height: | Size: 1.0 KiB |
@ -206,7 +206,7 @@ key $MODKEY-Shift-c || fn $key {
|
||||
key $MODKEY-a || fn $key {
|
||||
Action `{wi_actions | wi_menu} &}
|
||||
key $MODKEY-p || fn $key {
|
||||
ifs=() { wi_runcmd -t `{wi_menu <$progs_file} & }}
|
||||
ifs=() { wi_runcmd `{wi_menu <$progs_file} & }}
|
||||
key $MODKEY-Return || fn $key {
|
||||
wi_runcmd $WMII_TERM &}
|
||||
|
||||
|
21
rc/wmiirc.sh
21
rc/wmiirc.sh
@ -22,8 +22,8 @@ WMII_BACKGROUND='#333333'
|
||||
WMII_FONT='-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*'
|
||||
|
||||
set -- $(echo $WMII_NORMCOLORS $WMII_FOCUSCOLORS)
|
||||
WMII_MENU='dmenu -b -fn "$WMII_FONT" -nf '"'$1' -nb '$2' -sf '$4' -sb '$5'"
|
||||
WMII_9MENU='wmii9menu -font "$WMII_FONT" -nf '"'$1' -nb '$2' -sf '$4' -sb '$5' -br '$6'"
|
||||
WMII_MENU="dmenu -b -fn '\$WMII_FONT' -nf '$1' -nb '$2' -sf '$4' -sb '$5'"
|
||||
WMII_9MENU="wmii9menu -font '\$WMII_FONT' -nf '$1' -nb '$2' -sf '$4' -sb '$5' -br '$6'"
|
||||
WMII_TERM="xterm"
|
||||
|
||||
# Column Rules
|
||||
@ -42,10 +42,13 @@ status() {
|
||||
echo -n $(uptime | sed 's/.*://; s/,//g') '|' $(date)
|
||||
}
|
||||
|
||||
wi_runconf -s wmiirc_local
|
||||
|
||||
echo $WMII_NORMCOLORS | wmiir create $noticebar
|
||||
|
||||
# Event processing
|
||||
wi_events -s ' ' <<'!'
|
||||
events="$(
|
||||
sed 's/^ //' <<'!'
|
||||
# Events
|
||||
Event CreateTag
|
||||
echo "$WMII_NORMCOLORS" "$@" | wmiir create "/lbar/$@"
|
||||
@ -162,13 +165,19 @@ wi_events -s ' ' <<'!'
|
||||
wmiir xwrite /tag/sel/ctl send sel up
|
||||
!
|
||||
for i in 0 1 2 3 4 5 6 7 8 9; do
|
||||
wi_events -s ' ' <<!
|
||||
sed 's/^ //' <<!
|
||||
Key $MODKEY-$i
|
||||
wmiir xwrite /ctl view "$i"
|
||||
Key $MODKEY-Shift-$i
|
||||
wmiir xwrite /client/sel/tags "$i"
|
||||
!
|
||||
done
|
||||
)"
|
||||
wi_events <<!
|
||||
$events
|
||||
$local_events
|
||||
!
|
||||
unset events local_events
|
||||
|
||||
# WM Configuration
|
||||
wmiir write /ctl <<!
|
||||
@ -190,10 +199,10 @@ Action status &
|
||||
wi_proglist $PATH >$progsfile &
|
||||
|
||||
# Setup Tag Bar
|
||||
OIFS="$IFS"; IFS="$wi_nl"
|
||||
IFS="$wi_nl"
|
||||
wmiir rm $(wmiir ls /lbar | sed 's,^,/lbar/,')
|
||||
seltag=$(wmiir read /tag/sel/ctl | sed 1q)
|
||||
IFS="$OIFS"
|
||||
unset IFS
|
||||
wi_tags | while read tag
|
||||
do
|
||||
if [ "$tag" = "$seltag" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user