From f1b497e2b0196eba3c73b2db071edb1db181ae5b Mon Sep 17 00:00:00 2001 From: Emil Sedgh Date: Thu, 22 Nov 2012 02:51:36 +0330 Subject: [PATCH] Window shortcuts now toggle (raise/minimize) windows. This allows me to use all applications in a Yakuake-like method. I can define a shortcut for an application, press it, window shows up, do my work, press it again and it hides. This is specifically good for a Text Editor<-->Browser switching workflow. Also my first kwin patch. --- activation.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/activation.cpp b/activation.cpp index ed2632da2e..c3ab3920d5 100644 --- a/activation.cpp +++ b/activation.cpp @@ -922,7 +922,11 @@ void Client::updateUrgency() void Client::shortcutActivated() { - workspace()->activateClient(this, true); // force + Client* raised_client = workspace()->topClientOnDesktop(desktop(), -1); + if (isActive() && this == raised_client) // if client is already raised, pressing its shorcut hides it, giving the shortcut a 'toggle' effect + setMinimized(true); + else + workspace()->activateClient(this, true); // force } //****************************************