Commit ee493c63 authored by Nate Graham's avatar Nate Graham
Browse files

applets/systemtray: add adjustable spacing, and change it in Tablet Mode

Over the years we've changed icon spacing many times. And every time we
do, we get bug reports about it from people who were happier with the
previous value. Typically we close these bug reports as RESOLVED
INTENTIONAL, but it always leaves a sour taste in the mouth. People's
preferences for spacings and paddings are legitimate.

In addition, a larger spacing can be quite useful in Tablet Mode, to
increase the size of the touch targets to be closer to the size of the
user's finger.

This commit adds a simple UI to switch the spacings of the visible items
between three values, with the middle one that matches the current
spacing being the default. While Tablet Mode is activated, the spacing is
automatically set to its highest value and made non-user-adjustable,
just like we already do this for the icon size setting.
parent 4f285e5d
......@@ -29,6 +29,10 @@
<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="iconSpacing" type="int">
<label>spacing between icons, determined by this number multiplied by PlasmaCore.Units.smallSpacing</label>
<entry name="pin" type="Bool">
<label>Whether the popup should remain open when another window is activated</label>
......@@ -13,6 +13,7 @@ import org.kde.kirigami 2.13 as Kirigami
ColumnLayout {
property bool cfg_scaleIconsToFit
property int cfg_iconSpacing
Kirigami.FormLayout {
Layout.fillHeight: true
......@@ -37,5 +38,48 @@ ColumnLayout {
text: i18n("Automatically enabled when in tablet mode")
font: PlasmaCore.Theme.smallestFont
Item {
Kirigami.FormData.isSection: true
QQC2.ComboBox {
Kirigami.FormData.label: i18nc("The spacing between system tray icons in the Panel", "Panel icon spacing:")
model: [
"label": i18n("Small"),
"spacing": 1
"label": i18n("Normal"),
"spacing": 2
"label": i18n("Large"),
"spacing": 4
textRole: "label"
enabled: !Kirigami.Settings.tabletMode
currentIndex: {
if (Kirigami.Settings.tabletMode) {
return 2 // Normal
switch (cfg_iconSpacing) {
case 1: return 0; // Small
case 2: return 1; // Normal
case 4: return 2; // Large
onActivated: cfg_iconSpacing = model[currentIndex]["spacing"];
QQC2.Label {
visible: Kirigami.Settings.tabletMode
text: i18n("Automatically set to Large when in tablet mode")
font: PlasmaCore.Theme.smallestFont
......@@ -121,8 +121,9 @@ MouseArea {
readonly property int rowsOrColumns: autoSize ? 1 : Math.max(1, Math.min(count, Math.floor(gridThickness / (smallIconSize + PlasmaCore.Units.smallSpacing))))
// Add margins only if the panel is larger than a small icon (to avoid large gaps between tiny icons)
readonly property int cellSpacing: PlasmaCore.Units.smallSpacing * 2
readonly property int cellSpacing: PlasmaCore.Units.smallSpacing * (Kirigami.Settings.tabletMode ? 4 : plasmoid.configuration.iconSpacing)
readonly property int smallSizeCellLength: gridThickness < smallIconSize ? smallIconSize : smallIconSize + cellSpacing
cellHeight: {
if (root.vertical) {
return autoSize ? itemSize + (gridThickness < itemSize ? 0 : cellSpacing) : smallSizeCellLength
Supports Markdown
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