Files
arthur-os/default/quickshell/omarchy-shell/plugins/settings/components/NDropdown.qml
T
Ryan Hughes 85199197af Drive the bar font from fontconfig (drop shell.json round-trip)
omarchy-font-set already updates ~/.config/fontconfig/fonts.conf, which
is what fc-match, Qt, and every other XDG app reads from. Storing the
same family in shell.json gives the same value two homes that can drift
apart, and stops the bar from picking up font changes without a shell
restart.

  - omarchy-font-set stops writing bar.fontFamily to shell.json and stops
    poking ~/.config/waybar/style.css. fontconfig + terminals + hyprlock
    + swayosd are still updated as before.
  - omarchy-font-current reads fc-match monospace -f '%{family}' and
    takes the first comma-separated entry; the old jq-on-shell.json
    path is gone.
  - Bar / SettingsPanel / NDropdown.qml default fontFamily to
    "monospace" and stop reading config.fontFamily. Qt resolves the
    family through fontconfig at paint time, so omarchy-font-set updates
    the bar live with no reload.
  - shell-defaults.json drops bar.fontFamily.

User-visible effect: pick a Nerd Font, the bar follows it. Pick a font
without glyphs and you get tofu — same failure mode the terminals and
hyprlock already had.
2026-05-14 16:34:21 -04:00

135 lines
3.7 KiB
QML

import QtQuick
import QtQuick.Controls
// Themed ComboBox + popup. Anchors below the trigger, paints with the host
// shell's foreground/background palette, and inherits the shell-wide corner
// radius so nothing renders rounded when the user has set sharp corners.
Item {
id: root
property string label: ""
property string value: ""
property var options: []
property color foreground: "#cacccc"
property color background: "#101315"
property color accent: "#cacccc"
property string fontFamily: "monospace"
property int cornerRadius: 0
property int rowHeight: 28
property int popupRowHeight: 28
property bool showLabel: true
signal changed(string value)
implicitWidth: 240
implicitHeight: showLabel ? rowHeight + 18 : rowHeight
Column {
anchors.fill: parent
spacing: 4
Text {
visible: root.showLabel && root.label !== ""
text: root.label
color: Qt.darker(root.foreground, 1.4)
font.family: root.fontFamily
font.pixelSize: 10
font.bold: true
}
ComboBox {
id: combo
width: parent.width
height: root.rowHeight
font.family: root.fontFamily
font.pixelSize: 12
model: root.options
currentIndex: {
for (var i = 0; i < model.length; i++) if (model[i] === root.value) return i
return -1
}
onActivated: function(index) {
if (index >= 0 && index < model.length) root.changed(model[index])
}
background: Rectangle {
color: root.background
border.color: combo.activeFocus
? root.accent
: Qt.rgba(root.foreground.r, root.foreground.g, root.foreground.b, 0.4)
border.width: 1
radius: root.cornerRadius
}
contentItem: Text {
leftPadding: 8
rightPadding: 24
text: combo.displayText
color: root.foreground
font: combo.font
verticalAlignment: Text.AlignVCenter
}
indicator: Text {
x: combo.width - width - 8
y: combo.topPadding + (combo.availableHeight - height) / 2
text: "▾"
color: Qt.darker(root.foreground, 1.2)
font.family: root.fontFamily
font.pixelSize: 10
}
popup: Popup {
// Anchor the popup directly under the field, full width, sharp/round
// matching the shell radius. Override the native white-with-blue look.
y: combo.height
width: combo.width
implicitHeight: Math.min(contentItem.implicitHeight, root.popupRowHeight * 8)
padding: 1
background: Rectangle {
color: root.background
border.color: root.foreground
border.width: 1
radius: root.cornerRadius
}
contentItem: ListView {
clip: true
implicitHeight: contentHeight
model: combo.delegateModel
currentIndex: combo.highlightedIndex
boundsBehavior: Flickable.StopAtBounds
}
}
delegate: ItemDelegate {
required property var modelData
required property int index
width: combo.width
height: root.popupRowHeight
padding: 0
contentItem: Text {
text: String(modelData)
color: index === combo.highlightedIndex ? root.accent : root.foreground
font.family: root.fontFamily
font.pixelSize: 12
leftPadding: 10
rightPadding: 10
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
background: Rectangle {
color: index === combo.highlightedIndex
? Qt.rgba(root.foreground.r, root.foreground.g, root.foreground.b, 0.12)
: "transparent"
radius: 0
}
}
}
}
}