From 6d759958fe26ab26e01ae0e2028aef0089e510d1 Mon Sep 17 00:00:00 2001 From: rosakodu Date: Thu, 20 Aug 2026 00:13:01 +0300 Subject: [PATCH 1/5] Add SVG country flags and configurable displayMode (flag, text, both) - Added a bundled vector SVG flags catalog under flags/ - Added displayMode setting in manifest.json and Panel.qml: * 'flag': crisp rounded SVG flag badge in the bar * 'text': standard 2-letter uppercase text abbreviation * 'both': SVG flag + text code - Added an interactive display mode switcher directly in the popup panel - Render mini flag badges next to layout names in the list view - Enhanced centered OSD switch indicator with flag preview - Passed all existing tests (37 backend + 12 QML contracts) --- Panel.qml | 220 ++++++++++++++++++++++++++++++++++++++++++++------ flags/am.svg | 5 ++ flags/by.svg | 6 ++ flags/ca.svg | 5 ++ flags/cn.svg | 4 + flags/de.svg | 5 ++ flags/ee.svg | 5 ++ flags/es.svg | 4 + flags/fi.svg | 5 ++ flags/fr.svg | 5 ++ flags/gb.svg | 7 ++ flags/ge.svg | 4 + flags/it.svg | 5 ++ flags/jp.svg | 4 + flags/kz.svg | 4 + flags/pl.svg | 4 + flags/ru.svg | 7 ++ flags/tr.svg | 5 ++ flags/ua.svg | 4 + flags/us.svg | 20 +++++ manifest.json | 7 ++ 21 files changed, 310 insertions(+), 25 deletions(-) create mode 100644 flags/am.svg create mode 100644 flags/by.svg create mode 100644 flags/ca.svg create mode 100644 flags/cn.svg create mode 100644 flags/de.svg create mode 100644 flags/ee.svg create mode 100644 flags/es.svg create mode 100644 flags/fi.svg create mode 100644 flags/fr.svg create mode 100644 flags/gb.svg create mode 100644 flags/ge.svg create mode 100644 flags/it.svg create mode 100644 flags/jp.svg create mode 100644 flags/kz.svg create mode 100644 flags/pl.svg create mode 100644 flags/ru.svg create mode 100644 flags/tr.svg create mode 100644 flags/ua.svg create mode 100644 flags/us.svg diff --git a/Panel.qml b/Panel.qml index 5e42cf0..8455188 100644 --- a/Panel.qml +++ b/Panel.qml @@ -76,6 +76,22 @@ Panel { return -1 } + readonly property string displayMode: String(root.setting("displayMode", "flag")) + + readonly property string activeCode: { + if (activeIndex >= 0) return String(layouts[activeIndex].code).toLowerCase() + var key = codesByName[String(activeKeymap)] + if (key) return String(key).replace(/\(.*$/, "").toLowerCase() + return fallbackAbbrev(activeKeymap).toLowerCase() + } + + function flagPathFor(code) { + if (!code) return "" + var c = String(code).toLowerCase().trim().replace(/[^a-z0-9_]/g, "") + if (c === "en") c = "us" + return Qt.resolvedUrl("flags/" + c + ".svg") + } + readonly property string barLabel: activeIndex >= 0 ? abbrevFor(layouts[activeIndex].code) : (activeKeymap !== "" ? fallbackAbbrev(activeKeymap) : "") @@ -439,30 +455,61 @@ Panel { id: button anchors.fill: parent bar: root.bar - text: root.barLabel + text: root.displayMode === "flag" ? " " : (root.displayMode === "both" ? " " + root.barLabel : root.barLabel) fontSize: Style.font.body - horizontalMargin: 7 + horizontalMargin: root.displayMode === "flag" ? 6 : 7 onPressed: function(buttonCode) { if (buttonCode === Qt.RightButton) root.cycleLayout() else root.toggle() } - // The stock label is 10px regular — too faint to read at a glance next to - // the bar's 13px icons. Hide it (it still sizes the slot) and paint the - // abbreviation bold at body size instead. labelVisible: false - Text { + Row { anchors.centerIn: parent - // Box-centering puts cap-height ink a hair above the optical center the - // bar icons sit on; one pixel down lines the label up with them. - anchors.verticalCenterOffset: 1 - text: root.barLabel - color: button.active && button.useActiveColor ? button.activeColor : button.foreground - font.family: root.fontFamily - font.pixelSize: Style.font.body - font.bold: true - renderType: Text.NativeRendering + anchors.verticalCenterOffset: 0 + spacing: Style.space(6) + + Rectangle { + id: flagBadge + visible: root.displayMode !== "text" && flagImg.status === Image.Ready + width: Style.space(19) + height: Style.space(13) + anchors.verticalCenter: parent.verticalCenter + radius: Style.space(2) + color: "transparent" + clip: true + + Image { + id: flagImg + anchors.fill: parent + source: root.flagPathFor(root.activeCode) + sourceSize.width: 38 + sourceSize.height: 26 + fillMode: Image.PreserveAspectCrop + smooth: true + } + + Rectangle { + anchors.fill: parent + radius: parent.radius + color: "transparent" + border.color: Qt.rgba(1, 1, 1, 0.18) + border.width: 1 + } + } + + Text { + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: 1 + visible: root.displayMode !== "flag" || flagImg.status !== Image.Ready + text: root.barLabel + color: button.active && button.useActiveColor ? button.activeColor : button.foreground + font.family: root.fontFamily + font.pixelSize: Style.font.body + font.bold: true + renderType: Text.NativeRendering + } } } @@ -558,9 +605,39 @@ Panel { } } + Rectangle { + id: rowFlagBadge + anchors.left: parent.left + anchors.leftMargin: Style.space(8) + anchors.verticalCenter: parent.verticalCenter + width: Style.space(20) + height: Style.space(14) + radius: Style.space(2) + color: "transparent" + clip: true + + Image { + id: rowFlagImg + anchors.fill: parent + source: root.flagPathFor(row.modelData.code) + sourceSize.width: 40 + sourceSize.height: 28 + fillMode: Image.PreserveAspectCrop + smooth: true + } + + Rectangle { + anchors.fill: parent + radius: parent.radius + color: "transparent" + border.color: Qt.rgba(1, 1, 1, 0.15) + border.width: 1 + } + } + Text { id: rowAbbrev - anchors.left: parent.left + anchors.left: rowFlagBadge.right anchors.leftMargin: Style.space(8) anchors.verticalCenter: parent.verticalCenter text: root.abbrevFor(row.modelData.code) @@ -661,6 +738,65 @@ Panel { } } + PanelSeparator { + foreground: root.foreground + } + + Row { + width: column.width + spacing: Style.space(6) + + Text { + anchors.verticalCenter: parent.verticalCenter + text: "Display:" + color: root.dim + font.family: root.fontFamily + font.pixelSize: Style.font.caption + } + + Item { width: Style.space(2); height: 1 } + + Repeater { + model: [ + { id: "flag", label: "Flag" }, + { id: "text", label: "Text" }, + { id: "both", label: "Both" } + ] + + delegate: CursorSurface { + id: modeChip + required property var modelData + readonly property bool isSelected: root.displayMode === modelData.id + width: (column.width - Style.space(80)) / 3 + height: Style.space(26) + radius: Style.space(4) + color: isSelected ? Qt.rgba(1, 1, 1, 0.12) : "transparent" + border.color: isSelected ? Color.accent : Qt.rgba(1, 1, 1, 0.1) + border.width: 1 + + MouseArea { + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: { + if (root.bar) { + root.bar.run("omarchy bar set glafeara.languages displayMode " + modeChip.modelData.id) + } + } + } + + Text { + anchors.centerIn: parent + text: modeChip.modelData.label + color: modeChip.isSelected ? Color.accent : root.foreground + font.family: root.fontFamily + font.pixelSize: Style.font.caption + font.bold: modeChip.isSelected + } + } + } + } + Text { width: column.width visible: root.lastError !== "" @@ -706,17 +842,51 @@ Panel { // Mirrors the theme's decoration:rounding, like the stock OSD card. radius: Style.cornerRadius borderSpec: Border.surfaceSpec("popups", "border", Color.popups.border, Math.max(1, Style.space(2))) - width: Math.max(osdLabel.implicitHeight, osdLabel.implicitWidth) + Style.space(48) - height: osdLabel.implicitHeight + Style.space(48) + width: Style.space(160) + height: Style.space(130) - Text { - id: osdLabel + Column { anchors.centerIn: parent - text: root.osdText - color: Color.popups.text - font.family: root.fontFamily - font.pixelSize: Style.font.displayLarge * 2 - font.bold: true + spacing: Style.space(10) + + Rectangle { + id: osdFlagBadge + visible: osdFlagImg.status === Image.Ready && root.displayMode !== "text" + anchors.horizontalCenter: parent.horizontalCenter + width: Style.space(80) + height: Style.space(54) + radius: Style.space(6) + color: "transparent" + clip: true + + Image { + id: osdFlagImg + anchors.fill: parent + source: root.flagPathFor(root.osdText) + sourceSize.width: 160 + sourceSize.height: 108 + fillMode: Image.PreserveAspectCrop + smooth: true + } + + Rectangle { + anchors.fill: parent + radius: parent.radius + color: "transparent" + border.color: Qt.rgba(1, 1, 1, 0.22) + border.width: 1 + } + } + + Text { + id: osdLabel + anchors.horizontalCenter: parent.horizontalCenter + text: root.osdText + color: Color.popups.text + font.family: root.fontFamily + font.pixelSize: (osdFlagBadge.visible ? Style.font.titleLarge : Style.font.displayLarge * 2) + font.bold: true + } } } } diff --git a/flags/am.svg b/flags/am.svg new file mode 100644 index 0000000..d51219b --- /dev/null +++ b/flags/am.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/flags/by.svg b/flags/by.svg new file mode 100644 index 0000000..bf96fa9 --- /dev/null +++ b/flags/by.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/flags/ca.svg b/flags/ca.svg new file mode 100644 index 0000000..4521509 --- /dev/null +++ b/flags/ca.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/flags/cn.svg b/flags/cn.svg new file mode 100644 index 0000000..eecc923 --- /dev/null +++ b/flags/cn.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flags/de.svg b/flags/de.svg new file mode 100644 index 0000000..b6d60e3 --- /dev/null +++ b/flags/de.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/flags/ee.svg b/flags/ee.svg new file mode 100644 index 0000000..3e6f465 --- /dev/null +++ b/flags/ee.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/flags/es.svg b/flags/es.svg new file mode 100644 index 0000000..03b489a --- /dev/null +++ b/flags/es.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flags/fi.svg b/flags/fi.svg new file mode 100644 index 0000000..7f1f271 --- /dev/null +++ b/flags/fi.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/flags/fr.svg b/flags/fr.svg new file mode 100644 index 0000000..5582acb --- /dev/null +++ b/flags/fr.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/flags/gb.svg b/flags/gb.svg new file mode 100644 index 0000000..edcf98d --- /dev/null +++ b/flags/gb.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/flags/ge.svg b/flags/ge.svg new file mode 100644 index 0000000..dd460f1 --- /dev/null +++ b/flags/ge.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flags/it.svg b/flags/it.svg new file mode 100644 index 0000000..60e5a51 --- /dev/null +++ b/flags/it.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/flags/jp.svg b/flags/jp.svg new file mode 100644 index 0000000..1b0d1c7 --- /dev/null +++ b/flags/jp.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flags/kz.svg b/flags/kz.svg new file mode 100644 index 0000000..bf3666e --- /dev/null +++ b/flags/kz.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flags/pl.svg b/flags/pl.svg new file mode 100644 index 0000000..f2c5863 --- /dev/null +++ b/flags/pl.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flags/ru.svg b/flags/ru.svg new file mode 100644 index 0000000..5c6314d --- /dev/null +++ b/flags/ru.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/flags/tr.svg b/flags/tr.svg new file mode 100644 index 0000000..918a0d7 --- /dev/null +++ b/flags/tr.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/flags/ua.svg b/flags/ua.svg new file mode 100644 index 0000000..8ae40fb --- /dev/null +++ b/flags/ua.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flags/us.svg b/flags/us.svg new file mode 100644 index 0000000..e9188b1 --- /dev/null +++ b/flags/us.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/manifest.json b/manifest.json index a4df406..3a37db6 100644 --- a/manifest.json +++ b/manifest.json @@ -19,10 +19,17 @@ "allowMultiple": false, "defaultSection": "right", "defaults": { + "displayMode": "flag", "osdDurationMs": 750, "showOsd": true }, "schema": [ + { + "key": "displayMode", + "type": "string", + "label": "Display mode (flag, text, both)", + "defaultValue": "flag" + }, { "key": "osdDurationMs", "type": "integer", From 6e1107630f80f2a0b9d7c14491b7b7ee88c60a6f Mon Sep 17 00:00:00 2001 From: rosakodu Date: Thu, 20 Aug 2026 00:21:23 +0300 Subject: [PATCH 2/5] Refine OSD presentation: flag-only in flag mode, text-only in text/both modes; add in-panel OSD toggle --- Panel.qml | 121 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 83 insertions(+), 38 deletions(-) diff --git a/Panel.qml b/Panel.qml index 8455188..3575131 100644 --- a/Panel.qml +++ b/Panel.qml @@ -797,6 +797,53 @@ Panel { } } + Row { + width: column.width + spacing: Style.space(6) + + Text { + anchors.verticalCenter: parent.verticalCenter + text: "OSD Popup:" + color: root.dim + font.family: root.fontFamily + font.pixelSize: Style.font.caption + } + + Item { width: Style.space(2); height: 1 } + + CursorSurface { + id: osdToggleBtn + readonly property bool isEnabled: root.setting("showOsd", true) === true + width: Style.space(86) + height: Style.space(26) + radius: Style.space(4) + color: isEnabled ? Qt.rgba(1, 1, 1, 0.12) : "transparent" + border.color: isEnabled ? Color.accent : Qt.rgba(1, 1, 1, 0.1) + border.width: 1 + + MouseArea { + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: { + if (root.bar) { + var nextVal = !osdToggleBtn.isEnabled + root.bar.run("omarchy bar set glafeara.languages showOsd " + (nextVal ? "true" : "false")) + } + } + } + + Text { + anchors.centerIn: parent + text: osdToggleBtn.isEnabled ? "✓ Enabled" : "✕ Disabled" + color: osdToggleBtn.isEnabled ? Color.accent : root.dim + font.family: root.fontFamily + font.pixelSize: Style.font.caption + font.bold: osdToggleBtn.isEnabled + } + } + } + Text { width: column.width visible: root.lastError !== "" @@ -835,6 +882,8 @@ Panel { // whatever the user is typing into. mask: Region {} + readonly property bool osdIsFlagOnly: root.displayMode === "flag" && osdFlagImg.status === Image.Ready + BorderSurface { id: osdCard anchors.centerIn: parent @@ -842,51 +891,47 @@ Panel { // Mirrors the theme's decoration:rounding, like the stock OSD card. radius: Style.cornerRadius borderSpec: Border.surfaceSpec("popups", "border", Color.popups.border, Math.max(1, Style.space(2))) - width: Style.space(160) - height: Style.space(130) + width: osdWindow.osdIsFlagOnly ? Style.space(136) : (Math.max(osdLabel.implicitHeight, osdLabel.implicitWidth) + Style.space(48)) + height: osdWindow.osdIsFlagOnly ? Style.space(96) : (osdLabel.implicitHeight + Style.space(48)) - Column { + Rectangle { + id: osdFlagBadge + visible: osdWindow.osdIsFlagOnly anchors.centerIn: parent - spacing: Style.space(10) + width: Style.space(96) + height: Style.space(64) + radius: Style.space(6) + color: "transparent" + clip: true + + Image { + id: osdFlagImg + anchors.fill: parent + source: root.flagPathFor(root.osdText) + sourceSize.width: 192 + sourceSize.height: 128 + fillMode: Image.PreserveAspectCrop + smooth: true + } Rectangle { - id: osdFlagBadge - visible: osdFlagImg.status === Image.Ready && root.displayMode !== "text" - anchors.horizontalCenter: parent.horizontalCenter - width: Style.space(80) - height: Style.space(54) - radius: Style.space(6) + anchors.fill: parent + radius: parent.radius color: "transparent" - clip: true - - Image { - id: osdFlagImg - anchors.fill: parent - source: root.flagPathFor(root.osdText) - sourceSize.width: 160 - sourceSize.height: 108 - fillMode: Image.PreserveAspectCrop - smooth: true - } - - Rectangle { - anchors.fill: parent - radius: parent.radius - color: "transparent" - border.color: Qt.rgba(1, 1, 1, 0.22) - border.width: 1 - } + border.color: Qt.rgba(1, 1, 1, 0.22) + border.width: 1 } + } - Text { - id: osdLabel - anchors.horizontalCenter: parent.horizontalCenter - text: root.osdText - color: Color.popups.text - font.family: root.fontFamily - font.pixelSize: (osdFlagBadge.visible ? Style.font.titleLarge : Style.font.displayLarge * 2) - font.bold: true - } + Text { + id: osdLabel + visible: !osdWindow.osdIsFlagOnly + anchors.centerIn: parent + text: root.osdText + color: Color.popups.text + font.family: root.fontFamily + font.pixelSize: Style.font.displayLarge * 2 + font.bold: true } } } From 53a309c01b488e0e01a68cbeea510b95ec5b7886 Mon Sep 17 00:00:00 2001 From: rosakodu Date: Thu, 20 Aug 2026 00:22:37 +0300 Subject: [PATCH 3/5] Align settings labels and make OSD Popup toggle symmetrical with Enabled/Disabled chips --- Panel.qml | 67 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/Panel.qml b/Panel.qml index 3575131..5e3bbde 100644 --- a/Panel.qml +++ b/Panel.qml @@ -747,6 +747,7 @@ Panel { spacing: Style.space(6) Text { + width: Style.space(78) anchors.verticalCenter: parent.verticalCenter text: "Display:" color: root.dim @@ -754,8 +755,6 @@ Panel { font.pixelSize: Style.font.caption } - Item { width: Style.space(2); height: 1 } - Repeater { model: [ { id: "flag", label: "Flag" }, @@ -767,7 +766,7 @@ Panel { id: modeChip required property var modelData readonly property bool isSelected: root.displayMode === modelData.id - width: (column.width - Style.space(80)) / 3 + width: (column.width - Style.space(78) - Style.space(18)) / 3 height: Style.space(26) radius: Style.space(4) color: isSelected ? Qt.rgba(1, 1, 1, 0.12) : "transparent" @@ -802,6 +801,7 @@ Panel { spacing: Style.space(6) Text { + width: Style.space(78) anchors.verticalCenter: parent.verticalCenter text: "OSD Popup:" color: root.dim @@ -809,37 +809,42 @@ Panel { font.pixelSize: Style.font.caption } - Item { width: Style.space(2); height: 1 } - - CursorSurface { - id: osdToggleBtn - readonly property bool isEnabled: root.setting("showOsd", true) === true - width: Style.space(86) - height: Style.space(26) - radius: Style.space(4) - color: isEnabled ? Qt.rgba(1, 1, 1, 0.12) : "transparent" - border.color: isEnabled ? Color.accent : Qt.rgba(1, 1, 1, 0.1) - border.width: 1 - - MouseArea { - anchors.fill: parent - hoverEnabled: true - cursorShape: Qt.PointingHandCursor - onClicked: { - if (root.bar) { - var nextVal = !osdToggleBtn.isEnabled - root.bar.run("omarchy bar set glafeara.languages showOsd " + (nextVal ? "true" : "false")) + Repeater { + model: [ + { val: true, label: "Enabled" }, + { val: false, label: "Disabled" } + ] + + delegate: CursorSurface { + id: osdChip + required property var modelData + readonly property bool isSelected: (root.setting("showOsd", true) === true) === modelData.val + width: (column.width - Style.space(78) - Style.space(12)) / 2 + height: Style.space(26) + radius: Style.space(4) + color: isSelected ? Qt.rgba(1, 1, 1, 0.12) : "transparent" + border.color: isSelected ? Color.accent : Qt.rgba(1, 1, 1, 0.1) + border.width: 1 + + MouseArea { + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: { + if (root.bar) { + root.bar.run("omarchy bar set glafeara.languages showOsd " + (osdChip.modelData.val ? "true" : "false")) + } } } - } - Text { - anchors.centerIn: parent - text: osdToggleBtn.isEnabled ? "✓ Enabled" : "✕ Disabled" - color: osdToggleBtn.isEnabled ? Color.accent : root.dim - font.family: root.fontFamily - font.pixelSize: Style.font.caption - font.bold: osdToggleBtn.isEnabled + Text { + anchors.centerIn: parent + text: osdChip.modelData.label + color: osdChip.isSelected ? Color.accent : root.foreground + font.family: root.fontFamily + font.pixelSize: Style.font.caption + font.bold: osdChip.isSelected + } } } } From 2100fe86b49e35e53ced6c486d119b4a9a9d4857 Mon Sep 17 00:00:00 2001 From: rosakodu Date: Thu, 20 Aug 2026 00:24:15 +0300 Subject: [PATCH 4/5] Fix settings buttons clickability with reactive in-memory state and background persistence --- Panel.qml | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/Panel.qml b/Panel.qml index 5e3bbde..2e82af6 100644 --- a/Panel.qml +++ b/Panel.qml @@ -76,7 +76,23 @@ Panel { return -1 } - readonly property string displayMode: String(root.setting("displayMode", "flag")) + property string currentDisplayMode: String(setting("displayMode", "flag")) + property bool currentShowOsd: setting("showOsd", true) === true + + onSettingsChanged: { + currentDisplayMode = String(setting("displayMode", "flag")) + currentShowOsd = setting("showOsd", true) === true + } + + function updateDisplayMode(mode) { + currentDisplayMode = String(mode) + if (root.bar) root.bar.run("omarchy bar set glafeara.languages displayMode " + mode) + } + + function updateShowOsd(enabled) { + currentShowOsd = (enabled === true || enabled === "true") + if (root.bar) root.bar.run("omarchy bar set glafeara.languages showOsd " + (currentShowOsd ? "true" : "false")) + } readonly property string activeCode: { if (activeIndex >= 0) return String(layouts[activeIndex].code).toLowerCase() @@ -224,7 +240,7 @@ Panel { function showOsd(label) { if (!root.primaryInstance) return - if (setting("showOsd", true) !== true || label === "") return + if (!root.currentShowOsd || label === "") return root.osdText = label root.osdVisible = true osdTimer.restart() @@ -455,9 +471,9 @@ Panel { id: button anchors.fill: parent bar: root.bar - text: root.displayMode === "flag" ? " " : (root.displayMode === "both" ? " " + root.barLabel : root.barLabel) + text: root.currentDisplayMode === "flag" ? " " : (root.currentDisplayMode === "both" ? " " + root.barLabel : root.barLabel) fontSize: Style.font.body - horizontalMargin: root.displayMode === "flag" ? 6 : 7 + horizontalMargin: root.currentDisplayMode === "flag" ? 6 : 7 onPressed: function(buttonCode) { if (buttonCode === Qt.RightButton) root.cycleLayout() else root.toggle() @@ -472,7 +488,7 @@ Panel { Rectangle { id: flagBadge - visible: root.displayMode !== "text" && flagImg.status === Image.Ready + visible: root.currentDisplayMode !== "text" && flagImg.status === Image.Ready width: Style.space(19) height: Style.space(13) anchors.verticalCenter: parent.verticalCenter @@ -502,7 +518,7 @@ Panel { Text { anchors.verticalCenter: parent.verticalCenter anchors.verticalCenterOffset: 1 - visible: root.displayMode !== "flag" || flagImg.status !== Image.Ready + visible: root.currentDisplayMode !== "flag" || flagImg.status !== Image.Ready text: root.barLabel color: button.active && button.useActiveColor ? button.activeColor : button.foreground font.family: root.fontFamily @@ -765,7 +781,7 @@ Panel { delegate: CursorSurface { id: modeChip required property var modelData - readonly property bool isSelected: root.displayMode === modelData.id + readonly property bool isSelected: root.currentDisplayMode === modelData.id width: (column.width - Style.space(78) - Style.space(18)) / 3 height: Style.space(26) radius: Style.space(4) @@ -777,11 +793,7 @@ Panel { anchors.fill: parent hoverEnabled: true cursorShape: Qt.PointingHandCursor - onClicked: { - if (root.bar) { - root.bar.run("omarchy bar set glafeara.languages displayMode " + modeChip.modelData.id) - } - } + onClicked: root.updateDisplayMode(modeChip.modelData.id) } Text { @@ -818,7 +830,7 @@ Panel { delegate: CursorSurface { id: osdChip required property var modelData - readonly property bool isSelected: (root.setting("showOsd", true) === true) === modelData.val + readonly property bool isSelected: root.currentShowOsd === modelData.val width: (column.width - Style.space(78) - Style.space(12)) / 2 height: Style.space(26) radius: Style.space(4) @@ -830,11 +842,7 @@ Panel { anchors.fill: parent hoverEnabled: true cursorShape: Qt.PointingHandCursor - onClicked: { - if (root.bar) { - root.bar.run("omarchy bar set glafeara.languages showOsd " + (osdChip.modelData.val ? "true" : "false")) - } - } + onClicked: root.updateShowOsd(osdChip.modelData.val) } Text { @@ -887,7 +895,7 @@ Panel { // whatever the user is typing into. mask: Region {} - readonly property bool osdIsFlagOnly: root.displayMode === "flag" && osdFlagImg.status === Image.Ready + readonly property bool osdIsFlagOnly: root.currentDisplayMode === "flag" && osdFlagImg.status === Image.Ready BorderSurface { id: osdCard From 65e64e3ebc00658fe08565f9b8b3130073c7fe37 Mon Sep 17 00:00:00 2001 From: rosakodu Date: Thu, 20 Aug 2026 00:26:51 +0300 Subject: [PATCH 5/5] Fix showOsd boolean type coercion across setting updates --- Panel.qml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Panel.qml b/Panel.qml index 2e82af6..2ccac43 100644 --- a/Panel.qml +++ b/Panel.qml @@ -76,12 +76,17 @@ Panel { return -1 } + function isOsdEnabled() { + var v = setting("showOsd", true) + return v === true || v === "true" || v === 1 || v === "1" + } + property string currentDisplayMode: String(setting("displayMode", "flag")) - property bool currentShowOsd: setting("showOsd", true) === true + property bool currentShowOsd: isOsdEnabled() onSettingsChanged: { currentDisplayMode = String(setting("displayMode", "flag")) - currentShowOsd = setting("showOsd", true) === true + currentShowOsd = isOsdEnabled() } function updateDisplayMode(mode) { @@ -90,8 +95,9 @@ Panel { } function updateShowOsd(enabled) { - currentShowOsd = (enabled === true || enabled === "true") - if (root.bar) root.bar.run("omarchy bar set glafeara.languages showOsd " + (currentShowOsd ? "true" : "false")) + var boolVal = (enabled === true || enabled === "true" || enabled === 1 || enabled === "1") + currentShowOsd = boolVal + if (root.bar) root.bar.run("omarchy bar set glafeara.languages showOsd " + (boolVal ? "true" : "false") + " --json") } readonly property string activeCode: {