nosignal-shell/components/NsIcon.qml
28allday cf3c0d823d feat(nosignal): Nerd Font icon remap — nexus (Settings)
Convert caelestia's nexus Settings to Nerd Font icons (drop-in NsIcon).

- NsIcon hardened into a MaterialIcon drop-in: accepts fontStyle (sizes from
  it, keeps the NF Mono family), plus no-op fill/grade/animate for API parity.
- Glyphs map extended with caelestia core names: nexus static icons, nav/page
  icons (palette, wallpaper, dashboard, devices_other, extension, globe, info,
  monitor, shuffle, workspaces, ...), weather + app/device icons.
- Converted all MaterialIcon in modules/nexus/ to NsIcon; fixed icon aliases
  (NavRow/SliderRow .text -> .icon); reverted IconButton font: (it has font,
  not fontStyle, and renders its own icon).

Remaining core surfaces still Material Symbols (no breakage): launcher, osd,
lock, sidebar, utilities — to convert next with any further Glyphs entries.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 11:16:01 +01:00

32 lines
1.2 KiB
QML

pragma ComponentBehavior: Bound
// NoSignal icon: renders a Nerd Font (JetBrainsMono NF) glyph from a Material
// Symbol name via the Glyphs map. Drop-in for MaterialIcon but the input is
// `icon` (the name) instead of `text`, so dynamic bindings stay reactive.
import QtQuick
import qs.services
Text {
id: root
property string icon: ""
property int size: 16
// MaterialIcon API parity so NsIcon is a drop-in (these are no-ops here —
// Nerd Font has no fill/grade variable axes; sizing comes from fontStyle).
property real fill: 0
property int grade: 0
property bool animate: false
property var fontStyle: null
renderType: Text.NativeRendering
textFormat: Text.PlainText
text: Glyphs.get(root.icon)
// "Mono" variant centers each icon glyph in a fixed cell (the plain NF
// variant uses a wide advance, which left/right-shifts centered icons).
font.family: "JetBrainsMono Nerd Font Mono"
font.pixelSize: root.fontStyle ? (root.fontStyle.pixelSize > 0 ? root.fontStyle.pixelSize : Math.round((root.fontStyle.pointSize || 12) * 1.33)) : root.size
color: Theme.text
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}