rename bar module files and qmldir types to *Module
This commit is contained in:
parent
6461b9a943
commit
c3d7fa0bc5
24 changed files with 46 additions and 41 deletions
83
shell/modules/MemoryModule.qml
Normal file
83
shell/modules/MemoryModule.qml
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
import QtQuick
|
||||
import Quickshell
|
||||
import "." as M
|
||||
import "../services" as S
|
||||
import "../applets" as C
|
||||
|
||||
M.BarSection {
|
||||
id: root
|
||||
spacing: Math.max(1, S.Theme.moduleSpacing - 2)
|
||||
tooltip: ""
|
||||
|
||||
property int percent: S.SystemStats.memPercent
|
||||
property real usedGb: S.SystemStats.memUsedGb
|
||||
property real totalGb: S.SystemStats.memTotalGb
|
||||
property real availGb: S.SystemStats.memAvailGb
|
||||
property real cachedGb: S.SystemStats.memCachedGb
|
||||
property real buffersGb: S.SystemStats.memBuffersGb
|
||||
|
||||
property bool _pinned: false
|
||||
readonly property bool _anyHover: root._hovered || hoverPanel.panelHovered
|
||||
readonly property bool _showPanel: _anyHover || _pinned
|
||||
|
||||
property M.ProcessList _procs: M.ProcessList {
|
||||
sortBy: "mem"
|
||||
active: root._showPanel
|
||||
onProcessesChanged: hoverPanel.keepOpen(300)
|
||||
}
|
||||
|
||||
on_AnyHoverChanged: {
|
||||
if (_anyHover)
|
||||
_unpinTimer.stop();
|
||||
else if (_pinned)
|
||||
_unpinTimer.start();
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: _unpinTimer
|
||||
interval: 500
|
||||
onTriggered: root._pinned = false
|
||||
}
|
||||
|
||||
M.BarIcon {
|
||||
icon: "\uEFC5"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
TapHandler {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onTapped: root._pinned = !root._pinned
|
||||
}
|
||||
}
|
||||
M.BarLabel {
|
||||
label: root.percent + "%"
|
||||
minText: "100%"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
TapHandler {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onTapped: root._pinned = !root._pinned
|
||||
}
|
||||
}
|
||||
|
||||
M.HoverPanel {
|
||||
id: hoverPanel
|
||||
showPanel: root._showPanel
|
||||
screen: QsWindow.window?.screen ?? null
|
||||
anchorItem: root
|
||||
accentColor: root.accentColor
|
||||
panelNamespace: "nova-memory"
|
||||
panelTitle: "Memory"
|
||||
contentWidth: 240
|
||||
|
||||
C.MemoryApplet {
|
||||
width: hoverPanel.contentWidth
|
||||
percent: root.percent
|
||||
usedGb: root.usedGb
|
||||
totalGb: root.totalGb
|
||||
availGb: root.availGb
|
||||
cachedGb: root.cachedGb
|
||||
buffersGb: root.buffersGb
|
||||
processes: root._procs.processes
|
||||
accentColor: root.accentColor
|
||||
active: root._showPanel
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue