Refine shell panel and lock theming

This commit is contained in:
David Heinemeier Hansson
2026-06-03 22:14:48 +02:00
parent 3cdfb52a74
commit 79470dde92
9 changed files with 203 additions and 33 deletions
+11 -6
View File
@@ -14,11 +14,9 @@ import qs.Commons
// their parent surface — so keyboard-summoned popups fell flat without it.
//
// API is a subset of Common.PopupCard: anchorItem, owner, bar, open,
// padding, margin, contentWidth/Height, default contentItem. Missing on
// purpose (for now): centerOnBar, triggerMode ("hover"), containsMouse.
// Hover-mode popups (system-stats, weather) and centered popups
// (calendar week-view) need extra plumbing before migrating; converting
// them is a follow-up.
// padding, margin, contentWidth/Height, centerOnBar, default contentItem.
// Missing on purpose (for now): triggerMode ("hover"), containsMouse.
// Hover-mode popups (system-stats) need extra plumbing before migrating.
//
// Positioning: full-screen layer-shell with the card placed inside at
// `cardOrigin`. We use the bar window's height/width for the perpendicular
@@ -42,6 +40,7 @@ PanelWindow {
property int padding: Style.spacing.popupPadding
property int contentWidth: Style.space(280)
property int contentHeight: Style.space(200)
property bool centerOnBar: false
property bool open: false
property int gap: Style.gapsOut // distance between bar edge and panel
property bool popoutSwitching: false
@@ -173,7 +172,13 @@ PanelWindow {
readonly property point cardOrigin: {
if (!anchorItem || !bar) return Qt.point(margin, margin)
var x = 0, y = 0
if (barPos === "bottom") {
if (centerOnBar && (barPos === "top" || barPos === "bottom")) {
x = screenW / 2 - contentWidth / 2
y = barPos === "bottom" ? screenH - barH - contentHeight - gap : barH + gap
} else if (centerOnBar) {
x = barPos === "left" ? barW + gap : screenW - barW - contentWidth - gap
y = screenH / 2 - contentHeight / 2
} else if (barPos === "bottom") {
x = anchorScreenPos.x + anchorW / 2 - contentWidth / 2
y = screenH - barH - contentHeight - gap
} else if (barPos === "left") {
+22 -9
View File
@@ -40,6 +40,8 @@ Item {
property bool useTransparentForeground: false
property bool transparent: false
property bool centerSectionHovered: false
property bool centerSectionRevealHeld: false
property bool centerHoverRevealSuppressed: false
property int barConfigSerial: 0
property string position: "top"
// Resolves through fontconfig at paint time (Style.font.family defaults
@@ -374,6 +376,22 @@ Item {
Component.onCompleted: applyBarConfig()
function setCenterSectionHovered(hovered) {
centerSectionHovered = hovered
if (hovered) {
centerSectionRevealTimer.stop()
centerSectionRevealHeld = true
} else {
centerSectionRevealTimer.restart()
}
}
Timer {
id: centerSectionRevealTimer
interval: 120
onTriggered: root.centerSectionRevealHeld = root.centerSectionHovered
}
function run(command) {
if (!command) return
@@ -970,7 +988,7 @@ Item {
CenterGestureArea { anchors.fill: parent }
HoverHandler {
onHoveredChanged: root.centerSectionHovered = hovered
onHoveredChanged: root.setCenterSectionHovered(hovered)
}
ModuleList {
@@ -1001,7 +1019,7 @@ Item {
visible: centerRoot.hasAnchor && centerAnchorModule.moduleName === "omarchy.clock"
clockHovered: centerAnchorModule.hovered
centerHovered: root.centerSectionHovered
centerHovered: root.centerSectionRevealHeld && !root.centerHoverRevealSuppressed
anchors.right: centerAnchorModule.left
anchors.verticalCenter: centerAnchorModule.verticalCenter
}
@@ -1025,7 +1043,7 @@ Item {
CenterGestureArea { anchors.fill: parent }
HoverHandler {
onHoveredChanged: root.centerSectionHovered = hovered
onHoveredChanged: root.setCenterSectionHovered(hovered)
}
ModuleList {
@@ -1056,7 +1074,7 @@ Item {
visible: centerRoot.hasAnchor && centerAnchorModule.moduleName === "omarchy.clock"
clockHovered: centerAnchorModule.hovered
centerHovered: root.centerSectionHovered
centerHovered: root.centerSectionRevealHeld && !root.centerHoverRevealSuppressed
anchors.bottom: centerAnchorModule.top
anchors.horizontalCenter: centerAnchorModule.horizontalCenter
}
@@ -1098,13 +1116,8 @@ Item {
implicitHeight: button.implicitHeight
width: implicitWidth
height: implicitHeight
opacity: revealed ? 1.0 : 0
z: 500
Behavior on opacity {
NumberAnimation { duration: 120; easing.type: Easing.OutCubic }
}
HoverHandler { id: controlHover }
Component.onCompleted: root.registerConfigControl(configControl)
+1 -1
View File
@@ -17,7 +17,7 @@ BarWidget {
property bool indicatorAreaHovered: false
property bool indicatorItemHovered: false
readonly property bool alwaysShowIndicators: setting("alwaysShow", false) === true
readonly property bool revealInactiveIndicators: alwaysShowIndicators || indicatorAreaHovered || indicatorItemHovered || (bar && bar.centerSectionHovered === true)
readonly property bool revealInactiveIndicators: alwaysShowIndicators || indicatorAreaHovered || indicatorItemHovered || (bar && bar.centerSectionRevealHeld === true && bar.centerHoverRevealSuppressed !== true)
signal refreshRequested()
+1 -1
View File
@@ -28,7 +28,7 @@ Item {
readonly property bool errorState: failureMessage.length > 0
readonly property var inputBorderSpec: errorState
? Border.surfaceSpec("lock", "border-error", Color.lock.borderError, root.outlineThickness, "border-alpha")
: Border.hyprlandActiveSpec(Color.accent, root.outlineThickness)
: Border.surfaceSpec("lock", "border-active", Color.lock.borderActive, root.outlineThickness, "border-alpha")
signal submitPassword(string password)
signal passwordTextEdited(string password)
+54 -16
View File
@@ -9,17 +9,38 @@ Panel {
id: root
moduleName: "omarchy.weather"
ipcTarget: "omarchy.weather"
manageIpc: false
property var anchorItem: null
property bool openedFromHotkey: false
function open() {
openedFromHotkey = false
setCenterHoverRevealSuppressed(false)
root.controller.show()
root.refresh()
}
function openFromHotkey() {
openedFromHotkey = true
setCenterHoverRevealSuppressed(true)
root.controller.show()
root.refresh()
}
function close() {
setCenterHoverRevealSuppressed(false)
root.controller.hide()
}
function toggle() {
if (root.opened) root.close()
else root.open()
else root.openFromHotkey()
}
function setCenterHoverRevealSuppressed(value) {
if (root.bar && "centerHoverRevealSuppressed" in root.bar)
root.bar.centerHoverRevealSuppressed = value
}
// Parsed wttr.in j1 response. Kept on failure so stale data stays visible.
@@ -190,29 +211,45 @@ Panel {
onTriggered: root.refresh()
}
PopupCard {
id: popup
IpcHandler {
target: root.ipcTarget
function open(): void { root.openFromHotkey() }
function close(): void { root.close() }
function show(): void { root.openFromHotkey() }
function hide(): void { root.close() }
function toggle(): void { root.toggle() }
}
KeyboardPanel {
id: panel
anchorItem: root.anchorItem
owner: root
bar: root.bar
open: root.opened
centerOnBar: true
triggerMode: "click"
contentWidth: popup.fittedContentWidth(Style.space(480))
contentHeight: popup.fittedContentHeight(weatherColumn.implicitHeight)
focusTarget: keyCatcher
contentWidth: panel.fittedContentWidth(Style.space(480))
contentHeight: panel.fittedContentHeight(weatherColumn.implicitHeight)
Flickable {
id: weatherScroll
PanelKeyCatcher {
id: keyCatcher
anchors.fill: parent
contentWidth: width
contentHeight: weatherColumn.implicitHeight
clip: true
boundsBehavior: Flickable.StopAtBounds
onCloseRequested: root.close()
onTabRequested: function(direction) { root.switchPanel(direction) }
Column {
id: weatherColumn
width: weatherScroll.width
spacing: Style.space(14)
Flickable {
id: weatherScroll
anchors.fill: parent
contentWidth: width
contentHeight: weatherColumn.implicitHeight
clip: true
boundsBehavior: Flickable.StopAtBounds
Column {
id: weatherColumn
width: weatherScroll.width
spacing: Style.space(14)
// ---- Hero row: big icon + temp on the left; location and stats stacked on the right.
Item {
@@ -431,6 +468,7 @@ Panel {
}
}
}
}
// Poll the weather pill text/class every minute. Local to this widget.
Process {