Warning, /plasma/plasma-mobile/kwin/scripts/convergentwindows/contents/ui/main.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2023 Plata Hill <plata.hill@kdemail.net>
0002 // SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
0003 // SPDX-License-Identifier: LGPL-2.1-or-later
0004
0005 import QtQuick
0006 import org.kde.kwin as KWinComponents
0007 import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
0008
0009 Loader {
0010 id: root
0011
0012 function run(window) {
0013 if (!ShellSettings.Settings.convergenceModeEnabled) {
0014 window.noBorder = true;
0015 window.setMaximize(true, true);
0016 } else {
0017 window.noBorder = false;
0018 }
0019 }
0020
0021 Connections {
0022 target: ShellSettings.Settings
0023
0024 function onConvergenceModeEnabledChanged() {
0025 const windows = KWinComponents.Workspace.windows;
0026
0027 for (let i = 0; i < windows.length; i++) {
0028 if (windows[i].normalWindow) {
0029 root.run(windows[i]);
0030 }
0031 }
0032 }
0033 }
0034
0035 Connections {
0036 target: KWinComponents.Workspace
0037
0038 function onWindowAdded(window) {
0039 if (window.normalWindow) {
0040 window.interactiveMoveResizeFinished.connect((window) => {
0041 root.run(window);
0042 });
0043 root.run(window);
0044 }
0045 }
0046
0047 function onScreensChanged() {
0048 // Windows are moved from the external screen
0049 // to the internal screen if the external screen
0050 // is disconnected.
0051 const windows = KWinComponents.Workspace.windows;
0052
0053 for (var i = 0; i < windows.length; i++) {
0054 if (windows[i].normalWindow) {
0055 root.run(windows[i]);
0056 }
0057 }
0058 }
0059 }
0060 }