Add compact-mode sizing hooks for gaming rails

Expose compactMode in running games and quick settings so handheld layouts can tighten heading scale, tile size, and panel width without touching behavior.
This commit is contained in:
Marco Allegretti 2026-06-01 15:49:39 +02:00
parent 00643ab5f5
commit 434f46403c
2 changed files with 10 additions and 5 deletions

View file

@ -21,6 +21,7 @@ Item {
id: root id: root
anchors.fill: parent anchors.fill: parent
property bool compactMode: false
property bool opened: false property bool opened: false
readonly property string acceptButtonLabel: GamingShell.GamepadManager.buttonLabel(GamingShell.GamepadManager.ButtonA) readonly property string acceptButtonLabel: GamingShell.GamepadManager.buttonLabel(GamingShell.GamepadManager.ButtonA)
readonly property string closeButtonLabel: GamingShell.GamepadManager.buttonLabel(GamingShell.GamepadManager.ButtonB) readonly property string closeButtonLabel: GamingShell.GamepadManager.buttonLabel(GamingShell.GamepadManager.ButtonB)
@ -150,7 +151,9 @@ Item {
// Panel sliding in from the right // Panel sliding in from the right
Rectangle { Rectangle {
id: panel id: panel
width: Math.min(root.width * 0.35, Kirigami.Units.gridUnit * 22) width: root.compactMode
? Math.min(root.width * 0.92, Kirigami.Units.gridUnit * 26)
: Math.min(root.width * 0.35, Kirigami.Units.gridUnit * 24)
height: root.height height: root.height
anchors.top: root.top anchors.top: root.top
anchors.bottom: root.bottom anchors.bottom: root.bottom
@ -189,7 +192,7 @@ Item {
Flickable { Flickable {
anchors.fill: parent anchors.fill: parent
anchors.margins: Kirigami.Units.largeSpacing * 2 anchors.margins: root.compactMode ? Kirigami.Units.largeSpacing : Kirigami.Units.largeSpacing * 2
contentHeight: settingsColumn.implicitHeight contentHeight: settingsColumn.implicitHeight
clip: true clip: true

View file

@ -15,6 +15,8 @@ import plasma.applet.org.kde.plasma.mobile.homescreen.folio as Folio
Item { Item {
id: root id: root
property bool compactMode: false
implicitHeight: taskList.count > 0 ? column.implicitHeight : 0 implicitHeight: taskList.count > 0 ? column.implicitHeight : 0
readonly property bool hasTasks: taskList.count > 0 readonly property bool hasTasks: taskList.count > 0
readonly property int taskCount: taskList.count readonly property int taskCount: taskList.count
@ -73,7 +75,7 @@ Item {
visible: taskList.count > 0 visible: taskList.count > 0
Kirigami.Heading { Kirigami.Heading {
level: 2 level: root.compactMode ? 3 : 2
text: i18n("Running") text: i18n("Running")
} }
@ -120,8 +122,8 @@ Item {
required property var decoration required property var decoration
required property var winIdList required property var winIdList
width: Kirigami.Units.gridUnit * 8 width: root.compactMode ? Kirigami.Units.gridUnit * 6.4 : Kirigami.Units.gridUnit * 8
height: Kirigami.Units.gridUnit * 5 height: root.compactMode ? Kirigami.Units.gridUnit * 4.2 : Kirigami.Units.gridUnit * 5
readonly property var modelIndex: tasks.makeModelIndex(index) readonly property var modelIndex: tasks.makeModelIndex(index)
readonly property bool isCurrent: ListView.isCurrentItem && taskList.activeFocus readonly property bool isCurrent: ListView.isCurrentItem && taskList.activeFocus