use symbol font for symbols

This commit is contained in:
Damocles 2026-04-11 12:08:06 +02:00
parent 207d227342
commit b7ee4e2dbb
10 changed files with 79 additions and 32 deletions

View file

@ -7,6 +7,6 @@ Text {
text: icon text: icon
color: M.Theme.base05 color: M.Theme.base05
font.pixelSize: M.Theme.fontSize + 1 font.pixelSize: M.Theme.fontSize + 1
font.family: M.Theme.fontFamily font.family: M.Theme.iconFontFamily
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }

View file

@ -28,8 +28,14 @@ Row {
onTriggered: proc.running = true onTriggered: proc.running = true
} }
M.BarIcon {
visible: root.status === "connected"
icon: ""
anchors.verticalCenter: parent.verticalCenter
}
Text { Text {
text: root.status === "connected" ? (" " + root.device) : "" visible: root.status === "connected"
text: root.device
color: M.Theme.base05 color: M.Theme.base05
font.pixelSize: M.Theme.fontSize + 1 font.pixelSize: M.Theme.fontSize + 1
font.family: M.Theme.fontFamily font.family: M.Theme.fontFamily

View file

@ -2,8 +2,9 @@ import QtQuick
import Quickshell.Io import Quickshell.Io
import "." as M import "." as M
Text { Row {
id: root id: root
spacing: 2
property int usage: 0 property int usage: 0
property real freqGhz: 0 property real freqGhz: 0
@ -51,9 +52,15 @@ Text {
} }
} }
text: " " + root.usage.toString().padStart(2) + "%@" + root.freqGhz.toFixed(2) M.BarIcon {
color: M.Theme.base05 icon: ""
font.pixelSize: M.Theme.fontSize anchors.verticalCenter: parent.verticalCenter
font.family: M.Theme.fontFamily }
verticalAlignment: Text.AlignVCenter Text {
text: root.usage.toString().padStart(2) + "%@" + root.freqGhz.toFixed(2)
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize
font.family: M.Theme.fontFamily
verticalAlignment: Text.AlignVCenter
}
} }

View file

@ -2,8 +2,9 @@ import QtQuick
import Quickshell.Io import Quickshell.Io
import "." as M import "." as M
Text { Row {
id: root id: root
spacing: 2
property int freePct: 0 property int freePct: 0
property real totalTb: 0 property real totalTb: 0
@ -30,9 +31,15 @@ Text {
onTriggered: proc.running = true onTriggered: proc.running = true
} }
text: " " + root.freePct + "% " + root.totalTb.toFixed(1) M.BarIcon {
color: M.Theme.base05 icon: ""
font.pixelSize: M.Theme.fontSize anchors.verticalCenter: parent.verticalCenter
font.family: M.Theme.fontFamily }
verticalAlignment: Text.AlignVCenter Text {
text: root.freePct + "% " + root.totalTb.toFixed(1)
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize
font.family: M.Theme.fontFamily
verticalAlignment: Text.AlignVCenter
}
} }

View file

@ -2,8 +2,9 @@ import QtQuick
import Quickshell.Io import Quickshell.Io
import "." as M import "." as M
Text { Row {
id: root id: root
spacing: 2
property int percent: 0 property int percent: 0
@ -30,9 +31,15 @@ Text {
onTriggered: meminfo.reload() onTriggered: meminfo.reload()
} }
text: " " + root.percent + "%" M.BarIcon {
color: M.Theme.base05 icon: ""
font.pixelSize: M.Theme.fontSize anchors.verticalCenter: parent.verticalCenter
font.family: M.Theme.fontFamily }
verticalAlignment: Text.AlignVCenter Text {
text: root.percent + "%"
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize
font.family: M.Theme.fontFamily
verticalAlignment: Text.AlignVCenter
}
} }

View file

