diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-01-03 16:06:10 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-01-03 16:06:10 +0000 |
| commit | 105bd729e8341bacce630f2780f0a9a5a0102526 (patch) | |
| tree | 550cc98c50f53651522e96bc27d0b06414e1ca03 /src/openbox.cc | |
| parent | a4a8d09f4b9431d6d831cb7aa220e6c952802c95 (diff) | |
provide capabilities to execute a command
Diffstat (limited to 'src/openbox.cc')
| -rw-r--r-- | src/openbox.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/openbox.cc b/src/openbox.cc index 655fe0d5..4d2f1024 100644 --- a/src/openbox.cc +++ b/src/openbox.cc @@ -326,5 +326,26 @@ void Openbox::setFocusedClient(OBClient *c) } } +void Openbox::execute(int screen, const std::string &bin) +{ +#ifdef __EMX__ + // XXX: whats this for? windows? + spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", bin.c_str(), NULL); +#else // __EMX__ + if (screen >= ScreenCount(otk::OBDisplay::display)) + screen = 0; + const std::string &dstr = + otk::OBDisplay::screenInfo(screen)->displayString(); + + if (! fork()) { + setsid(); + int ret = putenv(const_cast<char *>(dstr.c_str())); + assert(ret != -1); + ret = execl("/bin/sh", "/bin/sh", "-c", bin.c_str(), NULL); + exit(ret); + } +#endif // __EMX__ +} + } |
