kscreenosd popup: auto-switch to convergenceMode

This popupprovider takes care of automatically enabling and disabling
convergence / docked mode when a monitor is plugged in or unplugged.

It uses the plugin that is provided with the kscreenosd quicksetting,
which essentially notifies of outputs being added and removed.

Signed-off-by: Sebastian Kügler <sebas@kde.org>
This commit is contained in:
Sebastian Kügler 2025-08-06 14:34:45 +02:00
parent b849fb98ab
commit 569d268c49
3 changed files with 38 additions and 0 deletions

View file

@ -80,6 +80,8 @@ ecm_target_qml_sources(mobileshellplugin SOURCES
qml/popups/notifications/NotificationPopupProvider.qml
qml/popups/notifications/PulseAudio.qml
qml/popups/kscreenosd/KScreenOSDProvider.qml
qml/popups/volumeosd/AudioApplet.qml
qml/popups/volumeosd/DeviceListItem.qml
qml/popups/volumeosd/icon.js

View file

@ -23,6 +23,9 @@ Item {
if (!volumeOSD.active) {
volumeOSD.active = true;
}
if (!kscreenOSD.active) {
kscreenOSD.active = true;
}
if (!notifications.active) {
notifications.active = true;
}
@ -38,6 +41,13 @@ Item {
}
}
Loader {
id: kscreenOSD
sourceComponent: Component {
MobileShell.KScreenOSDProvider {}
}
}
Loader {
id: notifications
sourceComponent: Component {

View file

@ -0,0 +1,26 @@
// 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 var apiListener: Connections {
target: KScreenOSDUtil
function onOutputsChanged() {
console.log("KScreenOSDProvider convergenceModeEnabled: "
+ (KScreenOSDUtil.outputs > 1 ? "true" : "false"));
ShellSettings.Settings.convergenceModeEnabled = KScreenOSDUtil.outputs > 1;
}
}
}