[plasma/kwin] /: Add option to do nothing when activating window on another desktop

Nicolas Fella null at kde.org
Fri Apr 14 23:25:10 BST 2023


Git commit 8c9c45b8f101f1d90b3084530f9e463a2b5915ab by Nicolas Fella.
Committed on 14/04/2023 at 19:06.
Pushed by nicolasfella into branch 'master'.

Add option to do nothing when activating window on another desktop

Some users prefer this over the existing options. It e.g. allows to open
a bunch of links and only then switch to the browser on a different desktop

BUG: 464283

M  +12   -0    doc/windowbehaviour/index.docbook
M  +2    -0    src/activation.cpp
M  +5    -0    src/kcms/options/advanced.ui
M  +1    -0    src/kwin.kcfg
M  +2    -1    src/options.h

https://invent.kde.org/plasma/kwin/commit/8c9c45b8f101f1d90b3084530f9e463a2b5915ab

diff --git a/doc/windowbehaviour/index.docbook b/doc/windowbehaviour/index.docbook
index 18b5e8ce77..9b7b7f5742 100644
--- a/doc/windowbehaviour/index.docbook
+++ b/doc/windowbehaviour/index.docbook
@@ -1190,6 +1190,18 @@ Choose this option if you would like windows to always open on the current Virtu
 </listitem>
 </varlistentry>
 
+<varlistentry>
+<term><guilabel>Do nothing</guilabel></term>
+<listitem>
+<para>
+The window stays on the desktop it currently is and the current desktop doesn't change.
+</para>
+<para>
+Choose this option if you would like to keep the windows and desktops as they are.
+</para>
+</listitem>
+</varlistentry>
+
 </variablelist>
 
 </sect3>
diff --git a/src/activation.cpp b/src/activation.cpp
index 20e0e5decd..8b273cf426 100644
--- a/src/activation.cpp
+++ b/src/activation.cpp
@@ -296,6 +296,8 @@ void Workspace::activateWindow(Window *window, bool force)
         case Options::ActivationDesktopPolicy::BringToCurrentDesktop:
             window->enterDesktop(VirtualDesktopManager::self()->currentDesktop());
             break;
+        case Options::ActivationDesktopPolicy::DoNothing:
+            break;
         }
         --block_focus;
     }
diff --git a/src/kcms/options/advanced.ui b/src/kcms/options/advanced.ui
index ecf3afbcbc..9167397947 100644
--- a/src/kcms/options/advanced.ui
+++ b/src/kcms/options/advanced.ui
@@ -169,6 +169,11 @@
        <string>Bring window to current Virtual Desktop</string>
       </property>
      </item>
+     <item>
+      <property name="text">
+       <string>Do nothing</string>
+      </property>
+     </item>
     </widget>
    </item>
   </layout>
diff --git a/src/kwin.kcfg b/src/kwin.kcfg
index 7b9190633a..46bac99242 100644
--- a/src/kwin.kcfg
+++ b/src/kwin.kcfg
@@ -136,6 +136,7 @@
             <choices name="KWin::Options::ActivationDesktopPolicy">
                 <choice name="SwitchToOtherDesktop"/>
                 <choice name="BringToCurrentDesktop"/>
+                <choice name="DoNothing"/>
             </choices>
             <default>KWin::Options::ActivationDesktopPolicy::SwitchToOtherDesktop</default>
         </entry>
diff --git a/src/options.h b/src/options.h
index 78730a7b79..a78255ce08 100644
--- a/src/options.h
+++ b/src/options.h
@@ -360,7 +360,8 @@ public:
 
     enum ActivationDesktopPolicy {
         SwitchToOtherDesktop,
-        BringToCurrentDesktop
+        BringToCurrentDesktop,
+        DoNothing,
     };
     Q_ENUM(ActivationDesktopPolicy)
 


More information about the kde-doc-english mailing list