@ -42,16 +42,21 @@ Row {
onTriggered: proc.running = true onTriggered: proc.running = true
} }
Text { M.BarIcon {
text: { icon: {
if (root.state === "wifi") if (root.state === "wifi")
return " " + root.essid; return "";
if (root.state === "eth") if (root.state === "eth")
return "󰈀"; return "󰈀";
if (root.state === "linked") if (root.state === "linked")
return "󱘖"; return "󱘖";
return "󰣽"; return "󰣽";
} }
anchors.verticalCenter: parent.verticalCenter
}
Text {
visible: root.state === "wifi"
text: root.essid
color: M.Theme.base05 color: M.Theme.base05
font.pixelSize: M.Theme.fontSize + 1 font.pixelSize: M.Theme.fontSize + 1
font.family: M.Theme.fontFamily font.family: M.Theme.fontFamily

View file

@ -2,8 +2,9 @@ import QtQuick
import Quickshell.Io import Quickshell.Io
import "." as M import "." as M
Text { Row {
id: root id: root
spacing: 2
property int celsius: 0 property int celsius: 0
@ -19,9 +20,16 @@ Text {
onTriggered: thermal.reload() onTriggered: thermal.reload()
} }
text: " " + root.celsius + "°C" M.BarIcon {
color: root.celsius > 80 ? M.Theme.base08 : M.Theme.base05 icon: ""
font.pixelSize: M.Theme.fontSize color: root.celsius > 80 ? M.Theme.base08 : M.Theme.base05
font.family: M.Theme.fontFamily anchors.verticalCenter: parent.verticalCenter
verticalAlignment: Text.AlignVCenter }
Text {
text: root.celsius + "°C"
color: root.celsius > 80 ? M.Theme.base08 : M.Theme.base05
font.pixelSize: M.Theme.fontSize
font.family: M.Theme.fontFamily
verticalAlignment: Text.AlignVCenter
}
} }

View file

@ -26,6 +26,7 @@ QtObject {
property color base0F: "#f2cdcd" property color base0F: "#f2cdcd"
property string fontFamily: "sans-serif" property string fontFamily: "sans-serif"
property string iconFontFamily: "Symbols Nerd Font"
property int fontSize: 12 property int fontSize: 12
property real barOpacity: 0.9 property real barOpacity: 0.9
property int barHeight: 32 property int barHeight: 32
@ -51,6 +52,8 @@ QtObject {
} }
if (data.fontFamily) if (data.fontFamily)
root.fontFamily = data.fontFamily; root.fontFamily = data.fontFamily;
if (data.iconFontFamily)
root.iconFontFamily = data.iconFontFamily;
if (data.fontSize) if (data.fontSize)
root.fontSize = data.fontSize; root.fontSize = data.fontSize;
if (data.barOpacity !== undefined) if (data.barOpacity !== undefined)

View file

@ -32,6 +32,6 @@ Text {
text: root.label text: root.label
color: M.Theme.base05 color: M.Theme.base05
font.pixelSize: M.Theme.fontSize font.pixelSize: M.Theme.fontSize
font.family: M.Theme.fontFamily font.family: M.Theme.iconFontFamily
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }

View file

@ -39,6 +39,7 @@ let
fontFamily = f.sansSerif.name; fontFamily = f.sansSerif.name;
fontSize = f.sizes.desktop; fontSize = f.sizes.desktop;
barOpacity = 1.0 - config.stylix.opacity.desktop; barOpacity = 1.0 - config.stylix.opacity.desktop;
iconFontFamily = "Symbols Nerd Font";
} }
); );
in in
@ -57,7 +58,7 @@ in
default = { }; default = { };
description = '' description = ''
Theme overrides written to `$XDG_CONFIG_HOME/nova-shell/theme.json`. Theme overrides written to `$XDG_CONFIG_HOME/nova-shell/theme.json`.
Keys: colors (base00-base0F), fontFamily, fontSize, barOpacity, barHeight. Keys: colors (base00-base0F), fontFamily, iconFontFamily, fontSize, barOpacity, barHeight.
Automatically populated from stylix when it is available. Automatically populated from stylix when it is available.
''; '';
}; };
@ -79,7 +80,10 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
programs.nova-shell.theme = lib.mkIf stylixAvailable (lib.mkDefault stylixTheme); programs.nova-shell.theme = lib.mkIf stylixAvailable (lib.mkDefault stylixTheme);
home.packages = [ self.packages.${pkgs.stdenv.hostPlatform.system}.nova-shell-cli ]; home.packages = [
self.packages.${pkgs.stdenv.hostPlatform.system}.nova-shell-cli
pkgs.nerd-fonts.symbols-only
];
xdg.configFile."nova-shell/theme.json".source = xdg.configFile."nova-shell/theme.json".source =
(pkgs.formats.json { }).generate "nova-shell-theme.json" (pkgs.formats.json { }).generate "nova-shell-theme.json"