From 3c7d0f49deb43f079d40dabb64e49f4fd1bb5dc1 Mon Sep 17 00:00:00 2001 From: Carl Klemm Date: Thu, 4 Jun 2020 18:54:03 +0200 Subject: [PATCH] Avoid getting stuck when swtiching from one window to another with the same PID --- main.cpp | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/main.cpp b/main.cpp index 1a8e2db..4c5fd25 100644 --- a/main.cpp +++ b/main.cpp @@ -94,7 +94,7 @@ public: atoms.wmClientMachine = getAtom("WM_CLIENT_MACHINE"); if(atoms.netActiveWindow == 0) { - std::cerr<<"WM_CLIENT_MACHINE is required\n"; + std::cerr<<" is required\n"; return false; } @@ -177,6 +177,10 @@ public: { return pid == in.pid; } + bool operator!=(const Process& in) + { + return pid != in.pid; + } Process(){} Process(pid_t pidIn) { @@ -266,17 +270,20 @@ int main(int argc, char* argv[]) pid_t windowPid = xinstance.getPid(wid); Process process(windowPid); - for(size_t i = 0; i < applicationNames.size(); ++i) + if(process != prevProcess) { - if(process.name == applicationNames[i] && process.name != "" && wid != 0) + for(size_t i = 0; i < applicationNames.size(); ++i) { - kill(process.pid, SIGCONT); - std::cout<<"Resumeing: "<