X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=util%2Fepist%2Fepist.cc;h=a5b829b0063bb29133aa9ceea8df067831aa2455;hb=551a17d2563679eb6ef7c650f1384ee7e48dbc29;hp=410656d60b53a74775021cac7120ea5272ab9230;hpb=5b088be950ce6e6a496b573e81dabeb54bd740ef;p=chaz%2Fopenbox diff --git a/util/epist/epist.cc b/util/epist/epist.cc index 410656d6..a5b829b0 100644 --- a/util/epist/epist.cc +++ b/util/epist/epist.cc @@ -41,6 +41,16 @@ extern "C" { #ifdef HAVE_LIBGEN_H # include #endif // HAVE_LIBGEN_H + +#ifdef HAVE_UNISTD_H +# include +# include +#endif // HAVE_UNISTD_H + +#ifdef HAVE_SYS_STAT_H +# include +# include +#endif // HAVE_SYS_STAT_H } #include @@ -66,7 +76,12 @@ epist::epist(char **argv, char *dpy_name, char *rc_file) if (rc_file) _rc_file = rc_file; else - _rc_file = expandTilde("~/.epistrc"); + _rc_file = expandTilde("~/.openbox/epistrc"); + + struct stat buf; + if (0 != stat(_rc_file.c_str(), &buf) || + !S_ISREG(buf.st_mode)) + _rc_file = DEFAULTRC; _xatom = new XAtom(getXDisplay()); @@ -109,11 +124,16 @@ void epist::activateGrabs() { bool epist::handleSignal(int sig) { switch (sig) { - case SIGHUP: + case SIGHUP: { cout << "epist: Restarting on request.\n"; + execvp(_argv[0], _argv); - execvp(basename(_argv[0]), _argv); + + string base(basename(_argv[0])); + execvp(base.c_str(), _argv); + return false; // this should be unreachable + } case SIGTERM: case SIGINT: