From ee27d33b9b9aaea4500c3c336cd901b167ec6905 Mon Sep 17 00:00:00 2001 From: Natalie Clarius Date: Wed, 14 Dec 2022 11:21:16 -0300 Subject: [PATCH] filter windows by activity; port away from deprecated `Window::desktop` --- README.bbcode | 2 +- README.md | 4 ++-- ...pt => application-switcher_v1.6.kwinscript | Bin 18341 -> 18370 bytes contents/code/main.js | 4 ++-- metadata.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) rename application-switcher_v1.5.kwinscript => application-switcher_v1.6.kwinscript (66%) diff --git a/README.bbcode b/README.bbcode index 1d10325..09ed4fe 100644 --- a/README.bbcode +++ b/README.bbcode @@ -1,6 +1,6 @@ Automatically raises all other visible windows of the same application together when activating one of them, effectively creating application groups to task-switch between. -[b]Please make sure to install the most recent version (v1.5) and to not use Discover for installation.[/b] For more information on installation, setup and usage as well as any requests, please visit [url=https://github.com/nclarius/kwin-application-switcher]the GitHub page[/url]. +[b]Please make sure to install the most recent version (v1.6) and to not use Discover for installation.[/b] For more information on installation, setup and usage as well as any requests, please visit [url=https://github.com/nclarius/kwin-application-switcher]the GitHub page[/url]. This extension gives rise to an application-centric task switching workflow as known from environments such as GNOME or MacOS, where an application’s windows are treated as a group, and task switching can take place at two levels: one mode for switching applications and one mode for switching between windows of an application. diff --git a/README.md b/README.md index 03bda62..f8a190f 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Seen in the screencast: Switching from Konsole back to Dolphin also brings the o ### Installation via graphical interface -**Please make sure to select the most recent version (v1.5)** in the installation process. +**Please make sure to select the most recent version (v1.6)** in the installation process. A [bug](https://bugs.kde.org/show_bug.cgi?id=453521) in Discover causes a wrong version to be installed, so using the installation module in System Settings instead is recommended. @@ -55,7 +55,7 @@ If you are intending to have one mode for switching applications and one mode fo ### Limitations -- The KWin scripting API provides no possibility to distinguish how a window was activated (via alt-tabbing, panel task bar clicking, clicking on the window, or being requested from another process), so the plugin can not be applied selectively to only some activation types. +- The KWin scripting API provides no possibility to distinguish how a window was activated (via alt-tabbing, clicking on the task bar, clicking on the window, or being requested from another process), so the plugin can not be applied selectively to only some activation types. - The KWin scripting API provides no possibility to manipulate the recently used and stacking order without actually activating the window, so focus will briefly shift as windows are being brought to the front; however this happens so fast it shouldn’t be noticeable. ## Small Print diff --git a/application-switcher_v1.5.kwinscript b/application-switcher_v1.6.kwinscript similarity index 66% rename from application-switcher_v1.5.kwinscript rename to application-switcher_v1.6.kwinscript index 5076e7a54c31b16f68ed7d5858c1831da085b863..0b77014291013b57959f7309908e151597c54efb 100644 GIT binary patch delta 5149 zcmZ9QbyU=C)5mv#m5}ZZ>5x)l0YPFZX(S~iMX9BmAE1E5g0O%fAhjaWT~g8|-67rG zDZFt1@!aq8T<6T3bDc9Y*E#dY_nOaqiv~AGgYh(8pkv^G?oVHSbqpRe1O0fCg`4L? z5Ex?}9R&Kv{Tt(e9iz^PeistsLrtP;7^P#WmE7oy0RoxegFs{;TBIM062Jzb3r;6l z+}r;Yir0JPI4w--KVBp{D9c0<7MtyOV$|Ci^4dm^lsn`ZhP3pHa+O3jq1e*T**AOQ zi?HnFSDB$rViIRZsnOjh)62tBDos@~B~wl1g;4H~X2dWW>u`vUlDkOIbn^78a~a%) z$Yy|!JzR*|pGa-L9v)!=DHF4ITr-02|D#5zACsm8^B%4VUcVHM-TPOS0sL*2# zszuOimSSZ^SpVo=xian7c6kk9zG( zM3X?fzx$)(gAKkb=U(rY)-yb>MY%Y&v>tQpT8+4HW?^H>`k|KvKWZ0CV-YpE13>48 zYBl$%VXZ1wz8m9%kz~f9)a|&1r6e<*k=FNUX!=&1BK%oK;kk4(2Voh0hRP;z3hPSN<{EMAzTyVVmsQYcc8Zx6JRXZ=%kv+G{{&E6M9kn9 zZzgD3Bs?b0K?JeP%v21$Lz}GmEXp%1*T0yx28Rv=sWXPgnsG>K^h!%e&+FV=c$ae> zB2|gGJSH%SPUZF_wk$)xG%v0^8D^tdu{jp!Bu|<<>Qb=TBnAuM3H^5rpfAcnfrn&LvfnJ+7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8$nG-@91J za8IJV?)l@)2#n&ZG006XiKal=mV-E_ZjVW7N(0!cOdk-~oxI zhWPg0i$Nt>$XJEbw?c?tg5_i)N`5ng;QnZMfsQkPl1^5aeo*R4T(+u3W~4qsUc7xC zGR3%~DW=bInRyiRq!F~i9^-(x6`%L63UZP>VcEs8o-1pS@R+b^wDJitAL_;*UW4&0 ziTL7_2_+dJzRK?DEX0iV7Ed1?T#qSpoDYCI&us%*7T``PpNtw__ch%Sz9^G6|3Wy=;&cGrkE=yza}QYRM?s+W%`Uj_N`H^ z9j{puk(B7FaT#Y-rMdOSz|{T)uRea(gry}(W<U(B9CQRF&)p@RkdS^Ph@$nsFPa7W~KrOnnqTMcL! zbo$3=%>UQ#<*5wA;}LDN^(=I)ZUjyXoGZ^o^ z040FwU!L0a5l|K_O$-2dIm7Io>|yrTc9@U1nJF=V=r4B~Lcm0S*@;gRM9_oO)D*oY zrw~mr!3SivrkL3O=cfOx>UvF6|3OjL6|V{EZ$+|yiyJ$Hfq94e-)RmGe_gqMUH(_{ Xt~&=`-{*B5!N_EYD9JnZzfJ!a%>0C@ diff --git a/contents/code/main.js b/contents/code/main.js index 02610ab..5245f68 100644 --- a/contents/code/main.js +++ b/contents/code/main.js @@ -86,8 +86,8 @@ function getAppGroup(current) { if (!current) return; let appGroup = appGroups[getApp(current)].filter(window => window && !window.minimized && - (window.desktop == current.desktop || - window.onAllDesktops || current.onAllDesktops)); + (window.x11DesktopIds.includes(workspace.currentDesktop) || window.x11DesktopIds.length == 0) && + (window.activities.includes(workspace.currentActivity) || window.activities.length == 0)); debug("getting app group", appGroup.map(window => window.caption)); return appGroup; } diff --git a/metadata.json b/metadata.json index 9f4beb3..e72013d 100644 --- a/metadata.json +++ b/metadata.json @@ -15,7 +15,7 @@ "KWin/Script", "KCModule" ], - "Version": "1.5", + "Version": "1.6", "Website": "" }, "X-Plasma-API": "javascript",