A second shell chrome under dotfiles/quickshell/hyprchrome, built around a BarPanel that carries TWO renderings of its data: the default children are the expanded detail view, `summary` the terse one shown while collapsed. Both stay bound to the same sources, so the densities cannot disagree, and the panel cross-fades between them while its height animates. Panels: HostPanel (hostname, user, timezone, clock), VitalsPanel (CPU load and temperature, memory, GPU load and temperature, all metered), TrayPanel (system tray, self-sizing). HyprChromeBar pins them to DP-2 and owns `expanded` for the whole rail — SUPER A, via GlobalShortcut "chrome". GPU busy comes off sysfs rather than the node_exporter scrape VitalsData already does: the hwmon collector carries the card's temps, power and clocks but not its utilisation. The bar's height binds to each panel's `targetHeight` — where it will settle, not where the animation currently is — because the exclusive zone is window-sized by default, and binding to the animated height relayouts every tiled window on the output twelve times per toggle. The zone follows the target immediately so the desktop reflows once, at the start; the surface itself shrinks only after the panels finish, or it would clip them mid-animation. DebugWindow stages a widget in the middle of the secondary monitor (SUPER CTRL D), masked so only the staged widget takes pointer input. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HEtXvseVb5gwAtKNhFx2PU
73 lines
2.2 KiB
QML
73 lines
2.2 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import Quickshell
|
|
import Quickshell.Services.SystemTray
|
|
import QtQuick
|
|
import QtQuick.Shapes
|
|
import qs.hyprchrome.theme
|
|
|
|
// One tray item as a chamfered cell. Declares `modelData` required so it can be
|
|
// a Repeater delegate directly, without an Item wrapper in between.
|
|
//
|
|
// Left click activates, right click opens the item's own menu — anchored under
|
|
// the cell rather than at the window edge, since this rail sits along the top.
|
|
MouseArea {
|
|
id: cell
|
|
|
|
required property SystemTrayItem modelData
|
|
|
|
property int iconSize: 18
|
|
property int chamfer: 4
|
|
|
|
implicitWidth: cell.iconSize + 8
|
|
implicitHeight: cell.iconSize + 8
|
|
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
hoverEnabled: true
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
onClicked: event => {
|
|
if (event.button === Qt.LeftButton) {
|
|
cell.modelData.activate();
|
|
} else if (cell.modelData.hasMenu) {
|
|
const window = cell.QsWindow?.window;
|
|
if (window) {
|
|
const anchor = cell.mapToItem(null, 0, cell.height);
|
|
cell.modelData.display(window, anchor.x, anchor.y);
|
|
}
|
|
}
|
|
event.accepted = true;
|
|
}
|
|
|
|
Shape {
|
|
anchors.fill: parent
|
|
preferredRendererType: Shape.CurveRenderer
|
|
|
|
ShapePath {
|
|
strokeWidth: 1
|
|
strokeColor: cell.containsMouse ? Theme.accent : Theme.textAlpha(0.18)
|
|
fillColor: cell.containsMouse ? Theme.selection : Theme.textAlpha(0.06)
|
|
|
|
startX: cell.chamfer
|
|
startY: 0
|
|
PathLine { x: cell.width; y: 0 }
|
|
PathLine { x: cell.width; y: cell.height - cell.chamfer }
|
|
PathLine { x: cell.width - cell.chamfer; y: cell.height }
|
|
PathLine { x: 0; y: cell.height }
|
|
PathLine { x: 0; y: cell.chamfer }
|
|
PathLine { x: cell.chamfer; y: 0 }
|
|
|
|
Behavior on strokeColor { ColorAnimation { duration: 150 } }
|
|
}
|
|
}
|
|
|
|
Image {
|
|
anchors.centerIn: parent
|
|
source: cell.modelData.icon
|
|
width: cell.iconSize
|
|
height: cell.iconSize
|
|
fillMode: Image.PreserveAspectFit
|
|
smooth: true
|
|
}
|
|
}
|