// -*- mode: C++; indent-tabs-mode: nil; -*-
-// epist.cc for Epistophy - a key handler for NETWM/EWMH window managers.
+// epist.cc for Epistrophy - a key handler for NETWM/EWMH window managers.
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
//
// Permission is hereby granted, free of charge, to any person obtaining a
#ifdef HAVE_LIBGEN_H
# include <libgen.h>
#endif // HAVE_LIBGEN_H
+
+#ifdef HAVE_UNISTD_H
+# include <sys/types.h>
+# include <unistd.h>
+#endif // HAVE_UNISTD_H
+
+#ifdef HAVE_SYS_STAT_H
+# include <sys/types.h>
+# include <sys/stat.h>
+#endif // HAVE_SYS_STAT_H
}
#include <iostream>
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());
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: