Skip to content

Commit 773616b

Browse files
committed
feat: make time to hide when idle configurable
1 parent 63570e9 commit 773616b

4 files changed

Lines changed: 28 additions & 3 deletions

File tree

package/contents/config/main.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@
7171
<entry name="hideWhenIdle" type="Bool">
7272
<default>false</default>
7373
</entry>
74+
<entry name="idleTimer" type="Int">
75+
<default>5</default>
76+
</entry>
7477
<entry name="visualizerStyle" type="Int">
7578
<default>1</default>
7679
</entry>

package/contents/ui/Cava.qml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ Item {
2424
property list<real> eq
2525
property list<int> values
2626
property bool idle
27+
property bool idleCheck
28+
property int idleTimer
2729
property bool hasError: error !== ""
2830
property string error
2931
property bool usingFallback: process.usingFallback
@@ -91,6 +93,9 @@ EOF
9193
output = output.slice(0, -1);
9294
}
9395
root.values = output.split(";").map(v => parseInt(v, 10));
96+
if (!root.idleCheck) {
97+
return;
98+
}
9499
if (root.values.find(v => v > 0)) {
95100
if (idleTimer.running) {
96101
idleTimer.stop();
@@ -105,7 +110,7 @@ EOF
105110

106111
Timer {
107112
id: idleTimer
108-
interval: 5000
113+
interval: root.idleTimer * 1000
109114
onTriggered: root.idle = true
110115
}
111116
}

package/contents/ui/configGeneral.qml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ KCM.SimpleKCM {
1414
property string cfg_barColors
1515
property string cfg_waveFillColors
1616
property alias cfg_debugMode: debugModeCheckbox.checked
17+
property alias cfg_idleTimer: idleTimerSpinbox.value
1718

1819
Kirigami.FormLayout {
1920
id: parentLayout
@@ -24,9 +25,23 @@ KCM.SimpleKCM {
2425
Kirigami.FormData.label: i18n("Debug mode:")
2526
}
2627

27-
CheckBox {
28-
id: hideWhenIdleCheckbox
28+
RowLayout {
2929
Kirigami.FormData.label: i18n("Auto-hide when idle:")
30+
CheckBox {
31+
id: hideWhenIdleCheckbox
32+
}
33+
Label {
34+
text: i18n("After")
35+
}
36+
SpinBox {
37+
id: idleTimerSpinbox
38+
enabled: hideWhenIdleCheckbox.checked
39+
from: 1
40+
to: 60
41+
}
42+
Label {
43+
text: i18n("seconds")
44+
}
3045
}
3146

3247
CheckBox {

package/contents/ui/main.qml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ PlasmoidItem {
5757
monoOption: Plasmoid.configuration.monoOption
5858
reverse: Plasmoid.configuration.reverse
5959
eq: Plasmoid.configuration.eq
60+
idleCheck: main.hideWhenIdle
61+
idleTimer: Plasmoid.configuration.idleTimer
6062
onIdleChanged: main.updateStatus()
6163
onHasErrorChanged: main.updateStatus()
6264
onRunningChanged: main.updateStatus()

0 commit comments

Comments
 (0)