From b485d9ec20bcaa2114155224f1ad216ba509f985 Mon Sep 17 00:00:00 2001 From: Val Packett Date: Wed, 5 Jun 2024 19:21:05 -0300 Subject: [PATCH 1/7] Add option to maximize windows within the tiling flow Not quite a fix, but does work as a workaround for #870, along with just being a desired behavior for some users. --- Settings.ui | 38 +++++++++++++++++- prefs.js | 1 + schemas/gschemas.compiled | Bin 11621 -> 11677 bytes ...gnome.shell.extensions.paperwm.gschema.xml | 5 +++ settings.js | 1 + tiling.js | 7 ++++ 6 files changed, 51 insertions(+), 1 deletion(-) diff --git a/Settings.ui b/Settings.ui index 06efe5fa..f1d13459 100644 --- a/Settings.ui +++ b/Settings.ui @@ -2006,7 +2006,43 @@ - + + + False + False + + + False + 12 + 12 + 6 + 6 + 32 + + + False + Enables handling maximize events (like double clicking the header bar) by stretching window width but not going out of the tiling margins + 1 + Maximize within tiling + 0 + + 0 + 0 + + + + + + + 1 + 0 + + + + + + + diff --git a/prefs.js b/prefs.js index 9f275af8..bcbad6ec 100644 --- a/prefs.js +++ b/prefs.js @@ -466,6 +466,7 @@ class SettingsWidget { // disabled since opposite of gnome-pill // booleanSetState('show-workspace-indicator'); percentValueChanged('maximize-width-percent', 'maximize-width-percent'); + booleanStateChanged('maximize-within-tiling'); // About // build version information diff --git a/schemas/gschemas.compiled b/schemas/gschemas.compiled index 40af767fcf5620bafa55956953fbaf6680ad6260..c89b6caa3a0ad523b728b2c1595ab8d47a780800 100644 GIT binary patch delta 2907 zcmYk8Yiv_x9LC?lCUYCET&bevr@I-X z^@CXu*x5o00~1x=8E1OuXO#>DVNvP5U_!^{#O&I{`EyzP{e{Q5lS|6a~} z-plEKdi&Upy?Y&}YJ_mu&wrLDgs=yM2#7YZ4ruYp?BqIhLXE)VECV(FWioM&c#a6FQ%Z=;L_DMerKG%9C41P0Bpa%sSokA zx>=3_CxRZ(5goVKfc_T5o1yKXG*IeboZg0bC)5Bhyq15FarzR(2cd_-_~-sf#_4ZG z{1o&o_~7z4Nyh2RMH(Z8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L7NpIT=09ODhpF)(0$y^I&ovnM8?lVEq>nM2I! zImU;fN5I48(OTy8?4c7-?kKLAHshXUXZ1nbNtli5huec?X>-Uck+UPM zzJ#66;(B#bWo8rbIJCj2>K+ndAjSFIad|QJ>eF4QR|R;tf@~Wm-82`F%wBs&pGC(W#)A^ZlsI% zy7aNb=EgxQo3OG;_iFBra%V^NEi;W6G~&Za#~zt!xj+Nml%3b@oSD^gwri70{5jlMiyL@W zcEm{YHaN6F`JmP!Yr_NbV$3HiB9(Gn(^fjB>)DQ}s~7XEG+K?iZgkXiJPYrqXACE4 zskT(8+gQ;N*VO;-bxNcWjTL%Ps~m7g zdQb_ty>r{=rvi8P8vtgoxD0SaN&x;u)b7q*ycO$KU^a;bfZq=MZovOGc9Q9%8?q4e zfGYvNC$J@|&jEgC%ms}A>soytltQsHsm}^bE}=#$kHN)&{X15JhNFfliLM-}W?yEF z!L+HSW{Lc!JtS9$I?CBr%pkc)Yb=?N4|g7tW1)b*IKWmm=h)MePcvM(vZGO+jn!B4 z5*)33*WyyBay`TGRE%%0nn+u@!^sQ3J#;hsZ2G{1-iZX4tCJyh{G^tIo40bNKIB+x zu}#;Vp1Ys-@7%%TZPYUo(c()cjhv{LMrWYGF%lM*k7wu9RUF!xHkFMqlRF|Ic`_WR zonBOVE8(SzYf7!Bdn2*>nQ5c?5x3IOcQV*Hx8Pb26j##BEc?$&i>IylaIs(2|hwKJw%9&CK#ScP2L z)m7j}?G^ZIIt@JoQqK94oN)B~Percent of workspace width the horizontal window maximise function (Super+F) will use. + + false + Handle maximize events from windows (e.g. header bar double click) by maximizing their width without going beyond the margins. + + { minimizeHandler(metaWindow); }); + signals.connect(metaWindow, 'notify::maximized-horizontally', metaWindow => { + if (Settings.prefs.maximize_within_tiling && metaWindow.get_maximized() === Meta.MaximizeFlags.BOTH) { + metaWindow.unmaximize(Meta.MaximizeFlags.BOTH); + toggleMaximizeHorizontally(metaWindow); + } + spaces.spaceOfWindow(metaWindow)?.layout(false); + }); signals.connect(actor, 'show', actor => { showHandler(actor); }); From f3fb93d086866d787d1ed4266c7d82ba26098fc9 Mon Sep 17 00:00:00 2001 From: Val Packett Date: Thu, 6 Jun 2024 04:51:16 -0300 Subject: [PATCH 2/7] swipe: fix focus behavior The unrelated direction variable was used as the direction argument there, and the intended direction was passed as an unused third argument. --- gestures.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gestures.js b/gestures.js index 59737c78..d9844313 100644 --- a/gestures.js +++ b/gestures.js @@ -317,7 +317,7 @@ export function update(space, dx, t) { let target = Math.round(space.targetX - d); space.targetX = target; - let selected = findTargetWindow(space, direction, start - space.targetX > 0); + const selected = findTargetWindow(space, start - space.targetX > 0); space.targetX = space.cloneContainer.x; Tiling.updateSelection(space, selected); space.selectedWindow = selected; From 72c889511b033fe3a9daef2e1801b8f42be03292 Mon Sep 17 00:00:00 2001 From: Jay Ta'ala Date: Thu, 6 Jun 2024 23:29:22 +1000 Subject: [PATCH 3/7] Changed default to `true`. Some formatting and cleanup. Layout call I think should be animated (as it's not an intermediate layout operation). --- schemas/gschemas.compiled | Bin 11677 -> 11677 bytes ...gnome.shell.extensions.paperwm.gschema.xml | 2 +- tiling.js | 6 ++++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/schemas/gschemas.compiled b/schemas/gschemas.compiled index c89b6caa3a0ad523b728b2c1595ab8d47a780800..806e1af29402b3f87bdbff6f9408f05b25891ce8 100644 GIT binary patch delta 14 VcmbOmJvVwof+i#5=0r^!762+21gQW3 delta 14 VcmbOmJvVwof+i!w=0r^!762*{1gHQ2 diff --git a/schemas/org.gnome.shell.extensions.paperwm.gschema.xml b/schemas/org.gnome.shell.extensions.paperwm.gschema.xml index 98b271ec..99fb39c6 100644 --- a/schemas/org.gnome.shell.extensions.paperwm.gschema.xml +++ b/schemas/org.gnome.shell.extensions.paperwm.gschema.xml @@ -596,7 +596,7 @@ - false + true Handle maximize events from windows (e.g. header bar double click) by maximizing their width without going beyond the margins. diff --git a/tiling.js b/tiling.js index 8cfe03de..3bdceea3 100644 --- a/tiling.js +++ b/tiling.js @@ -3340,11 +3340,13 @@ export function registerWindow(metaWindow) { minimizeHandler(metaWindow); }); signals.connect(metaWindow, 'notify::maximized-horizontally', metaWindow => { - if (Settings.prefs.maximize_within_tiling && metaWindow.get_maximized() === Meta.MaximizeFlags.BOTH) { + if ( + Settings.prefs.maximize_within_tiling && + metaWindow.get_maximized() === Meta.MaximizeFlags.BOTH) { metaWindow.unmaximize(Meta.MaximizeFlags.BOTH); toggleMaximizeHorizontally(metaWindow); } - spaces.spaceOfWindow(metaWindow)?.layout(false); + spaces.spaceOfWindow(metaWindow)?.layout(); }); signals.connect(actor, 'show', actor => { showHandler(actor); From 0bd40ba05087d73961e31b5d86e101937e959ac3 Mon Sep 17 00:00:00 2001 From: Jay Ta'ala Date: Fri, 7 Jun 2024 19:15:32 +1000 Subject: [PATCH 4/7] Updated metadata.json. --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 41409fbe..b8449215 100644 --- a/metadata.json +++ b/metadata.json @@ -5,7 +5,7 @@ "url": "https://github.com/paperwm/PaperWM", "settings-schema": "org.gnome.shell.extensions.paperwm", "shell-version": [ "45", "46" ], - "version-name": "46.10.2", + "version-name": "46.11.0", "donations": { "buymeacoffee": "jaytaala", "patreon": "valpackett" From a4c6230370a06b6e840bcaeb1890b1b7dd528454 Mon Sep 17 00:00:00 2001 From: Jay Ta'ala Date: Sat, 8 Jun 2024 20:32:41 +1000 Subject: [PATCH 5/7] Now saving last window frame on layout. Using to restore original size before maximising (for restore). --- tiling.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tiling.js b/tiling.js index 3bdceea3..145d6811 100644 --- a/tiling.js +++ b/tiling.js @@ -765,6 +765,12 @@ export class Space extends Array { } callback && callback(); + + // save the last size frame (for use in restoring) + this.getWindows().forEach(w => { + w._last_layout_frame = w.get_frame_rect(); + }); + this.emit('layout', this); } @@ -2016,6 +2022,8 @@ border-radius: ${borderWidth}px; removeHandlerFlags(w); delete w.pos_mismatch_count; delete w.tiled_on_minimize; + delete w._fullscreen_frame; + delete w._last_layout_frame; }); this.signals.destroy(); this.signals = null; @@ -3339,18 +3347,28 @@ export function registerWindow(metaWindow) { signals.connect(metaWindow, 'notify::minimized', metaWindow => { minimizeHandler(metaWindow); }); + signals.connect(metaWindow, 'notify::maximized-horizontally', metaWindow => { if ( Settings.prefs.maximize_within_tiling && metaWindow.get_maximized() === Meta.MaximizeFlags.BOTH) { metaWindow.unmaximize(Meta.MaximizeFlags.BOTH); + + // restore last layout frame + if (metaWindow._last_layout_frame) { + const lsf = metaWindow._last_layout_frame; + metaWindow.move_resize_frame(true, lsf.x, lsf.y, lsf.width, lsf.height); + } + toggleMaximizeHorizontally(metaWindow); + // spaces.spaceOfWindow(metaWindow)?.layout(); } - spaces.spaceOfWindow(metaWindow)?.layout(); }); + signals.connect(actor, 'show', actor => { showHandler(actor); }); + signals.connect(actor, 'destroy', destroyHandler); return true; From 3e4bc7b699fb7e7f98d503530a8b8106801ef447 Mon Sep 17 00:00:00 2001 From: Jay Ta'ala Date: Sat, 8 Jun 2024 21:06:10 +1000 Subject: [PATCH 6/7] Cleanup PaperWM window flags. --- tiling.js | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/tiling.js b/tiling.js index 145d6811..16322b2e 100644 --- a/tiling.js +++ b/tiling.js @@ -900,14 +900,14 @@ export class Space extends Array { // check if mismatch tracking needed, otherwise leave if (f.x === x && f.y === y) { // delete any mismatch counter (e.g. from previous attempt) - delete w.pos_mismatch_count; + delete w._pos_mismatch_count; return; } // guard against recursively calling this method // see https://github.com/paperwm/PaperWM/issues/769 - if (w.pos_mismatch_count && - w.pos_mismatch_count > 1) { + if (w._pos_mismatch_count && + w._pos_mismatch_count > 1) { console.warn(`clone/window position-changed recursive call: ${w.title}`); return; } @@ -915,11 +915,11 @@ export class Space extends Array { // mismatch detected // move frame to ensure window position matches clone try { - if (!w.pos_mismatch_count) { - w.pos_mismatch_count = 0; + if (!w._pos_mismatch_count) { + w._pos_mismatch_count = 0; } else { - w.pos_mismatch_count += 1; + w._pos_mismatch_count += 1; } w.move_frame(true, x, y); } @@ -2019,11 +2019,9 @@ border-radius: ${borderWidth}px; destroy() { this.getWindows().forEach(w => { - removeHandlerFlags(w); - delete w.pos_mismatch_count; - delete w.tiled_on_minimize; - delete w._fullscreen_frame; - delete w._last_layout_frame; + + + removePaperWMFlags(w); }); this.signals.destroy(); this.signals = null; @@ -2109,8 +2107,8 @@ export const Spaces = class Spaces extends Map { // Clone and hook up existing windows display.get_tab_list(Meta.TabList.NORMAL_ALL, null) .forEach(w => { - // remove handler flags - removeHandlerFlags(w); + // remove flags + removePaperWMFlags(w); registerWindow(w); // Fixup allocations on reload @@ -3424,12 +3422,18 @@ export function destroyHandler(actor) { } /** - * Removes resize and position handler flags. + * Removes resize, position, and other flags. Used during cleanup etc. * @param {Meta.Window} metaWindow */ -export function removeHandlerFlags(metaWindow) { - delete metaWindow._resizeHandlerAdded; - delete metaWindow._positionHandlerAdded; +export function removePaperWMFlags(w) { + delete w._targetWidth; + delete w._targetHeight; + delete w._resizeHandlerAdded; + delete w._positionHandlerAdded; + delete w._pos_mismatch_count; + delete w._tiled_on_minimize; + delete w._fullscreen_frame; + delete w._last_layout_frame; } export function addPositionHandler(metaWindow) { @@ -4407,14 +4411,14 @@ export function minimizeHandler(metaWindow) { console.debug('minimized', metaWindow?.title); // check if was tiled if (isTiled(metaWindow)) { - metaWindow.tiled_on_minimize = true; + metaWindow._tiled_on_minimize = true; } Scratch.makeScratch(metaWindow); } else { console.debug('unminimized', metaWindow?.title); - if (metaWindow.tiled_on_minimize) { - delete metaWindow.tiled_on_minimize; + if (metaWindow._tiled_on_minimize) { + delete metaWindow._tiled_on_minimize; Utils.later_add(Meta.LaterType.IDLE, () => { Scratch.unmakeScratch(metaWindow); }); From b4cc61ff91621d82db354a31ff5c5c06ea725805 Mon Sep 17 00:00:00 2001 From: Jay Ta'ala Date: Sun, 9 Jun 2024 12:44:42 +1000 Subject: [PATCH 7/7] Updated metadata.json. --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index b8449215..2372b2ab 100644 --- a/metadata.json +++ b/metadata.json @@ -5,7 +5,7 @@ "url": "https://github.com/paperwm/PaperWM", "settings-schema": "org.gnome.shell.extensions.paperwm", "shell-version": [ "45", "46" ], - "version-name": "46.11.0", + "version-name": "46.11.1", "donations": { "buymeacoffee": "jaytaala", "patreon": "valpackett"