Tighten compact status icon spacing
This commit is contained in:
@@ -344,6 +344,7 @@ QtObject {
|
|||||||
readonly property int iconSlot: root.barToken("icon-slot", 27)
|
readonly property int iconSlot: root.barToken("icon-slot", 27)
|
||||||
readonly property int iconCanvas: root.barToken("icon-canvas", 16)
|
readonly property int iconCanvas: root.barToken("icon-canvas", 16)
|
||||||
readonly property int iconFont: root.barToken("icon-font", 13)
|
readonly property int iconFont: root.barToken("icon-font", 13)
|
||||||
|
readonly property int statusSlot: root.barToken("status-slot", 18)
|
||||||
}
|
}
|
||||||
|
|
||||||
function refresh() {
|
function refresh() {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ WidgetButton {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
property Component iconComponent: null
|
property Component iconComponent: null
|
||||||
|
property real slotSize: Style.bar.iconSlot
|
||||||
property real opticalSize: Style.bar.iconCanvas
|
property real opticalSize: Style.bar.iconCanvas
|
||||||
property bool debugOpticalBounds: Quickshell.env("OMARCHY_DEBUG_BAR_ICONS") === "1"
|
property bool debugOpticalBounds: Quickshell.env("OMARCHY_DEBUG_BAR_ICONS") === "1"
|
||||||
readonly property real opticalCenterErrorX: glyph.visible ? glyph.paintedCenterX - opticalCanvas.width / 2 : 0
|
readonly property real opticalCenterErrorX: glyph.visible ? glyph.paintedCenterX - opticalCanvas.width / 2 : 0
|
||||||
@@ -15,8 +16,8 @@ WidgetButton {
|
|||||||
labelVisible: false
|
labelVisible: false
|
||||||
hasVisualContent: text !== "" || iconComponent !== null
|
hasVisualContent: text !== "" || iconComponent !== null
|
||||||
fontSize: Style.bar.iconFont
|
fontSize: Style.bar.iconFont
|
||||||
fixedWidth: vertical ? -1 : Style.bar.iconSlot
|
fixedWidth: vertical ? -1 : slotSize
|
||||||
fixedHeight: vertical ? Style.bar.iconSlot : -1
|
fixedHeight: vertical ? slotSize : -1
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: opticalCanvas
|
id: opticalCanvas
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ BarWidget {
|
|||||||
property bool indicatorItemHovered: false
|
property bool indicatorItemHovered: false
|
||||||
readonly property bool alwaysShowIndicators: setting("alwaysShow", false) === true
|
readonly property bool alwaysShowIndicators: setting("alwaysShow", false) === true
|
||||||
readonly property bool revealInactiveIndicators: alwaysShowIndicators || indicatorAreaHovered || indicatorItemHovered || (bar && bar.centerSectionRevealHeld === true && bar.centerHoverRevealSuppressed !== true)
|
readonly property bool revealInactiveIndicators: alwaysShowIndicators || indicatorAreaHovered || indicatorItemHovered || (bar && bar.centerSectionRevealHeld === true && bar.centerHoverRevealSuppressed !== true)
|
||||||
readonly property bool hasVisibleIndicators: activeIndicatorIds.length > 0 || revealInactiveIndicators
|
|
||||||
|
|
||||||
signal refreshRequested()
|
signal refreshRequested()
|
||||||
|
|
||||||
@@ -188,8 +187,6 @@ BarWidget {
|
|||||||
|
|
||||||
visible: !root.vertical
|
visible: !root.vertical
|
||||||
spacing: 0
|
spacing: 0
|
||||||
leftPadding: root.hasVisibleIndicators ? Style.spacing.sm : 0
|
|
||||||
rightPadding: leftPadding
|
|
||||||
|
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
onHoveredChanged: root.setIndicatorAreaHovered(hovered)
|
onHoveredChanged: root.setIndicatorAreaHovered(hovered)
|
||||||
@@ -232,8 +229,6 @@ BarWidget {
|
|||||||
|
|
||||||
visible: root.vertical
|
visible: root.vertical
|
||||||
spacing: 0
|
spacing: 0
|
||||||
topPadding: root.hasVisibleIndicators ? Style.spaceReal(1.5) : 0
|
|
||||||
bottomPadding: topPadding
|
|
||||||
|
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
onHoveredChanged: root.setIndicatorAreaHovered(hovered)
|
onHoveredChanged: root.setIndicatorAreaHovered(hovered)
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ BarWidget {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
bar: root.bar
|
bar: root.bar
|
||||||
text: "\uf021"
|
text: "\uf021"
|
||||||
|
slotSize: Style.bar.statusSlot
|
||||||
fontSize: Style.font.caption
|
fontSize: Style.font.caption
|
||||||
tooltipText: ""
|
tooltipText: ""
|
||||||
onPressed: root.runUpdate()
|
onPressed: root.runUpdate()
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ BarWidget {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
bar: root.bar
|
bar: root.bar
|
||||||
text: panelLoader.item ? panelLoader.item.label : ""
|
text: panelLoader.item ? panelLoader.item.label : ""
|
||||||
|
slotSize: Style.bar.statusSlot
|
||||||
active: panelLoader.item && panelLoader.item.klass === "active"
|
active: panelLoader.item && panelLoader.item.klass === "active"
|
||||||
// Tooltip suppressed because the panel is the detail view.
|
// Tooltip suppressed because the panel is the detail view.
|
||||||
tooltipText: ""
|
tooltipText: ""
|
||||||
|
|||||||
@@ -90,6 +90,11 @@ ShellRoot {
|
|||||||
fail("indicator groups do not retain compact internal spacing")
|
fail("indicator groups do not retain compact internal spacing")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (compactStatusIcon.implicitWidth !== Style.bar.statusSlot
|
||||||
|
|| compactVerticalStatusIcon.implicitHeight !== Style.bar.statusSlot) {
|
||||||
|
fail("compact status icons do not use the shared status slot")
|
||||||
|
return
|
||||||
|
}
|
||||||
console.log("RESULT pass")
|
console.log("RESULT pass")
|
||||||
Qt.quit()
|
Qt.quit()
|
||||||
})
|
})
|
||||||
@@ -133,6 +138,8 @@ ShellRoot {
|
|||||||
iconComponent: Component { Rectangle { width: 12; height: 12 } }
|
iconComponent: Component { Rectangle { width: 12; height: 12 } }
|
||||||
}
|
}
|
||||||
BarIconButton { id: verticalIcon; bar: verticalBar; text: "\uf021" }
|
BarIconButton { id: verticalIcon; bar: verticalBar; text: "\uf021" }
|
||||||
|
BarIconButton { id: compactStatusIcon; bar: testBar; text: "\uf021"; slotSize: Style.bar.statusSlot }
|
||||||
|
BarIconButton { id: compactVerticalStatusIcon; bar: verticalBar; text: "\uf021"; slotSize: Style.bar.statusSlot }
|
||||||
Row {
|
Row {
|
||||||
id: horizontalIndicatorPair
|
id: horizontalIndicatorPair
|
||||||
BarIndicator { id: horizontalIndicator; bar: testBar; active: true; activeText: "" }
|
BarIndicator { id: horizontalIndicator; bar: testBar; active: true; activeText: "" }
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ ShellRoot {
|
|||||||
if (verticalId === "omarchy.clock")
|
if (verticalId === "omarchy.clock")
|
||||||
root.assertEqual(verticalItem.implicitHeight, Style.bar.iconSlot * 3, verticalId + " uses one slot per line")
|
root.assertEqual(verticalItem.implicitHeight, Style.bar.iconSlot * 3, verticalId + " uses one slot per line")
|
||||||
else if (verticalId === "omarchy.weather" || verticalId === "omarchy.system-update")
|
else if (verticalId === "omarchy.weather" || verticalId === "omarchy.system-update")
|
||||||
root.assertEqual(verticalItem.implicitHeight, Style.bar.iconSlot, verticalId + " uses one vertical slot")
|
root.assertEqual(verticalItem.implicitHeight, Style.bar.statusSlot, verticalId + " uses one compact status slot")
|
||||||
if (verticalItem && typeof verticalItem.destroy === "function") verticalItem.destroy()
|
if (verticalItem && typeof verticalItem.destroy === "function") verticalItem.destroy()
|
||||||
}
|
}
|
||||||
root.assertTrue(root.createdIds.length === entries.length, "all bar widgets instantiate")
|
root.assertTrue(root.createdIds.length === entries.length, "all bar widgets instantiate")
|
||||||
|
|||||||
Reference in New Issue
Block a user