From a852c313497720aff0efc527835b175274186616 Mon Sep 17 00:00:00 2001 From: Leleat Date: Tue, 20 Feb 2024 20:22:00 +0100 Subject: [PATCH 1/3] Prefs: Clarify window movement modes in prefs PS. the split into a default mode as a radio group and the other modes having a dropdown for choosing the modifier is a bit awkward (and it made the code awkward as well when the default mode also has a modifer set). It's probably better that each mode gets a dropdown and 'default' being one option for in the dropdown... Oh well, future stuff. Closes https://github.com/Leleat/Tiling-Assistant/issues/266 --- tiling-assistant@leleat-on-github/src/ui/prefs.ui | 1 + 1 file changed, 1 insertion(+) diff --git a/tiling-assistant@leleat-on-github/src/ui/prefs.ui b/tiling-assistant@leleat-on-github/src/ui/prefs.ui index a03b4d1..5ff873a 100644 --- a/tiling-assistant@leleat-on-github/src/ui/prefs.ui +++ b/tiling-assistant@leleat-on-github/src/ui/prefs.ui @@ -485,6 +485,7 @@ Default Window Movement Mode + The movement mode that is activated when no modifier key is pressed Date: Wed, 21 Feb 2024 01:59:54 +0100 Subject: [PATCH 2/3] Layouts: Work around windows being unresponsive after applying a layout While I can't reproduce the issue, multiple people reported the bug ( via multiple issues). Apparently, disabling the tiling animations works around the bug. So disable the tiling animations for layouts. A proper fix would probably require implementing custom animations rather than mis-using/hooking into GNOME Shell animations. For now just use this simple workaround since this is a rather annoying bug for those who are affected and has been around for a while. Works around https://github.com/Leleat/Tiling-Assistant/issues/304 --- .../src/extension/layoutsManager.js | 13 +++++++++---- .../src/extension/tilingPopup.js | 10 ++++++++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/tiling-assistant@leleat-on-github/src/extension/layoutsManager.js b/tiling-assistant@leleat-on-github/src/extension/layoutsManager.js index 7722980..c74974a 100644 --- a/tiling-assistant@leleat-on-github/src/extension/layoutsManager.js +++ b/tiling-assistant@leleat-on-github/src/extension/layoutsManager.js @@ -202,10 +202,14 @@ export default class TilingLayoutsManager { const window = this._remainingWindows[idx]; idx !== -1 && this._remainingWindows.splice(idx, 1); - if (window) - Twm.tile(window, this._currRect, { openTilingPopup: false }); - else if (app.can_open_new_window()) + if (window) { + Twm.tile(window, this._currRect, { + openTilingPopup: false, + skipAnim: true + }); + } else if (app.can_open_new_window()) { Twm.openAppTiled(app, this._currRect); + } this._step(); } @@ -238,7 +242,8 @@ export default class TilingLayoutsManager { // If this._currItem is the last item and we don't loop over it, // allow the Tiling Popup itself to spawn another instance of // a Tiling Popup, if there is free screen space. - this._currItem === this._items.at(-1) && !this._currItem.loopType + this._currItem === this._items.at(-1) && !this._currItem.loopType, + true ); const stacked = global.display.sort_windows_by_stacking(this._tiledWithLayout); const tileGroup = stacked.reverse(); diff --git a/tiling-assistant@leleat-on-github/src/extension/tilingPopup.js b/tiling-assistant@leleat-on-github/src/extension/tilingPopup.js index 5584d63..bfce1c9 100644 --- a/tiling-assistant@leleat-on-github/src/extension/tilingPopup.js +++ b/tiling-assistant@leleat-on-github/src/extension/tilingPopup.js @@ -27,8 +27,9 @@ export const TilingSwitcherPopup = GObject.registerClass({ * @param {boolean} allowConsecutivePopup allow the popup to create another * Tiling Popup, if there is still unambiguous free screen space after * this popup tiled a window. + * @param {boolean} skipAnim */ - _init(openWindows, freeScreenRect, allowConsecutivePopup = true) { + _init(openWindows, freeScreenRect, allowConsecutivePopup = true, skipAnim = false) { this._freeScreenRect = freeScreenRect; this._shadeBG = null; this._monitor = -1; @@ -43,6 +44,7 @@ export const TilingSwitcherPopup = GObject.registerClass({ // or null, if the popup was closed with tiling a window this.tiledWindow = null; this._allowConsecutivePopup = allowConsecutivePopup; + this._skipAnim = skipAnim; this._switcherList = new TSwitcherList(this, openWindows); this._items = this._switcherList.icons; @@ -299,7 +301,11 @@ export const TilingSwitcherPopup = GObject.registerClass({ // tile group won't be accidentally raised. Twm.clearTilingProps(window.get_id()); window.activate(global.get_current_time()); - Twm.tile(window, rect, { monitorNr: this._monitor, openTilingPopup: this._allowConsecutivePopup }); + Twm.tile(window, rect, { + monitorNr: this._monitor, + openTilingPopup: this._allowConsecutivePopup, + skipAnim: this._skipAnim + }); } // Dont _finish(), if no mods are pressed From e575676d7df6e3fd3a1701afa1d0db18b31000e3 Mon Sep 17 00:00:00 2001 From: Leleat Date: Wed, 21 Feb 2024 02:20:45 +0100 Subject: [PATCH 3/3] moveHandler: Handle change of window action key Currently, a conflict of the window action key (Alt or Super) with a movement mode modifier of T-A is only checked and handled during enable time. But users may change the window action key while T-A is already enabled. Handle that case now as well. Previously, the modifier for the conflicting move mode was switched to the non-window-action-modifier. But that can be an issue, if that modifier is already taken by a different mode. So simply disable the modifier for the conflicting mode. Closes https://github.com/Leleat/Tiling-Assistant/issues/313 --- .../src/extension/moveHandler.js | 42 +++++++++++++++---- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/tiling-assistant@leleat-on-github/src/extension/moveHandler.js b/tiling-assistant@leleat-on-github/src/extension/moveHandler.js index 43d3c96..6bdb166 100644 --- a/tiling-assistant@leleat-on-github/src/extension/moveHandler.js +++ b/tiling-assistant@leleat-on-github/src/extension/moveHandler.js @@ -44,20 +44,44 @@ export default class TilingMoveHandler { // The mouse button mod to move/resize a window may be changed to Alt. // So switch Alt and Super in our own prefs, if the user switched from // Super to Alt. - const wmPrefs = new Gio.Settings({ + const modKeys = [ + Settings.ADAPTIVE_TILING_MOD, + Settings.FAVORITE_LAYOUT_MOD, + Settings.IGNORE_TA_MOD + ]; + const handleWindowActionKeyConflict = () => { + const currMod = this._wmPrefs.get_string('mouse-button-modifier'); + + if (currMod === '') { + for (const key of modKeys) { + const mod = Settings.getInt(key); + if (mod === 2) // Alt + Settings.setInt(key, 0); + } + } else if (currMod === '') { + for (const key of modKeys) { + const mod = Settings.getInt(key); + if (mod === 4) // Super + Settings.setInt(key, 0); + } + } + }; + + this._wmPrefs = new Gio.Settings({ schema_id: 'org.gnome.desktop.wm.preferences' }); - const altAsMod = wmPrefs.get_string('mouse-button-modifier') === ''; - if (altAsMod) { - for (const s of [Settings.ADAPTIVE_TILING_MOD, Settings.FAVORITE_LAYOUT_MOD]) { - const mod = Settings.getInt(s); - if (mod === 1) // 1 -> Alt; see settings ui - Settings.setInt(s, 3); // 3 -> Super; see settings ui - } - } + this._wmPrefs.connectObject( + 'changed::mouse-button-modifier', + () => handleWindowActionKeyConflict(), + this + ); + handleWindowActionKeyConflict(); } destroy() { + this._wmPrefs.disconnectObject(this); + this._wmPrefs = null; + this._displaySignals.forEach(sId => global.display.disconnect(sId)); this._tilePreview.destroy();