// SPDX-FileCopyrightText: 2023 Plata Hill // SPDX-FileCopyrightText: 2023 Devin Lin // SPDX-License-Identifier: LGPL-2.1-or-later import QtQuick import org.kde.kwin as KWinComponents import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings Item { id: root function run(window) { if (!ShellSettings.Settings.convergenceModeEnabled) { window.noBorder = true; window.setMaximize(true, true); } else { window.noBorder = false; } } Connections { target: ShellSettings.Settings function onConvergenceModeEnabledChanged() { const windows = KWinComponents.Workspace.windows; for (let i = 0; i < windows.length; i++) { if (windows[i].normalWindow) { root.run(windows[i]); } } } } Connections { target: KWinComponents.Workspace function onWindowAdded(window) { if (window.normalWindow) { window.interactiveMoveResizeFinished.connect((window) => { root.run(window); }); root.run(window); } } function onScreensChanged() { // Windows are moved from the external screen // to the internal screen if the external screen // is disconnected. const windows = KWinComponents.Workspace.windows; for (var i = 0; i < windows.length; i++) { if (windows[i].normalWindow) { root.run(windows[i]); } } } } }