Example #1
0
void KwmExecuteInitScript()
{
    std::string InitFile = KWMPath.EnvHome + "/" + KWMPath.ConfigFolder + "/init";

    struct stat Buffer;
    if(stat(InitFile.c_str(), &Buffer) == 0)
        KwmExecuteThreadedSystemCommand(InitFile);
}
Example #2
0
File: keys.cpp Project: JakimLi/kwm
internal void
KwmExecuteHotkey(hotkey *Hotkey)
{
    if(Hotkey->Command.empty())
        return;

    std::vector<std::string> Commands = SplitString(Hotkey->Command, ';');
    DEBUG("KwmExecuteHotkey: Number of commands " << Commands.size());
    for(int CmdIndex = 0; CmdIndex < Commands.size(); ++CmdIndex)
    {
        std::string &Command = TrimString(Commands[CmdIndex]);
        if(!Command.empty())
        {
            DEBUG("KwmExecuteHotkey() " << Command);
            if(IsPrefixOfString(Command, "exec"))
                KwmExecuteThreadedSystemCommand(Command);
            else
                KwmInterpretCommand(Command, 0);

            if(KWMHotkeys.ActiveMode->Prefix)
                KWMHotkeys.ActiveMode->Time = std::chrono::steady_clock::now();
        }
    }
}