2025-08-06 12:34:45 +00:00
|
|
|
// SPDX-FileCopyrightText: 2025 Sebastian Kügler <sebas@kde.org>
|
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
|
|
|
|
import QtQuick
|
|
|
|
|
import QtQml
|
|
|
|
|
|
|
|
|
|
import org.kde.plasma.quicksetting.kscreenosd 1.0
|
|
|
|
|
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This switches between docked / convergence mode and normal when a monitor
|
|
|
|
|
* is plugged in or unplugged.
|
|
|
|
|
*/
|
|
|
|
|
QtObject {
|
|
|
|
|
id: component
|
|
|
|
|
|
2025-10-06 16:18:03 +00:00
|
|
|
property bool initialConvergenceMode: false
|
2026-05-04 06:43:04 +00:00
|
|
|
property bool wasDocked: false
|
2025-10-06 16:18:03 +00:00
|
|
|
|
2025-08-06 12:34:45 +00:00
|
|
|
property var apiListener: Connections {
|
|
|
|
|
target: KScreenOSDUtil
|
|
|
|
|
function onOutputsChanged() {
|
2026-05-04 06:43:04 +00:00
|
|
|
const docked = KScreenOSDUtil.outputs > 1;
|
|
|
|
|
if (docked && !wasDocked) {
|
2025-10-06 16:18:03 +00:00
|
|
|
initialConvergenceMode = ShellSettings.Settings.convergenceModeEnabled;
|
|
|
|
|
}
|
2026-05-04 06:43:04 +00:00
|
|
|
ShellSettings.Settings.convergenceModeEnabled = docked ? true : initialConvergenceMode;
|
|
|
|
|
wasDocked = docked;
|
2025-10-06 16:18:03 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
2026-05-04 06:43:04 +00:00
|
|
|
wasDocked = KScreenOSDUtil.outputs > 1;
|
|
|
|
|
initialConvergenceMode = ShellSettings.Settings.convergenceModeEnabled;
|
2025-08-06 12:34:45 +00:00
|
|
|
}
|
|
|
|
|
}
|