nosignal-shell/modules/nsbar/panels/NsAudio.qml
28allday 6a933aa260 feat(nosignal): Nerd Font icon remap — bar + popouts
Route the redesign's icons through JetBrains Mono Nerd Font instead of Material
Symbols, for visual consistency with the JetBrains Mono text.

- services/Glyphs.qml: Material-Symbol-name -> Nerd Font (Font Awesome range)
  codepoint map (via String.fromCharCode), covering bar/panel icons + the
  dynamic Icons.getX() returns; get() falls back to a "?" glyph.
- components/NsIcon.qml: reactive icon component (input `icon` = name -> mapped
  glyph), so dynamic icons (volume/battery/play-pause) stay live. Uses the
  "Mono" NF variant so glyphs center in a fixed cell.
- Converted all MaterialIcon usages in NsBar + the 9 panels to NsIcon.

caelestia core (nexus/launcher/osd/lock) still uses Material Symbols — no
breakage (mixed), to be converted next with an expanded Glyphs map.

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

162 lines
4.2 KiB
QML

pragma ComponentBehavior: Bound
// NoSignal Audio Mixer popout (off the volume pill). Output device row, master
// slider, per-app application sliders, input (mic) slider. Wired to Pipewire
// via the Audio service.
import QtQuick
import QtQuick.Layouts
import qs.services
import qs.components
NsPanel {
id: root
implicitWidth: 340
anchorMode: "right"
// output device
RowLayout {
Layout.fillWidth: true
spacing: 8
NsIcon {
icon: "speaker"
color: Theme.textMuted
}
StyledText {
Layout.fillWidth: true
text: Audio.sink?.description || Audio.sink?.name || "Output"
color: Theme.text
elide: Text.ElideRight
font.family: Theme.font.family
font.pixelSize: Theme.font.bodySmall
}
NsIcon {
icon: "expand_more"
color: Theme.textFaint
}
}
AudioSlider {
icon: Audio.muted ? "volume_off" : "volume_up"
value: Audio.volume
onMoved: v => Audio.setVolume(v)
}
// applications
StyledText {
visible: Audio.streams.length > 0
text: "APPLICATIONS"
color: Theme.textFaint
font.family: Theme.font.family
font.pixelSize: Theme.font.label
font.letterSpacing: Theme.font.trackingLabel
}
Repeater {
model: Audio.streams
delegate: AudioSlider {
required property var modelData
Layout.fillWidth: true
icon: "graphic_eq"
label: modelData?.properties?.["application.name"] || modelData?.description || modelData?.name || "App"
value: modelData?.audio?.volume ?? 0
onMoved: v => {
if (modelData?.audio)
modelData.audio.volume = v;
}
}
}
// input
StyledText {
text: "INPUT"
Layout.topMargin: 2
color: Theme.textFaint
font.family: Theme.font.family
font.pixelSize: Theme.font.label
font.letterSpacing: Theme.font.trackingLabel
}
AudioSlider {
icon: Audio.sourceMuted ? "mic_off" : "mic"
value: Audio.sourceVolume
onMoved: v => Audio.setSourceVolume(v)
}
component AudioSlider: ColumnLayout {
id: s
property string icon
property string label: ""
property real value: 0
signal moved(real v)
Layout.fillWidth: true
spacing: 3
StyledText {
visible: s.label !== ""
text: s.label
color: Theme.textMuted
elide: Text.ElideRight
Layout.fillWidth: true
font.family: Theme.font.family
font.pixelSize: Theme.font.meta
}
RowLayout {
Layout.fillWidth: true
spacing: 10
NsIcon {
icon: s.icon
color: Theme.textMuted
}
Rectangle {
Layout.fillWidth: true
implicitHeight: 6
radius: 3
color: Theme.fillSubtle
Rectangle {
width: parent.width * Math.max(0, Math.min(1, s.value))
height: parent.height
radius: 3
color: Theme.accent
}
Rectangle {
x: parent.width * Math.max(0, Math.min(1, s.value)) - width / 2
anchors.verticalCenter: parent.verticalCenter
implicitWidth: 14
implicitHeight: 14
radius: 7
color: Theme.accent
}
MouseArea {
anchors.fill: parent
onPressed: e => s.moved(Math.max(0, Math.min(1, e.x / width)))
onPositionChanged: e => {
if (pressed)
s.moved(Math.max(0, Math.min(1, e.x / width)));
}
}
}
StyledText {
text: Math.round(s.value * 100) + "%"
color: Theme.textMuted
font.family: Theme.font.family
font.pixelSize: Theme.font.meta
}
}
}
}