mirror of https://github.com/0intro/wmii
Update selection and execution of wmiirc.
This commit is contained in:
parent
e1e6794aca
commit
79ad0dd568
1
Makefile
1
Makefile
|
@ -5,6 +5,7 @@ PDIRS = \
|
||||||
cmd \
|
cmd \
|
||||||
libwmii_hack \
|
libwmii_hack \
|
||||||
rc \
|
rc \
|
||||||
|
alternative_wmiircs \
|
||||||
man
|
man
|
||||||
|
|
||||||
DIRS = \
|
DIRS = \
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
ROOT=..
|
||||||
|
include $(ROOT)/mk/hdr.mk
|
||||||
|
include $(ROOT)/mk/wmii.mk
|
||||||
|
|
||||||
|
BIN = $(ETC)/wmii$(CONFVERSION)
|
||||||
|
TARG = python \
|
||||||
|
plan9port
|
||||||
|
|
||||||
|
$(TARG:%=%.install):
|
||||||
|
echo INSTALL $$($(CLEANNAME) $(BASE)${@:.install=})
|
||||||
|
cp -r ${@:.install=} $(DESTDIR)$(BIN)
|
||||||
|
$(TARG:%=%.uninstall):
|
||||||
|
echo UNINSTALL $$($(CLEANNAME) $(BASE)${@:.uninstall=})
|
||||||
|
rm -rf $(DESTDIR)$(BIN)/${@:.uninstall=}
|
||||||
|
|
||||||
|
.PHONY: $(TARG:%=%.install) $(TARG:%=%.uninstall)
|
||||||
|
|
||||||
|
install: $(TARG:%=%.install)
|
||||||
|
uninstall: $(TARG:%=%.uninstall)
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
import os, sys
|
||||||
|
for p in os.environ.get("WMII_CONFPATH", "").split(':'):
|
||||||
|
sys.path += [p, p + '/python']
|
||||||
|
|
||||||
import pygmi
|
import pygmi
|
||||||
import wmiirc
|
import wmiirc
|
||||||
|
|
|
@ -11,8 +11,7 @@ TARG = wihack \
|
||||||
wmii.sh \
|
wmii.sh \
|
||||||
wmii9menu \
|
wmii9menu \
|
||||||
wmii9rc \
|
wmii9rc \
|
||||||
wmiir \
|
wmiir
|
||||||
wmiistartrc
|
|
||||||
|
|
||||||
OFILES = util.o
|
OFILES = util.o
|
||||||
|
|
||||||
|
|
|
@ -317,6 +317,31 @@ strlcatprint(char *buf, int len, const char *fmt, ...) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char*
|
||||||
|
pathsearch(const char *path, const char *file, bool slashok) {
|
||||||
|
char *orig, *p, *s;
|
||||||
|
|
||||||
|
if(!slashok && strchr(file, '/') > file)
|
||||||
|
file = sxprint("%s/%s", getcwd(buffer, sizeof buffer), file);
|
||||||
|
else if(!strncmp(file, "./", 2))
|
||||||
|
file = sxprint("%s/%s", getcwd(buffer, sizeof buffer), file+2);
|
||||||
|
if(file[0] == '/') {
|
||||||
|
if(access(file, X_OK))
|
||||||
|
return strdup(file);
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
orig = estrdup(path ? path : getenv("PATH"));
|
||||||
|
for(p=orig; (s=strtok(p, ":")); p=nil) {
|
||||||
|
s = smprint("%s/%s", s, file);
|
||||||
|
if(!access(s, X_OK))
|
||||||
|
break;
|
||||||
|
free(s);
|
||||||
|
}
|
||||||
|
free(orig);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
unquote(char *buf, char *toks[], int ntoks) {
|
unquote(char *buf, char *toks[], int ntoks) {
|
||||||
char *s, *t;
|
char *s, *t;
|
||||||
|
|
|
@ -206,6 +206,7 @@ void update_keys(void);
|
||||||
|
|
||||||
/* main.c */
|
/* main.c */
|
||||||
void init_screens(void);
|
void init_screens(void);
|
||||||
|
void spawn_command(const char*);
|
||||||
|
|
||||||
/* map.c */
|
/* map.c */
|
||||||
void** hash_get(Map*, const char*, bool create);
|
void** hash_get(Map*, const char*, bool create);
|
||||||
|
@ -291,6 +292,7 @@ char** comm(int, char**, char**);
|
||||||
int doublefork(void);
|
int doublefork(void);
|
||||||
void grep(char**, Reprog*, int);
|
void grep(char**, Reprog*, int);
|
||||||
char* join(char**, char*);
|
char* join(char**, char*);
|
||||||
|
char* pathsearch(const char*, const char*, bool);
|
||||||
void refree(Regex*);
|
void refree(Regex*);
|
||||||
void reinit(Regex*, char*);
|
void reinit(Regex*, char*);
|
||||||
int strlcatprint(char*, int, const char*, ...);
|
int strlcatprint(char*, int, const char*, ...);
|
||||||
|
|
|
@ -95,6 +95,9 @@ init_environment(void) {
|
||||||
setenv("WMII_ADDRESS", address, true);
|
setenv("WMII_ADDRESS", address, true);
|
||||||
else
|
else
|
||||||
address = smprint("unix!%s/wmii", ns_path);
|
address = smprint("unix!%s/wmii", ns_path);
|
||||||
|
setenv("WMII_CONFPATH", sxprint("%s/.wmii%s:%s/wmii%s",
|
||||||
|
getenv("HOME"), CONFVERSION,
|
||||||
|
CONFPREFIX, CONFVERSION), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -281,18 +284,21 @@ init_traps(void) {
|
||||||
sigaction(SIGUSR2, &sa, nil);
|
sigaction(SIGUSR2, &sa, nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
spawn_command(const char *cmd) {
|
spawn_command(const char *cmd) {
|
||||||
char *shell, *p;
|
char *shell, *p;
|
||||||
|
|
||||||
|
if((p = pathsearch(getenv("WMII_CONFPATH"), cmd, true)))
|
||||||
|
cmd = p;
|
||||||
|
|
||||||
if(doublefork() == 0) {
|
if(doublefork() == 0) {
|
||||||
if(setsid() == -1)
|
if(setsid() == -1)
|
||||||
fatal("Can't setsid: %r");
|
fatal("Can't setsid: %r");
|
||||||
|
|
||||||
|
/* Run through the user's shell as a login shell */
|
||||||
shell = passwd->pw_shell;
|
shell = passwd->pw_shell;
|
||||||
if(shell[0] != '/')
|
if(shell[0] != '/')
|
||||||
fatal("Shell is not an absolute path: %s", shell);
|
fatal("Shell is not an absolute path: %s", shell);
|
||||||
/* Run through the user's shell as a login shell */
|
|
||||||
p = smprint("-%s", strrchr(shell, '/') + 1);
|
p = smprint("-%s", strrchr(shell, '/') + 1);
|
||||||
|
|
||||||
close(0);
|
close(0);
|
||||||
|
@ -300,7 +306,7 @@ spawn_command(const char *cmd) {
|
||||||
|
|
||||||
execl(shell, p, "-c", cmd, nil);
|
execl(shell, p, "-c", cmd, nil);
|
||||||
fatal("Can't exec '%s': %r", cmd);
|
fatal("Can't exec '%s': %r", cmd);
|
||||||
/* Not reached */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,7 +338,7 @@ main(int argc, char *argv[]) {
|
||||||
extern int fmtevent(Fmt*);
|
extern int fmtevent(Fmt*);
|
||||||
fmtinstall('E', fmtevent);
|
fmtinstall('E', fmtevent);
|
||||||
|
|
||||||
wmiirc = "wmiistartrc";
|
wmiirc = "wmiirc";
|
||||||
|
|
||||||
oargv = argv;
|
oargv = argv;
|
||||||
ARGBEGIN{
|
ARGBEGIN{
|
||||||
|
@ -380,7 +386,7 @@ extern int fmtevent(Fmt*);
|
||||||
closeexec(ConnectionNumber(display));
|
closeexec(ConnectionNumber(display));
|
||||||
closeexec(sock);
|
closeexec(sock);
|
||||||
|
|
||||||
if(wmiirc)
|
if(wmiirc[0])
|
||||||
spawn_command(wmiirc);
|
spawn_command(wmiirc);
|
||||||
|
|
||||||
init_traps();
|
init_traps();
|
||||||
|
|
|
@ -50,6 +50,7 @@ enum {
|
||||||
LSELECT,
|
LSELECT,
|
||||||
LSEND,
|
LSEND,
|
||||||
LSLAY,
|
LSLAY,
|
||||||
|
LSPAWN,
|
||||||
LSWAP,
|
LSWAP,
|
||||||
LTOGGLE,
|
LTOGGLE,
|
||||||
LUP,
|
LUP,
|
||||||
|
@ -83,6 +84,7 @@ char *symtab[] = {
|
||||||
"select",
|
"select",
|
||||||
"send",
|
"send",
|
||||||
"slay",
|
"slay",
|
||||||
|
"spawn",
|
||||||
"swap",
|
"swap",
|
||||||
"toggle",
|
"toggle",
|
||||||
"up",
|
"up",
|
||||||
|
@ -502,6 +504,9 @@ message_root(void *p, IxpMsg *m) {
|
||||||
execstr = strdup(m->pos);
|
execstr = strdup(m->pos);
|
||||||
srv.running = 0;
|
srv.running = 0;
|
||||||
break;
|
break;
|
||||||
|
case LSPAWN:
|
||||||
|
spawn_command(m->pos);
|
||||||
|
break;
|
||||||
case LFOCUSCOLORS:
|
case LFOCUSCOLORS:
|
||||||
ret = msg_parsecolors(m, &def.focuscolor);
|
ret = msg_parsecolors(m, &def.focuscolor);
|
||||||
view_update(selview);
|
view_update(selview);
|
||||||
|
|
Loading…
Reference in New Issue