Skip to content

Commit

Permalink
feat(config): add possibility for hide swap
Browse files Browse the repository at this point in the history
fix #3
  • Loading branch information
orblazer committed Oct 20, 2021
1 parent d59e178 commit 4f5ccd9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions package/contents/config/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
<entry name="memoryUseAllocated" type="Bool">
<default>false</default>
</entry>
<entry name="memorySwapGraph" type="Bool">
<default>true</default>
</entry>
<entry name="networkSensorInterface" type="String">
<default>enp3s0</default>
</entry>
Expand Down
6 changes: 6 additions & 0 deletions package/contents/ui/config/ConfigData.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import "../components"

Kirigami.FormLayout {
property alias cfg_memoryUseAllocated: memoryUseAllocated.checked
property alias cfg_memorySwapGraph: memorySwapGraph.checked
property alias cfg_networkSensorInterface: networkSensorInterface.text
property alias cfg_downloadMaxKBs: downloadMaxKBs.value
property alias cfg_uploadMaxKBs: uploadMaxKBs.value
Expand All @@ -22,6 +23,11 @@ Kirigami.FormLayout {
text: i18n('Use allocated memory instead of application')
}

QtControls.CheckBox {
id: memorySwapGraph
text: i18n('Display memory swap graph')
}

Item {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: i18n('Network')
Expand Down
7 changes: 6 additions & 1 deletion package/contents/ui/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Item {
property bool memoryInPercent: plasmoid.configuration.memoryInPercent
property bool showMemoryInPercent: memoryInPercent
property bool memoryUseAllocated: plasmoid.configuration.memoryUseAllocated
property bool showSwapGraph: plasmoid.configuration.memorySwapGraph
property bool showNetMonitor: plasmoid.configuration.showNetMonitor
property double fontScale: (plasmoid.configuration.fontScale / 100)
property int downloadMaxKBs: plasmoid.configuration.downloadMaxKBs
Expand Down Expand Up @@ -251,6 +252,10 @@ Item {
cpuMonitor.secondLineValueLabel.visible = showClock
}

onShowSwapGraphChanged: {
ramMonitor.secondLineValueLabel.visible = showSwapGraph
}

onShowMemoryInPercentChanged: {
allUsageProportionChanged()
}
Expand Down Expand Up @@ -281,7 +286,7 @@ Item {
visible: showRamMonitor
firstLineInfoText: 'RAM'
firstLineInfoTextColor: ramColor
secondLineInfoText: 'Swap'
secondLineInfoText: showSwapGraph ? 'Swap' : ''
secondLineInfoTextColor: swapColor
firstGraphModel: ramGraphModel
firstGraphBarColor: ramColor
Expand Down

0 comments on commit 4f5ccd9

Please sign in to comment.