nosignal-shell/modules/nsbar/panels/NsPowerMenu.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

143 lines
3.9 KiB
QML

pragma ComponentBehavior: Bound
// NoSignal Power Menu — full-screen modal overlay. Big clock + date, then 5
// action tiles (Lock, Suspend, Log Out, Reboot, Shut Down=danger). Esc / click
// scrim cancels. Rendered full-screen by NsOverlay (open === "power").
import QtQuick
import QtQuick.Layouts
import Quickshell
import qs.services
import qs.components
Item {
id: root
function run(cmd: string): void {
Quickshell.execDetached(["sh", "-c", cmd]);
NsShell.close();
}
// scrim
Rectangle {
anchors.fill: parent
color: Theme.overlayBg
MouseArea {
anchors.fill: parent
onClicked: NsShell.close()
}
}
ColumnLayout {
anchors.centerIn: parent
spacing: 28
// big clock + date
ColumnLayout {
Layout.alignment: Qt.AlignHCenter
spacing: 2
StyledText {
Layout.alignment: Qt.AlignHCenter
text: Time.format("hh:mm")
color: Theme.text
font.family: Theme.font.family
font.pixelSize: Theme.font.clockBig
font.weight: Font.Light
font.letterSpacing: Theme.font.trackingClockBig
}
StyledText {
Layout.alignment: Qt.AlignHCenter
text: Time.format("dddd, d MMMM")
color: Theme.textMuted
font.family: Theme.font.family
font.pixelSize: Theme.font.body
}
}
// action tiles
RowLayout {
Layout.alignment: Qt.AlignHCenter
spacing: 14
Tile {
icon: "lock"
label: "Lock"
onActivated: root.run("loginctl lock-session")
}
Tile {
icon: "bedtime"
label: "Suspend"
onActivated: root.run("systemctl suspend")
}
Tile {
icon: "logout"
label: "Log Out"
onActivated: root.run("hyprctl dispatch exit")
}
Tile {
icon: "restart_alt"
label: "Reboot"
onActivated: root.run("systemctl reboot")
}
Tile {
icon: "power_settings_new"
label: "Shut Down"
danger: true
onActivated: root.run("systemctl poweroff")
}
}
StyledText {
Layout.alignment: Qt.AlignHCenter
text: "Press Esc to cancel"
color: Theme.textFaint
font.family: Theme.font.family
font.pixelSize: Theme.font.bodySmall
}
}
component Tile: Rectangle {
id: tile
property string icon
property string label
property bool danger: false
signal activated
implicitWidth: 96
implicitHeight: 96
radius: Theme.radius.panel
color: ma.containsMouse ? Theme.accentSoft : Theme.panelBg
border.width: 1
border.color: ma.containsMouse ? (tile.danger ? Theme.danger : Theme.accent) : Theme.panelBorder
ColumnLayout {
anchors.centerIn: parent
spacing: 10
NsIcon {
Layout.alignment: Qt.AlignHCenter
icon: tile.icon
color: tile.danger ? Theme.danger : Theme.text
}
StyledText {
Layout.alignment: Qt.AlignHCenter
text: tile.label
color: tile.danger ? Theme.danger : Theme.text
font.family: Theme.font.family
font.pixelSize: Theme.font.bodySmall
}
}
MouseArea {
id: ma
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: tile.activated()
}
}
}