mirror of
https://github.com/0intro/wmii
synced 2025-01-11 12:49:38 +03:00
Replaced OLDPATH; applied Armando Di Cian's permissions patch to startup script; minor changes elsewhere
This commit is contained in:
parent
01290a7bdd
commit
5af82396c4
72
cmd/wm/fs.c
72
cmd/wm/fs.c
@ -254,27 +254,35 @@ message_root(char *message)
|
||||
{
|
||||
unsigned int n;
|
||||
|
||||
if(!strncmp(message, "quit", 5)) {
|
||||
if(!strchr(message, ' ')) {
|
||||
snprintf(buf, BUF_SIZE, "%s ", message);
|
||||
message = buf;
|
||||
}
|
||||
|
||||
if(!strncmp(message, "quit ", 5))
|
||||
srv.running = 0;
|
||||
return nil;
|
||||
}if(!strncmp(message, "view ", 5)) {
|
||||
else if(!strncmp(message, "view ", 5))
|
||||
select_view(&message[5]);
|
||||
return nil;
|
||||
}if(!strncmp(message, "selcolors ", 10)) {
|
||||
else if(!strncmp(message, "selcolors ", 10)) {
|
||||
message += 10;
|
||||
n = strlen(message);
|
||||
return parse_colors(&message, &n, &def.selcolor);
|
||||
}if(!strncmp(message, "normcolors ", 11)) {
|
||||
}else if(!strncmp(message, "normcolors ", 11)) {
|
||||
message += 11;
|
||||
n = strlen(message);
|
||||
return parse_colors(&message, &n, &def.normcolor);
|
||||
}if(!strncmp(message, "font ", 5)) {
|
||||
}else if(!strncmp(message, "font ", 5)) {
|
||||
message += 5;
|
||||
free(def.font.fontstr);
|
||||
def.font.fontstr = strdup(message);
|
||||
blitz_loadfont(&blz, &def.font);
|
||||
return nil;
|
||||
}if(!strncmp(message, "grabmod ", 8)) {
|
||||
}else if(!strncmp(message, "border ", 7)) {
|
||||
message += 7;
|
||||
n = (unsigned int)strtol(message, &message, 10);
|
||||
if(*message)
|
||||
return Ebadvalue;
|
||||
def.border = n;
|
||||
}else if(!strncmp(message, "grabmod ", 8)) {
|
||||
message += 8;
|
||||
unsigned long mod;
|
||||
mod = mod_key_of_str(message);
|
||||
@ -284,22 +292,15 @@ message_root(char *message)
|
||||
def.mod = mod;
|
||||
if(view)
|
||||
restack_view(sel);
|
||||
return nil;
|
||||
}if(!strncmp(message, "border ", 7)) {
|
||||
message += 7;
|
||||
n = (unsigned int)strtol(message, &message, 10);
|
||||
if(*message)
|
||||
return Ebadvalue;
|
||||
def.border = n;
|
||||
return nil;
|
||||
}if(!strncmp(message, "testtags ", 9)) {
|
||||
}else if(!strncmp(message, "testtags ", 9)) {
|
||||
message += 9;
|
||||
free(def.testtags);
|
||||
def.testtags = strlen(message) ? strdup(message) : nil;
|
||||
draw_frames();
|
||||
return nil;
|
||||
}
|
||||
return Ebadcmd;
|
||||
}else
|
||||
return Ebadcmd;
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
char *
|
||||
@ -343,22 +344,21 @@ write_event(char *format, ...) {
|
||||
|
||||
va_start(ap, format);
|
||||
vsnprintf(buf, BUF_SIZE, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
if(!(len = strlen(buf)))
|
||||
goto end;
|
||||
return;
|
||||
for(f=pending_event_fids; f; f=f->next) {
|
||||
fi = f->fid->aux;
|
||||
slen = fi->buf ? strlen(fi->buf) : 0;
|
||||
fi->buf = realloc(fi->buf, slen + len + 1);
|
||||
fi->buf[slen] = '\0'; /* shut up valgrind */
|
||||
fi->buf[slen] = '\0';
|
||||
strcat(fi->buf, buf);
|
||||
}
|
||||
while((aux = pending_event_reads)) {
|
||||
pending_event_reads = pending_event_reads->aux;
|
||||
respond_event(aux);
|
||||
}
|
||||
end:
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -743,10 +743,7 @@ fs_write(P9Req *r) {
|
||||
return respond(r, nil);
|
||||
case FsFRctl:
|
||||
data_to_cstring(r);
|
||||
{
|
||||
/* I'm not happy with this error handling */
|
||||
/* or with the assumption that lines will come whole */
|
||||
unsigned int n;
|
||||
{ unsigned int n;
|
||||
char *toks[32];
|
||||
n = cext_tokenize(toks, 32, r->ifcall.data, '\n');
|
||||
for(i = 0; i < n; i++) {
|
||||
@ -755,21 +752,16 @@ fs_write(P9Req *r) {
|
||||
else
|
||||
errstr = message_root(toks[i]);
|
||||
}
|
||||
if(errstr)
|
||||
return respond(r, errstr);
|
||||
}
|
||||
if(errstr)
|
||||
return respond(r, errstr);
|
||||
r->ofcall.count = r->ifcall.count;
|
||||
return respond(r, nil);
|
||||
case FsFEvent:
|
||||
if(r->ifcall.data[r->ifcall.count-1] == '\n') {
|
||||
r->ifcall.data = realloc(r->ifcall.data, r->ifcall.count + 1);
|
||||
r->ifcall.data[r->ifcall.count] = '\0';
|
||||
}else{
|
||||
r->ifcall.data = realloc(r->ifcall.data, r->ifcall.count + 2);
|
||||
r->ifcall.data[r->ifcall.count] = '\n';
|
||||
r->ifcall.data[r->ifcall.count + 1] = '\0';
|
||||
}
|
||||
write_event("%s", (char *)r->ifcall.data);
|
||||
if(r->ifcall.data[r->ifcall.count-1] == '\n')
|
||||
write_event("%.*s", r->ifcall.count, r->ifcall.data);
|
||||
else
|
||||
write_event("%.*s\n", r->ifcall.count, r->ifcall.data);
|
||||
r->ofcall.count = r->ifcall.count;
|
||||
return respond(r, nil);
|
||||
}
|
||||
|
@ -64,8 +64,7 @@ update_rules(Rule **rule, const char *data)
|
||||
cext_strlcpy((*rule)->value, value, sizeof(rul->value));
|
||||
rule = &(*rule)->next;
|
||||
}
|
||||
else
|
||||
free(*rule);
|
||||
else free(*rule);
|
||||
mode = IGNORE;
|
||||
}
|
||||
else {
|
||||
|
@ -180,10 +180,11 @@ rects_of_view(View *v, unsigned int *num)
|
||||
|
||||
result = cext_emallocz(*num * sizeof(XRectangle));
|
||||
for(f=v->area->frame; f; f=f->anext)
|
||||
*(result++) = f->rect;
|
||||
*(result++) = rect;
|
||||
*(result++) = brect;
|
||||
return (result - *num);
|
||||
*result++ = f->rect;
|
||||
*result++ = rect;
|
||||
*result++ = brect;
|
||||
|
||||
return &result[-*num];
|
||||
}
|
||||
|
||||
void
|
||||
|
27
cmd/wm/wmii
27
cmd/wm/wmii
@ -3,13 +3,30 @@
|
||||
|
||||
wmiiwm -c || exit 1
|
||||
|
||||
OLD_PATH="$PATH" export OLD_PATH
|
||||
PATH="$HOME/.wmii-4:CONFPREFIX/wmii-4:$PATH" export PATH
|
||||
WMII_ADDRESS=unix!/tmp/ns.$USER.${DISPLAY%.0}/wmii export WMII_ADDRESS
|
||||
WMII_CONFPATH="$HOME/.wmii-4:CONFPREFIX/wmii-4" export WMII_CONFPATH
|
||||
WMII_NS_DIR="/tmp/ns.$USER.${DISPLAY%.0}"
|
||||
WMII_ADDRESS="unix!$WMII_NS_DIR/wmii" export WMII_ADDRESS
|
||||
|
||||
error() {
|
||||
echo "There was an error starting wmii."
|
||||
echo "$@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ -d "$WMII_NS_DIR" ]; then
|
||||
if [ -O "$WMII_NS_DIR" ]; then
|
||||
if ls -ld "$WMII_NS_DIR" | grep -v '^drwx------' >/dev/null 2>&1; then
|
||||
error "Your namespace directory ($WMII_NS_DIR) exists but is group or world readable or writable"
|
||||
fi
|
||||
else
|
||||
error "Your namespace directory ($WMII_NS_DIR) exists but is not owned by you."
|
||||
fi
|
||||
else
|
||||
mkdir -m 700 "$WMII_NS_DIR" || error "Your namespace directory ($WMII_NS_DIR) doesn't exist and I can't create it"
|
||||
fi
|
||||
|
||||
mkdir -m 700 /tmp/ns.$USER.${DISPLAY%.0} 2>/dev/null
|
||||
wmiiwm -a $WMII_ADDRESS &
|
||||
wmiiwmpid=$!
|
||||
mkdir $HOME/.wmii-4 2>/dev/null && welcome &
|
||||
wmiirc &
|
||||
`PATH="$CONFPATH:$PATH" which wmiirc` &
|
||||
wait $wmiiwmpid
|
||||
|
18
rc/wmiirc
18
rc/wmiirc
@ -7,7 +7,12 @@ xwrite() {
|
||||
}
|
||||
|
||||
proglist() {
|
||||
ls -lL "$@" 2>/dev/null | awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort -u
|
||||
ls -lL "$@" 2>/dev/null | awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort | uniq
|
||||
}
|
||||
|
||||
conf_which () {
|
||||
prog=$1; shift
|
||||
echo `PATH="$WMII_CONFPATH:$PATH" which $prog` $@
|
||||
}
|
||||
|
||||
MODKEY=Mod1
|
||||
@ -56,7 +61,7 @@ EOF
|
||||
|
||||
# MISC
|
||||
xsetroot -solid '#333333'
|
||||
status &
|
||||
`conf_which status` &
|
||||
PROGS_FILE=`mktemp /tmp/.wmiimenu.proglist.XXXXXX` || exit 2
|
||||
proglist `echo "$OLD_PATH" | tr : ' '` >$PROGS_FILE &
|
||||
|
||||
@ -115,11 +120,10 @@ done
|
||||
seltag=`wmiir read /tag/sel/ctl`
|
||||
for tag in `wmiir ls /tag | sed -e 's,/$,,; /^sel$/d'`
|
||||
do
|
||||
wmiir create /lbar/$tag
|
||||
if [ "X$tag" = "X$seltag" ]; then
|
||||
xwrite /lbar/$tag $WMII_SELCOLORS $tag
|
||||
echo $WMII_SELCOLORS $tag | wmiir create /lbar/$tag
|
||||
else
|
||||
xwrite /lbar/$tag $WMII_NORMCOLORS $tag
|
||||
echo $WMII_NORMCOLORS $tag | wmiir create /lbar/$tag
|
||||
fi
|
||||
done
|
||||
unset IFS
|
||||
@ -176,9 +180,9 @@ do
|
||||
$MODKEY-f)
|
||||
xwrite /tag/sel/0/sel/geom 0 0 0 0;;
|
||||
$MODKEY-a)
|
||||
`proglist $HOME/.wmii-4 CONFPREFIX/wmii-4 | wmiimenu` &;;
|
||||
`conf_which \`proglist $HOME/.wmii-4 CONFPREFIX/wmii-4 | wmiimenu\`` &;;
|
||||
$MODKEY-p)
|
||||
PATH="$OLD_PATH" wmiisetsid `wmiimenu <$PROGS_FILE` &;;
|
||||
wmiisetsid sh -c "`wmiimenu <$PROGS_FILE`" &;;
|
||||
$MODKEY-t)
|
||||
xwrite /ctl view "`wmiir ls /tag | sed 's,/,,; /^sel$/d' | wmiimenu`" &;;
|
||||
$MODKEY-[0-9])
|
||||
|
Loading…
Reference in New Issue
Block a user