mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-06-11 16:57:43 +00:00
Track docked state transitions in KScreenOSDProvider and only snapshot the initial convergence mode when transitioning into docked mode. This restores the previous user preference when outputs drop back to one.
37 lines
1.1 KiB
QML
37 lines
1.1 KiB
QML
// 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
|
|
|
|
property bool initialConvergenceMode: false
|
|
property bool wasDocked: false
|
|
|
|
property var apiListener: Connections {
|
|
target: KScreenOSDUtil
|
|
function onOutputsChanged() {
|
|
const docked = KScreenOSDUtil.outputs > 1;
|
|
if (docked && !wasDocked) {
|
|
initialConvergenceMode = ShellSettings.Settings.convergenceModeEnabled;
|
|
}
|
|
ShellSettings.Settings.convergenceModeEnabled = docked ? true : initialConvergenceMode;
|
|
wasDocked = docked;
|
|
}
|
|
}
|
|
|
|
Component.onCompleted: {
|
|
wasDocked = KScreenOSDUtil.outputs > 1;
|
|
initialConvergenceMode = ShellSettings.Settings.convergenceModeEnabled;
|
|
}
|
|
}
|