mirror of
https://github.com/0intro/wmii
synced 2024-11-25 07:09:38 +03:00
Sorry, I lost track. See diff.
This commit is contained in:
parent
d951419167
commit
f55337ef2b
2
TODO
2
TODO
@ -5,6 +5,6 @@ BUGS
|
||||
|
||||
4.0
|
||||
* Opaque managed moves. I know I've argued against it, but it may be doable.
|
||||
* Resizable managed area
|
||||
* Resizable managed area. Maybe. Struts seem to do everything this might.
|
||||
* New dmenu, with real cursor; snarfable.
|
||||
|
||||
|
@ -18,6 +18,7 @@ FILTER = sed "s|CONFPREFIX|$(ETC)|g; \
|
||||
s|CONFVERSION|$(CONFVERSION)|g; \
|
||||
s|P9PATHS|$(P9PATHS)|g; \
|
||||
s|LIBDIR|$(LIBDIR)|g; \
|
||||
s|BINSH|$(BINSH)|g; \
|
||||
s|AWKPATH|$(AWKPATH)|g"
|
||||
|
||||
LDFLAGS += -lfmt -lutf
|
||||
|
@ -14,6 +14,10 @@ _wi_script() {
|
||||
narg = 1;
|
||||
body = "";
|
||||
}
|
||||
function quote(s) {
|
||||
gsub(/"'"/, "'\\''", s)
|
||||
return "'" s "'"
|
||||
}
|
||||
function addevent() {
|
||||
var = arg[1] "s"
|
||||
for(i=2; i <= narg; i++) {
|
||||
@ -24,11 +28,11 @@ _wi_script() {
|
||||
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])
|
||||
body = sprintf("%s %s \"$@\"", arg[1], arg[2])
|
||||
}
|
||||
}
|
||||
}
|
||||
/^(Event|Key|Action)[ \t]/ {
|
||||
/^(Event|Key|Action|Menu)[ \t]/ {
|
||||
addevent()
|
||||
split($0, arg)
|
||||
narg = NF
|
||||
@ -43,13 +47,16 @@ _wi_script() {
|
||||
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]
|
||||
d[b[1]] = d[b[1]] quote(b[2]) ")" a[k] ";;\n"
|
||||
}
|
||||
for(k in c) {
|
||||
gsub("'", "'\"'\"'", c[k])
|
||||
printf "%ss='%s'\n", k, c[k]
|
||||
for(k in c)
|
||||
printf "%ss=%s\n", k, quote(c[k])
|
||||
for(k in d) {
|
||||
printf "%s() {\n", k
|
||||
printf " %s=$1; shift\n", tolower(k)
|
||||
printf "case $%s in\n%s\nesac\n", tolower(k), d[k]
|
||||
printf "}\n"
|
||||
}
|
||||
}
|
||||
!
|
||||
@ -62,8 +69,7 @@ Event Start
|
||||
exit
|
||||
fi
|
||||
Event Key
|
||||
fn=$(echo "$@" | sed 's/[^a-zA-Z_0-9]/_/g')
|
||||
Key_$fn "$@"
|
||||
Key "$@"
|
||||
!
|
||||
eval "cat <<!
|
||||
$(sed "$_sed" | sed '/^[ ]/s/\([$`]\)/\\\1/g')
|
||||
@ -76,6 +82,7 @@ wi_events() {
|
||||
_sed="s/^$2//"
|
||||
shift 2
|
||||
fi
|
||||
#cho "$(_wi_text | awk "$(_wi_script)")" | cat -n
|
||||
eval "$(_wi_text | awk "$(_wi_script)")"
|
||||
}
|
||||
|
||||
@ -105,6 +112,19 @@ wi_9menu() {
|
||||
wi_9menu "$@"
|
||||
}
|
||||
|
||||
wi_fnmenu() {
|
||||
group="$1-$2"; shift 2
|
||||
_last="$(echo $group|tr - _)_last"
|
||||
eval "last=\"\$$_last\""
|
||||
res=$(set -- $(echo "$Menus" | awk -v "s=$group" 'BEGIN{n=length(s)}
|
||||
substr($1,1,n) == s{print substr($1,n+2)}')
|
||||
[ $# != 0 ] && wi_9menu -initial "$last" "$@")
|
||||
if [ -n "$res" ]; then
|
||||
eval "$_last="'"$res"'
|
||||
Menu $group-$res "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
wi_proglist() {
|
||||
ls -lL $(echo $* | sed 'y/:/ /') 2>/dev/null \
|
||||
| awk '$1 ~ /^[^d].*x/ { print $NF }' \
|
||||
@ -153,24 +173,29 @@ wi_tags() {
|
||||
wmiir ls /tag | sed 's,/,,; /^sel$/d'
|
||||
}
|
||||
|
||||
wi_seltag() {
|
||||
wmiir read /tag/sel/ctl | sed 1q | tr -d '\012'
|
||||
}
|
||||
|
||||
wi_eventloop() {
|
||||
echo "$Keys" | wmiir write /keys
|
||||
|
||||
wmiir read /event | while read wi_event
|
||||
do
|
||||
OIFS="$IFS"; IFS="$wi_nl"
|
||||
IFS="$wi_nl"
|
||||
wi_arg=$(echo "$wi_event" | sed 's/^[^ ]* //')
|
||||
IFS="$OIFS"
|
||||
unset IFS
|
||||
set -- $wi_event
|
||||
event=$1; shift
|
||||
Event_$event $@
|
||||
done 2>/dev/null
|
||||
Event $event "$@"
|
||||
done
|
||||
}
|
||||
|
||||
Action() {
|
||||
action() {
|
||||
action=$1; shift
|
||||
if [ -n "$action" ]; then
|
||||
Action_$action "$@" \
|
||||
set +x
|
||||
Action $action "$@" \
|
||||
|| wi_runconf $action "$@"
|
||||
fi
|
||||
}
|
||||
|
@ -369,8 +369,11 @@ comp_frame(const void *a, const void *b) {
|
||||
return ia < ib ? -1 :
|
||||
ia > ib ? 1 :
|
||||
/* Favor the selected client. */
|
||||
/* No... don't. Windows shouldn't jump when the mouse
|
||||
* enters them.
|
||||
fa == fa->area->sel ? -1 :
|
||||
fb == fa->area->sel ? 1 :
|
||||
*/
|
||||
0;
|
||||
}
|
||||
|
||||
@ -488,6 +491,8 @@ column_arrange(Area *a, bool dirty) {
|
||||
}
|
||||
column_scale(a);
|
||||
resize:
|
||||
/* XXX */
|
||||
if(a->sel->collapsed)
|
||||
area_setsel(a, a->sel);
|
||||
if(v == screen->sel) {
|
||||
//view_restack(v);
|
||||
|
@ -568,7 +568,7 @@ move_focus(Frame *old_f, Frame *f) {
|
||||
|
||||
void
|
||||
frame_focus(Frame *f) {
|
||||
Frame *old_f;
|
||||
Frame *old_f, *ff;
|
||||
View *v;
|
||||
Area *a, *old_a;
|
||||
|
||||
@ -576,10 +576,20 @@ frame_focus(Frame *f) {
|
||||
a = f->area;
|
||||
old_a = v->sel;
|
||||
|
||||
if(0 && f->collapsed) {
|
||||
for(ff=f; ff->collapsed && ff->anext; ff=ff->anext)
|
||||
;
|
||||
for(; ff->collapsed && ff->aprev; ff=ff->aprev)
|
||||
;
|
||||
/* XXX */
|
||||
f->colr.max.y = f->colr.min.y + Dy(ff->colr);
|
||||
ff->colr.max.y = ff->colr.min.y + labelh(def.font);
|
||||
}else {
|
||||
for(; f->collapsed && f->anext; f=f->anext)
|
||||
;
|
||||
for(; f->collapsed && f->aprev; f=f->aprev)
|
||||
;
|
||||
}
|
||||
|
||||
old_f = old_a->sel;
|
||||
a->sel = f;
|
||||
@ -595,7 +605,9 @@ frame_focus(Frame *f) {
|
||||
move_focus(old_f, f);
|
||||
client_focus(f->client);
|
||||
|
||||
/*
|
||||
if(!a->floating && ((a->mode == Colstack) || (a->mode == Colmax)))
|
||||
*/
|
||||
column_arrange(a, false);
|
||||
}
|
||||
|
||||
|
@ -220,6 +220,8 @@ view_update(View *v) {
|
||||
|
||||
if(v != screen->sel)
|
||||
return;
|
||||
if(starting)
|
||||
return;
|
||||
|
||||
frames_update_sel(v);
|
||||
view_arrange(v);
|
||||
@ -313,6 +315,7 @@ view_attach(View *v, Frame *f) {
|
||||
|
||||
if(c->sel == nil)
|
||||
c->sel = f;
|
||||
view_update(v);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh -f
|
||||
#!BINSH -f
|
||||
# start wmiirc
|
||||
|
||||
export home="$HOME"
|
||||
|
@ -28,6 +28,10 @@ AR = ar crs
|
||||
|
||||
AWKPATH = $$(which awk)
|
||||
P9PATHS = ${PLAN9}:"'$${HOME}/plan9'":/usr/local/plan9:/usr/local/9:/opt/plan9:/opt/9:/usr/plan9:/usr/9
|
||||
# Your make shell. By default, the first found of /bin/dash, /bin/ksh,
|
||||
# /bin/sh. Except with bsdmake, which assumes /bin/sh is sane. bash and zsh
|
||||
# are painfully slow, and should be avoided.
|
||||
#BINSH = /bin/ash
|
||||
|
||||
INCX11 = -I/usr/X11R6/include
|
||||
LIBX11 = -L/usr/X11R6/lib -lX11
|
||||
|
@ -14,6 +14,14 @@ MKCFGSH=if test -f $(ROOT)/config.local.mk; then echo $(ROOT)/config.local.mk; e
|
||||
MKCFG:=${shell $(MKCFGSH)}
|
||||
MKCFG!=${MKCFGSH}
|
||||
include $(MKCFG)
|
||||
# and this:
|
||||
# Try to find a sane shell. /bin/sh is a last resort, because it's
|
||||
# usually bash on Linux, which means, it's painfully slow.
|
||||
BINSH := $(shell \
|
||||
if [ -x /bin/dash ]; then echo /bin/dash; \
|
||||
elif [ -x /bin/ksh ]; then echo /bin/ksh; \
|
||||
else echo /bin/sh; fi)
|
||||
BINSH != echo /bin/sh
|
||||
|
||||
.SILENT:
|
||||
.SUFFIXES: .O .o .o_pic .c .sh .rc .$(SOEXT) .awk .1 .man1 .depend .install .uninstall .clean
|
||||
|
@ -10,6 +10,7 @@ TARG = rc.wmii \
|
||||
FILTER = sed "s|CONFPREFIX|${ETC}|g; \
|
||||
s|CONFVERSION|${CONFVERSION}|g; \
|
||||
s|P9PATHS|${P9PATHS}|g; \
|
||||
s|BINSH|$(BINSH)|g; \
|
||||
s|AWKPATH|${AWKPATH}|g"
|
||||
|
||||
include ${ROOT}/mk/many.mk
|
||||
|
41
rc/wmiirc.sh
41
rc/wmiirc.sh
@ -1,4 +1,4 @@
|
||||
#!/bin/sh -f
|
||||
#!BINSH -f
|
||||
# Configure wmii
|
||||
wmiiscript=wmiirc # For wmii.sh
|
||||
. wmii.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
|
||||
@ -47,7 +47,7 @@ wi_runconf -s wmiirc_local
|
||||
echo $WMII_NORMCOLORS | wmiir create $noticebar
|
||||
|
||||
# Event processing
|
||||
events="$(
|
||||
events() {
|
||||
sed 's/^ //' <<'!'
|
||||
# Events
|
||||
Event CreateTag
|
||||
@ -97,6 +97,31 @@ events="$(
|
||||
kill $xpid 2>/dev/null # Let's hope this isn't reused...
|
||||
{ sleep $noticetimeout; wmiir xwrite $noticebar ' '; }&
|
||||
xpid = $!
|
||||
Menu Client-3-Delete
|
||||
wmiir xwrite /client/$1/ctl kill
|
||||
Menu Client-3-Fullscreen {
|
||||
wmiir xwrite /client/$1/ctl Fullscreen on
|
||||
Event ClientMouseDown
|
||||
wi_fnmenu Client $2 $1 &
|
||||
Menu LBar-3-Delete
|
||||
tag=$1; clients=$(wmiir read "/tag/$tag/index" | awk '/[^#]/{print $2}')
|
||||
for c in $clients; do
|
||||
if [ "$tag" = "$(wmiir read /client/$c/tags)" ]; then
|
||||
wmiir xwrite /client/$c/ctl kill
|
||||
else
|
||||
wmiir xwrite /client/$c/tags -$tag
|
||||
fi
|
||||
if [ "$tag" = "$(wi_seltag)" ]; then
|
||||
newtag=$(wi_tags | awk -v't='$tag '
|
||||
$1 == t { if(!l) getline l
|
||||
print l
|
||||
exit }
|
||||
{ l = $0 }')
|
||||
wmiir xwrite /ctl view $newtag
|
||||
fi
|
||||
done
|
||||
Event LeftBarMouseDown
|
||||
wi_fnmenu LBar "$@" &
|
||||
# Actions
|
||||
Action quit
|
||||
wmiir xwrite /ctl quit
|
||||
@ -138,7 +163,7 @@ events="$(
|
||||
Key $MODKEY-t
|
||||
wmiir xwrite /ctl view $(wi_tags | wi_menu) &
|
||||
Key $MODKEY-Return
|
||||
eval $WMII_TERM &
|
||||
eval wmiir setsid $WMII_TERM &
|
||||
Key $MODKEY-Shift-space
|
||||
wmiir xwrite /tag/sel/ctl send sel toggle
|
||||
Key $MODKEY-f
|
||||
@ -172,9 +197,9 @@ events="$(
|
||||
wmiir xwrite /client/sel/tags "$i"
|
||||
!
|
||||
done
|
||||
)"
|
||||
}
|
||||
wi_events <<!
|
||||
$events
|
||||
$(events)
|
||||
$local_events
|
||||
!
|
||||
unset events local_events
|
||||
@ -195,7 +220,7 @@ export WMII_FOCUSCOLORS WMII_SELCOLORS WMII_NORMCOLORS
|
||||
|
||||
# Misc
|
||||
progsfile="$(wmiir namespace)/.proglist"
|
||||
Action status &
|
||||
action status &
|
||||
wi_proglist $PATH >$progsfile &
|
||||
|
||||
# Setup Tag Bar
|
||||
|
Loading…
Reference in New Issue
Block a user