Merge pull request #2938 from thejch/click-special

This commit is contained in:
Alexis Rouillard 2024-02-20 08:03:16 +01:00 committed by GitHub
commit 197bc6a877
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 12 deletions

View File

@ -1001,19 +1001,21 @@ std::string &Workspace::selectIcon(std::map<std::string, std::string> &icons_map
} }
bool Workspace::handleClicked(GdkEventButton *bt) const { bool Workspace::handleClicked(GdkEventButton *bt) const {
try { if (bt->type == GDK_BUTTON_PRESS) {
if (id() > 0) { // normal try {
gIPC->getSocket1Reply("dispatch workspace " + std::to_string(id())); if (id() > 0) { // normal
} else if (!isSpecial()) { // named (this includes persistent) gIPC->getSocket1Reply("dispatch workspace " + std::to_string(id()));
gIPC->getSocket1Reply("dispatch workspace name:" + name()); } else if (!isSpecial()) { // named (this includes persistent)
} else if (id() != -99) { // named special gIPC->getSocket1Reply("dispatch workspace name:" + name());
gIPC->getSocket1Reply("dispatch togglespecialworkspace " + name()); } else if (id() != -99) { // named special
} else { // special gIPC->getSocket1Reply("dispatch togglespecialworkspace " + name());
gIPC->getSocket1Reply("dispatch togglespecialworkspace"); } else { // special
gIPC->getSocket1Reply("dispatch togglespecialworkspace");
}
return true;
} catch (const std::exception &e) {
spdlog::error("Failed to dispatch workspace: {}", e.what());
} }
return true;
} catch (const std::exception &e) {
spdlog::error("Failed to dispatch workspace: {}", e.what());
} }
return false; return false;
} }