Align vertical bar widgets to the icon grid

This commit is contained in:
David Heinemeier Hansson
2026-07-17 16:03:49 -07:00
parent 0c8c4ea26a
commit 22791803ed
5 changed files with 75 additions and 15 deletions
+28
View File
@@ -65,6 +65,18 @@ ShellRoot {
fail("vector icon does not share glyph geometry")
return
}
if (verticalIcon.implicitWidth !== Style.bar.sizeVertical || verticalIcon.implicitHeight !== Style.bar.iconSlot) {
fail("vertical icon does not use the shared slot")
return
}
if (verticalIndicator.implicitWidth !== Style.bar.sizeVertical || verticalIndicator.implicitHeight !== Style.bar.iconSlot) {
fail("vertical indicator does not use the shared slot")
return
}
if (Math.abs(verticalIndicator.opticalCenterErrorX) > 0.5) {
fail("vertical indicator is not optically centered")
return
}
console.log("RESULT pass")
Qt.quit()
})
@@ -83,6 +95,20 @@ ShellRoot {
function showTooltip(target, text) {}
}
QtObject {
id: verticalBar
property bool vertical: true
property int barSize: Style.bar.sizeVertical
property string fontFamily: Style.font.family
property color barForeground: "white"
property color urgent: "red"
property bool foregroundAnimationEnabled: false
function registerClickTarget(target) {}
function unregisterClickTarget(target) {}
function hideTooltip(target) {}
function showTooltip(target, text) {}
}
BarIconButton { id: bluetooth; bar: testBar; text: "󰂯" }
BarIconButton { id: network; bar: testBar; text: "󰖩" }
BarIconButton { id: audio; bar: testBar; text: "󰖁" }
@@ -93,6 +119,8 @@ ShellRoot {
bar: testBar
iconComponent: Component { Rectangle { width: 12; height: 12 } }
}
BarIconButton { id: verticalIcon; bar: verticalBar; text: "\uf021" }
BarIndicator { id: verticalIndicator; bar: verticalBar; active: true; activeText: "󰅶" }
}
QML
@@ -1,5 +1,6 @@
import QtQuick
import Quickshell
import qs.Commons
ShellRoot {
id: root
@@ -167,10 +168,24 @@ ShellRoot {
var id = root.createdIds[j]
root.assertTrue(root.finiteDimension(item.implicitWidth), id + " has a finite implicitWidth")
root.assertTrue(root.finiteDimension(item.implicitHeight), id + " has a finite implicitHeight")
if (item && typeof item.destroy === "function") item.destroy()
}
root.assertTrue(root.createdIds.length === entries.length, "all bar widgets instantiate")
root.writeResult()
fakeBar.vertical = true
fakeBar.barSize = Style.bar.sizeVertical
Qt.callLater(function() {
for (var k = 0; k < root.createdObjects.length; k++) {
var verticalItem = root.createdObjects[k]
var verticalId = root.createdIds[k]
if (verticalId === "omarchy.clock")
root.assertEqual(verticalItem.implicitHeight, Style.bar.iconSlot * 3, verticalId + " uses one slot per line")
else if (verticalId === "omarchy.weather" || verticalId === "omarchy.system-update")
root.assertEqual(verticalItem.implicitHeight, Style.bar.iconSlot, verticalId + " uses one vertical slot")
if (verticalItem && typeof verticalItem.destroy === "function") verticalItem.destroy()
}
root.assertTrue(root.createdIds.length === entries.length, "all bar widgets instantiate")
root.writeResult()
})
})
}
}