X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=util%2Fepist%2Fepist.cc;h=74a11d1a4d92bef98a46ab251d4274965bf74a70;hb=eb19a6b69e89c6adae1b99705b0a26edc344c87a;hp=f83059435edc458c8cd7edaf4c675cf7c3e71064;hpb=41a38bbdaf245f12e58f2609092bfbcf8fba6f78;p=chaz%2Fopenbox diff --git a/util/epist/epist.cc b/util/epist/epist.cc index f8305943..74a11d1a 100644 --- a/util/epist/epist.cc +++ b/util/epist/epist.cc @@ -1,4 +1,4 @@ -// -*- mode: C++; indent-tabs-mode: nil; -*- +// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- // epist.cc for Epistrophy - a key handler for NETWM/EWMH window managers. // Copyright (c) 2002 - 2002 Ben Jansens // @@ -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 @@ -55,7 +65,7 @@ using std::string; #include "screen.hh" #include "window.hh" #include "parser.hh" -#include "../../src/XAtom.hh" +#include "../../src/xatom.hh" epist::epist(char **argv, char *dpy_name, char *rc_file) @@ -66,11 +76,22 @@ 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"); - _xatom = new XAtom(getXDisplay()); + struct stat buf; + if (0 != stat(_rc_file.c_str(), &buf) || + !S_ISREG(buf.st_mode)) + _rc_file = DEFAULTRC; + _xatom = new XAtom(getXDisplay()); _active = _clients.end(); + + _config = new Config; + _ktree = new keytree(getXDisplay(), this); + + // set up the key tree + parser p(_ktree, _config); + p.parse(_rc_file); for (unsigned int i = 0; i < getNumberOfScreens(); ++i) { screen *s = new screen(this, i); @@ -84,12 +105,6 @@ epist::epist(char **argv, char *dpy_name, char *rc_file) ::exit(1); } - _ktree = new keytree(getXDisplay()); - - // set up the key tree - parser p(_ktree); - p.parse(_rc_file); - activateGrabs(); } @@ -109,12 +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); + string base(basename(_argv[0])); execvp(base.c_str(), _argv); + return false; // this should be unreachable + } case SIGTERM: case SIGINT: