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
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize + 1
font.family: M.Theme.fontFamily
font.family: M.Theme.iconFontFamily
verticalAlignment: Text.AlignVCenter
}

View file

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

View file

@ -2,8 +2,9 @@ import QtQuick
import Quickshell.Io
import "." as M
Text {
Row {
id: root
spacing: 2
property int usage: 0
property real freqGhz: 0
@ -51,9 +52,15 @@ 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
M.BarIcon {
icon: ""
anchors.verticalCenter: parent.verticalCenter
}
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 "." as M
Text {
Row {
id: root
spacing: 2
property int freePct: 0
property real totalTb: 0
@ -30,9 +31,15 @@ Text {
onTriggered: proc.running = true
}
text: " " + root.freePct + "% " + root.totalTb.toFixed(1)
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize
font.family: M.Theme.fontFamily
verticalAlignment: Text.AlignVCenter
M.BarIcon {
icon: ""
anchors.verticalCenter: parent.verticalCenter
}
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 "." as M
Text {
Row {
id: root
spacing: 2
property int percent: 0
@ -30,9 +31,15 @@ Text {
onTriggered: meminfo.reload()
}
text: " " + root.percent + "%"
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize
font.family: M.Theme.fontFamily
verticalAlignment: Text.AlignVCenter
M.BarIcon {
icon: ""
anchors.verticalCenter: parent.verticalCenter
}
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
}
Text {
text: {
M.BarIcon {
icon: {
if (root.state === "wifi")
return " " + root.essid;
return "";
if (root.state === "eth")
return "󰈀";
if (root.state === "linked")
return "󱘖";
return "󰣽";
}
anchors.verticalCenter: parent.verticalCenter
}
Text {
visible: root.state === "wifi"
text: root.essid
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize + 1
font.family: M.Theme.fontFamily

View file

@ -2,8 +2,9 @@ import QtQuick
import Quickshell.Io
import "." as M
Text {
Row {
id: root
spacing: 2
property int celsius: 0
@ -19,9 +20,16 @@ Text {
onTriggered: thermal.reload()
}
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
M.BarIcon {
icon: ""
color: root.celsius > 80 ? M.Theme.base08 : M.Theme.base05
anchors.verticalCenter: parent.verticalCenter
}
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 string fontFamily: "sans-serif"
property string iconFontFamily: "Symbols Nerd Font"
property int fontSize: 12
property real barOpacity: 0.9
property int barHeight: 32
@ -51,6 +52,8 @@ QtObject {
}
if (data.fontFamily)
root.fontFamily = data.fontFamily;
if (data.iconFontFamily)
root.iconFontFamily = data.iconFontFamily;
if (data.fontSize)
root.fontSize = data.fontSize;
if (data.barOpacity !== undefined)

View file

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

View file

@ -39,6 +39,7 @@ let
fontFamily = f.sansSerif.name;
fontSize = f.sizes.desktop;
barOpacity = 1.0 - config.stylix.opacity.desktop;
iconFontFamily = "Symbols Nerd Font";
}
);
in
@ -57,7 +58,7 @@ in
default = { };
description = ''
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.
'';
};
@ -79,7 +80,10 @@ in
config = lib.mkIf cfg.enable {
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 =
(pkgs.formats.json { }).generate "nova-shell-theme.json"