Skip to content

Commit cd693a8

Browse files
committed
feat: system tray icons custom cell width/height
1 parent 9e89dd2 commit cd693a8

3 files changed

Lines changed: 51 additions & 2 deletions

File tree

package/contents/ui/code/globals.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,8 @@ const defaultConfig = {
323323
needsAttention: baseTrayConfig,
324324
expanded: baseTrayConfig,
325325
wideTrayArrow: false,
326+
customCellSizeEnabled: false,
327+
customCellSize: 22,
326328
},
327329
nativePanel: {
328330
background: {

package/contents/ui/components/FormWidgetSettings.qml

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import QtQuick
22
import QtQuick.Controls
33
import QtQuick.Layouts
44
import org.kde.kirigami as Kirigami
5+
import org.kde.plasma.core as PlasmaCore
56
import org.kde.plasma.plasmoid
67
import "../code/enum.js" as Enum
78
import "../code/utils.js" as Utils
@@ -28,6 +29,13 @@ ColumnLayout {
2829

2930
property bool showFontConfig: elementName === "" || elementName === "widgets"
3031

32+
readonly property bool vertical: {
33+
if (Plasmoid.formFactor == PlasmaCore.Types.Vertical) {
34+
return true;
35+
}
36+
return false;
37+
}
38+
3139
property var fontsModel: {
3240
let arr = [];
3341
const fonts = Qt.fontFamilies();
@@ -250,9 +258,34 @@ ColumnLayout {
250258
}
251259
}
252260
Kirigami.ContextualHelpButton {
253-
toolTipText: i18n("Make the System Tray expand button be the same width as the other tray items")
261+
toolTipText: i18n("Make the System Tray expand button use the same size as the other tray items")
262+
}
263+
visible: elementName === "trayWidgets"
264+
}
265+
266+
RowLayout {
267+
visible: root.elementName === "trayWidgets"
268+
Kirigami.FormData.label: root.vertical ? i18n("Custom cell height:") : i18n("Custom cell width:")
269+
CheckBox {
270+
checked: root.config.trayWidgets.customCellSizeEnabled
271+
onCheckedChanged: {
272+
root.config.trayWidgets.customCellSizeEnabled = checked;
273+
root.updateConfig();
274+
}
275+
}
276+
277+
SpinBox {
278+
id: trayCellSize
279+
from: 20
280+
to: 64
281+
stepSize: 2
282+
value: root.config.trayWidgets.customCellSize
283+
onValueModified: {
284+
root.config.trayWidgets.customCellSize = value;
285+
root.updateConfig();
286+
}
287+
enabled: root.config.trayWidgets.customCellSizeEnabled
254288
}
255-
visible: elementName === "trayWidgets" && root.elementState === Enum.WidgetStates.Normal
256289
}
257290

258291
CheckBox {

package/contents/ui/main.qml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,20 @@ PlasmoidItem {
609609
switchPreset();
610610
}
611611

612+
Binding {
613+
target: main.trayGridView
614+
property: "cellWidth"
615+
value: main.trayWidgetSettings.customCellSize
616+
when: (main.trayWidgetSettings.customCellSizeEnabled ?? false) && main.horizontal
617+
}
618+
619+
Binding {
620+
target: main.trayGridView
621+
property: "cellHeight"
622+
value: main.trayWidgetSettings.customCellSize
623+
when: (main.trayWidgetSettings.customCellSizeEnabled ?? false) && !main.horizontal
624+
}
625+
612626
property Timer trayInitTimer: Timer {
613627
interval: 100
614628
onTriggered: {

0 commit comments

Comments
 (0)