Render Omarchy menu icon with Omarchy font

This commit is contained in:
David Heinemeier Hansson
2026-06-29 14:12:36 -05:00
parent 8732306820
commit 89615a526d
4 changed files with 18 additions and 7 deletions
+2 -1
View File
@@ -8,6 +8,7 @@
// calls provider_name() or a command named "name" to return JSON rows. // calls provider_name() or a command named "name" to return JSON rows.
// Optional fields: // Optional fields:
// aliases alternate `omarchy menu summon <name>` routes; also searchable // aliases alternate `omarchy menu summon <name>` routes; also searchable
// iconFont font family used for the icon glyph, when it differs from the menu font
// keywords extra search terms beyond id/label/aliases // keywords extra search terms beyond id/label/aliases
// when shell condition; hide row when it fails // when shell condition; hide row when it fails
// checked shell condition; append ✓ when it succeeds // checked shell condition; append ✓ when it succeeds
@@ -283,7 +284,7 @@
"remove.development.elixir.phoenix": {"icon":"","label":"Phoenix","action":"omarchy-launch-floating-terminal-with-presentation 'omarchy-remove-dev-env phoenix'"}, "remove.development.elixir.phoenix": {"icon":"","label":"Phoenix","action":"omarchy-launch-floating-terminal-with-presentation 'omarchy-remove-dev-env phoenix'"},
// Update // Update
"update.omarchy": {"icon":"","label":"Omarchy","keywords":"system","action":"omarchy-launch-floating-terminal-with-presentation omarchy-update"}, "update.omarchy": {"icon":"","iconFont":"omarchy","label":"Omarchy","keywords":"system","action":"omarchy-launch-floating-terminal-with-presentation omarchy-update"},
"update.channel": {"icon":"󰔫","label":"Channel","keywords":"stable rc dev edge source"}, "update.channel": {"icon":"󰔫","label":"Channel","keywords":"stable rc dev edge source"},
"update.config": {"icon":"","label":"Config","keywords":"refresh default"}, "update.config": {"icon":"","label":"Config","keywords":"refresh default"},
"update.themes": {"icon":"󰸌","label":"Extra Themes","action":"omarchy-launch-floating-terminal-with-presentation omarchy-theme-update"}, "update.themes": {"icon":"󰸌","label":"Extra Themes","action":"omarchy-launch-floating-terminal-with-presentation omarchy-theme-update"},
+3 -1
View File
@@ -410,6 +410,7 @@ Item {
itemId: "dmenu." + i, itemId: "dmenu." + i,
kind: "dmenu", kind: "dmenu",
icon: "", icon: "",
iconFont: "",
label: label, label: label,
target: "", target: "",
detail: "", detail: "",
@@ -932,6 +933,7 @@ Item {
required property string itemId required property string itemId
required property string kind required property string kind
required property string icon required property string icon
required property string iconFont
required property string label required property string label
required property string target required property string target
required property string detail required property string detail
@@ -964,7 +966,7 @@ Item {
visible: row.hasIcon visible: row.hasIcon
text: row.icon text: row.icon
color: row.hasCursor ? root.selectedText : root.foreground color: row.hasCursor ? root.selectedText : root.foreground
font.family: root.fontFamily font.family: row.iconFont.length > 0 ? row.iconFont : root.fontFamily
font.pixelSize: Style.font.iconLarge font.pixelSize: Style.font.iconLarge
width: Style.space(36) width: Style.space(36)
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
+3 -1
View File
@@ -38,6 +38,7 @@ function normalizeItem(id, raw) {
parent: parent, parent: parent,
kind: kind, kind: kind,
icon: value.icon || "", icon: value.icon || "",
iconFont: value.iconFont || "",
label: value.label || id, label: value.label || id,
target: value.target || "", target: value.target || "",
keywords: normalizeKeywords(id, aliases, value.keywords), keywords: normalizeKeywords(id, aliases, value.keywords),
@@ -95,7 +96,7 @@ function mergeMenuSources(defaultItems, userItems) {
} }
if (!nextItems.root) { if (!nextItems.root) {
nextItems.root = { id: "root", parent: "", kind: "menu", icon: "", label: "Go", target: "", keywords: "", description: "", aliases: [], when: "", checked: "", action: "", provider: "" } nextItems.root = { id: "root", parent: "", kind: "menu", icon: "", iconFont: "", label: "Go", target: "", keywords: "", description: "", aliases: [], when: "", checked: "", action: "", provider: "" }
nextOrder.unshift("root") nextOrder.unshift("root")
} }
for (var k3 = 0; k3 < nextOrder.length; k3++) nextItems[nextOrder[k3]].order = k3 for (var k3 = 0; k3 < nextOrder.length; k3++) nextItems[nextOrder[k3]].order = k3
@@ -253,6 +254,7 @@ function displayRow(items, itemOrder, checkedResults, entry, detail, score, sect
itemId: entry.id, itemId: entry.id,
kind: entry.kind, kind: entry.kind,
icon: entry.icon, icon: entry.icon,
iconFont: entry.iconFont || "",
label: labelFor(entry, checkedResults), label: labelFor(entry, checkedResults),
target: target, target: target,
detail: detail || "", detail: detail || "",
+10 -4
View File
@@ -34,6 +34,7 @@ assertDeepEqual(
parent: 'style', parent: 'style',
kind: 'action', kind: 'action',
icon: '', icon: '',
iconFont: '',
label: 'Themes', label: 'Themes',
target: '', target: '',
keywords: 'appearance colors', keywords: 'appearance colors',
@@ -76,6 +77,7 @@ assertDeepEqual(
itemId: 'style.theme', itemId: 'style.theme',
kind: 'action', kind: 'action',
icon: '', icon: '',
iconFont: '',
label: 'Theme picker', label: 'Theme picker',
target: 'style.theme', target: 'style.theme',
detail: 'Style', detail: 'Style',
@@ -92,12 +94,16 @@ assertDeepEqual(
const defaultItems = menu.parseMenuJsonc(defaultMenuJsonc) const defaultItems = menu.parseMenuJsonc(defaultMenuJsonc)
const defaultById = Object.fromEntries(defaultItems.map(item => [item.id, item])) const defaultById = Object.fromEntries(defaultItems.map(item => [item.id, item]))
assert( assert(
defaultById['update.omarchy'].icon === defaultById['learn.omarchy'].icon, defaultById['update.omarchy'].icon === '\ue900',
'menu update Omarchy entry uses the menu-font Omarchy icon' 'menu update Omarchy entry uses the Omarchy glyph'
) )
assert( assert(
!defaultMenuJsonc.includes('\ue900'), defaultById['update.omarchy'].iconFont === 'omarchy',
'menu entries do not use the private Omarchy bar-font glyph' 'menu update Omarchy entry renders the private glyph with the Omarchy font'
)
assert(
/font\.family: row\.iconFont\.length > 0 \? row\.iconFont : root\.fontFamily/.test(menuQml),
'menu rows support per-icon font families'
) )
assert( assert(