Commit 394b0ca0 authored by Nate Graham's avatar Nate Graham 💤
Browse files

[applets/systemtray] Return to pre-5.20 default panel icon arrangement

After much much much VDG discussion, it turned out that we don't
actually want to make the System Tray icons scale with the panel. We
returned to that with 31c7ebe3, but one
element remained: to make the icons automatically become a
two/row/column layout for thick panels, as we had for Plasma 5.19 and
earlier. This commit does that, and in the process simplifies the
configuration UI to show only the two options that we decided make sense:

1. Small icons that become two-row/column for thick panels
2. Auto-sizing icons that match the size of other panel widgets

Number one returns to being the default as it was before, and number two
is available for people/themes that want all icons to match in size.
parent b8debcbc
......@@ -25,14 +25,10 @@
<entry name="knownItems" type="StringList" hidden="true">
<entry name="automaticRowsOrColumns" type="bool">
<label>Whether to automatically increase the number of rows or columns of icons in response to Panel thickness.</label>
<entry name="scaleIconsToFit" type="bool">
<label>Whether to automatically scale System Tray icons to fix the available thickness of the panel. If false, tray icons will be capped at the smallMedium size (22px) and become a two-row/column layout when the panel is thick.</label>
<entry name="rowsOrColumns" type="Int">
<label>Number of rows or columns of small icons to show in the panel view (depending on whether the panel is horizontal or vertical, respectively) when not using automatic row/column determination.</label>
<entry name="pin" type="Bool">
<label>Whether the popup should remain open when another window is activated</label>
......@@ -27,39 +27,23 @@ import org.kde.plasma.core 2.1 as PlasmaCore
import org.kde.kirigami 2.13 as Kirigami
ColumnLayout {
property alias cfg_automaticRowsOrColumns: automaticRadioButton.checked
property int cfg_rowsOrColumns
Kirigami.InlineMessage {
readonly property int minimumSize: units.iconSizes.small * 2
Layout.fillWidth: true
visible: twoRowsOrColumnsRadioButton.checked && (plasmoid.width <= minimumSize || plasmoid.height <= minimumSize)
type: Kirigami.MessageType.Warning
text: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? i18n("This layout may look odd with a short panel.") : i18n("This layout may look odd with a narrow panel.")
property bool cfg_scaleIconsToFit
Kirigami.FormLayout {
Layout.fillHeight: true
QQC2.RadioButton {
id: automaticRadioButton
Kirigami.FormData.label: i18nc("The arrangement of system tray icons in the Panel", "Panel icon arrangement:")
text: plasmoid.formFactor === PlasmaCore.Types.Horizontal ?
i18n("Adapt to Panel height") : i18n("Adapt to Panel width")
QQC2.RadioButton {
text: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? i18n("One row of small icons") : i18n("One column of small icons")
checked: !automaticRadioButton.checked && cfg_rowsOrColumns === 1
onClicked: cfg_rowsOrColumns = 1
Kirigami.FormData.label: i18nc("The arrangement of system tray icons in the Panel", "Panel icon size:")
text: i18n("Small")
checked: cfg_scaleIconsToFit == false
onToggled: cfg_scaleIconsToFit = !checked
QQC2.RadioButton {
id: twoRowsOrColumnsRadioButton
text: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? i18n("Two rows of small icons") : i18n("Two columns of small icons")
checked: !automaticRadioButton.checked && cfg_rowsOrColumns === 2
onClicked: cfg_rowsOrColumns = 2
id: automaticRadioButton
text: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? i18n("Scale with Panel height")
: i18n("Scale with Panel width")
checked: cfg_scaleIconsToFit == true
onToggled: cfg_scaleIconsToFit = checked
......@@ -38,7 +38,7 @@ MouseArea {
LayoutMirroring.enabled: !vertical && Qt.application.layoutDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true
// The icon size to display when not using the default auto-scaling setting
// The icon size to display when not using the auto-scaling setting
readonly property int smallIconSize: units.iconSizes.smallMedium
// Used only by AbstractItem, but it's easiest to keep it here since it
......@@ -47,19 +47,9 @@ MouseArea {
// The rest are derived properties; do not modify
readonly property bool vertical: plasmoid.formFactor === PlasmaCore.Types.Vertical
readonly property bool autoSize: plasmoid.configuration.automaticRowsOrColumns
readonly property bool autoSize: plasmoid.configuration.scaleIconsToFit
readonly property int cellThickness: root.vertical ? root.width : root.height
readonly property int rowsOrColumns: {
if (autoSize) {
if (cellThickness <= smallIconSize * 2) {
return 1
} else {
return 2
} else {
return plasmoid.configuration.rowsOrColumns
readonly property int rowsOrColumns: autoSize || cellThickness <= smallIconSize * 2 ? 1 : 2
property alias expanded: dialog.visible
property Item activeApplet
property alias visibleLayout: tasksGrid
......@@ -158,8 +148,8 @@ MouseArea {
GridView {
id: tasksGrid
readonly property int autoSizeCellLength: root.cellThickness / root.rowsOrColumns
readonly property int smallSizeCellLength: root.smallIconSize + units.smallSpacing * 2
readonly property int autoSizeCellLength: root.cellThickness / root.rowsOrColumns
readonly property int totalLength: root.vertical ? cellHeight * Math.round(count / root.rowsOrColumns)
: cellWidth * Math.round(count / root.rowsOrColumns)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment