Example #1
0
void Kernel::selectMonitor(string displayString) {

    for (LMonitor::iterator it = monitors_->begin();
            it != monitors_->end(); it++)
    {
        Monitor *monitor = *it;
        if (monitor->displayString() == displayString) {
            if (monitors_->focused() != monitor) {
                XCORE->warpPointer(monitor->rootWindow(),
                                   monitor->width() / 2,
                                   monitor->height() / 2);
                monitors_->focus(monitor);
                Workspace *ws = monitor->focused();
                ws->focus(ws->topClient());
            }
            return;
        }
    }
}
Example #2
0
void Launcher::exec(string command) {

    Monitor *focusedMonitor = Kernel::instance()->focusedMonitor();

    if (fork() == 0) {
        if (fork() == 0) {
            setsid();

            close(ConnectionNumber(Kernel::instance()->display()));

            putenv((char *)focusedMonitor->displayString().c_str());

            char **cmdArgs = Util::arguments(command);

            LOGDEBUG("executing '" + command + "'");
            execvp(cmdArgs[0], cmdArgs);
            LOGERROR("cannot execute '" + command + "'", true);
            // exits NCWM
        }
        exit(0);
    }
    wait(0);
}