Compare commits
3 Commits
b7ea18c751
...
3a98bc08e9
| Author | SHA1 | Date | |
|---|---|---|---|
|
3a98bc08e9
|
|||
|
f6796f3726
|
|||
|
6655c9c500
|
@@ -52,6 +52,12 @@ Singleton {
|
|||||||
// poll interval in seconds
|
// poll interval in seconds
|
||||||
readonly property int interval: 1
|
readonly property int interval: 1
|
||||||
|
|
||||||
|
// cpuFreq comes from /proc/cpuinfo, which the kernel regenerates in full on
|
||||||
|
// every read (cost grows with core count) — the priciest per-tick read here.
|
||||||
|
// Frequency on a status bar doesn't need 1 Hz precision, so only refresh it
|
||||||
|
// every Nth tick instead of on the CPU%/mem hot path.
|
||||||
|
readonly property int freqEveryTicks: 3
|
||||||
|
|
||||||
// discovered sysfs paths (filled once by discover.sh)
|
// discovered sysfs paths (filled once by discover.sh)
|
||||||
property string tempPath: ""
|
property string tempPath: ""
|
||||||
property string batPath: ""
|
property string batPath: ""
|
||||||
@@ -271,15 +277,17 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _tickOnce() {
|
function _tickOnce() {
|
||||||
|
const doFreq = root._tick % root.freqEveryTicks === 0;
|
||||||
|
|
||||||
statView.reload();
|
statView.reload();
|
||||||
cpuInfoView.reload();
|
if (doFreq) cpuInfoView.reload();
|
||||||
memView.reload();
|
memView.reload();
|
||||||
routeView.reload();
|
routeView.reload();
|
||||||
if (root.tempPath) tempView.reload();
|
if (root.tempPath) tempView.reload();
|
||||||
if (root.batPath) { batCapView.reload(); batStatusView.reload(); }
|
if (root.batPath) { batCapView.reload(); batStatusView.reload(); }
|
||||||
|
|
||||||
_parseCpu();
|
_parseCpu();
|
||||||
_parseFreq();
|
if (doFreq) _parseFreq();
|
||||||
_parseMem();
|
_parseMem();
|
||||||
_parseTemp();
|
_parseTemp();
|
||||||
_parseBattery();
|
_parseBattery();
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
//@ pragma UseQApplication
|
//@ pragma UseQApplication
|
||||||
|
// Required: Quickshell renders the system-tray context menu (right-click in
|
||||||
|
// Tray.qml -> item.display()) via QtWidgets' QMenu. Dropping this loads the
|
||||||
|
// lighter QGuiApplication but breaks tray menus. Verified 2026-06-08.
|
||||||
|
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import "widgets"
|
import "widgets"
|
||||||
|
|||||||
@@ -29,7 +29,20 @@ PanelWindow {
|
|||||||
left: true
|
left: true
|
||||||
right: true
|
right: true
|
||||||
}
|
}
|
||||||
implicitHeight: Theme.barHeight
|
|
||||||
|
// Wrap onto two rows when a single row can't hold everything (portrait
|
||||||
|
// outputs). Needed width is computed from implicit sizes, which don't
|
||||||
|
// depend on which row anything sits in, so this can't bind-loop.
|
||||||
|
readonly property real neededWidth:
|
||||||
|
(Theme.gap + 2) * 2 // outer margins
|
||||||
|
+ workspaces.implicitWidth
|
||||||
|
+ Theme.gap * 4 // breathing room between clusters
|
||||||
|
+ metricsRow.implicitWidth
|
||||||
|
+ Theme.gap
|
||||||
|
+ endRow.implicitWidth
|
||||||
|
readonly property bool twoRows: width > 0 && neededWidth > width
|
||||||
|
|
||||||
|
implicitHeight: twoRows ? Theme.barHeight * 2 : Theme.barHeight
|
||||||
|
|
||||||
// background strip
|
// background strip
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@@ -37,19 +50,35 @@ PanelWindow {
|
|||||||
color: Theme.barColor
|
color: Theme.barColor
|
||||||
}
|
}
|
||||||
|
|
||||||
// left: workspaces
|
// row 1 left: workspaces
|
||||||
Workspaces {
|
Workspaces {
|
||||||
|
id: workspaces
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.leftMargin: Theme.gap + 2
|
anchors.leftMargin: Theme.gap + 2
|
||||||
|
y: (Theme.barHeight - height) / 2
|
||||||
screen: panel.modelData
|
screen: panel.modelData
|
||||||
}
|
}
|
||||||
|
|
||||||
// right: battery, system metrics, volume, clock, tray
|
// row 1 right: clock, tray
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
id: endRow
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.rightMargin: Theme.gap + 2
|
anchors.rightMargin: Theme.gap + 2
|
||||||
|
y: (Theme.barHeight - height) / 2
|
||||||
|
spacing: Theme.gap
|
||||||
|
|
||||||
|
Clock {}
|
||||||
|
Tray { panelWindow: panel }
|
||||||
|
}
|
||||||
|
|
||||||
|
// metrics: left of the clock in one-row mode, own second row when narrow
|
||||||
|
RowLayout {
|
||||||
|
id: metricsRow
|
||||||
|
anchors.right: panel.twoRows ? parent.right : endRow.left
|
||||||
|
anchors.rightMargin: panel.twoRows ? Theme.gap + 2 : Theme.gap
|
||||||
|
y: panel.twoRows
|
||||||
|
? Theme.barHeight + (Theme.barHeight - height) / 2
|
||||||
|
: (Theme.barHeight - height) / 2
|
||||||
spacing: Theme.gap
|
spacing: Theme.gap
|
||||||
|
|
||||||
Battery {}
|
Battery {}
|
||||||
@@ -59,7 +88,5 @@ PanelWindow {
|
|||||||
Disk {}
|
Disk {}
|
||||||
Network {}
|
Network {}
|
||||||
Volume {}
|
Volume {}
|
||||||
Clock {}
|
|
||||||
Tray { panelWindow: panel }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user