From b7ee4e2dbb9109f7d235c35401c1a15e27ec3f0d Mon Sep 17 00:00:00 2001 From: Damocles Date: Sat, 11 Apr 2026 12:08:06 +0200 Subject: [PATCH] use symbol font for symbols --- modules/BarIcon.qml | 2 +- modules/Bluetooth.qml | 8 +++++++- modules/Cpu.qml | 19 +++++++++++++------ modules/Disk.qml | 19 +++++++++++++------ modules/Memory.qml | 19 +++++++++++++------ modules/Network.qml | 11 ++++++++--- modules/Temperature.qml | 20 ++++++++++++++------ modules/Theme.qml | 3 +++ modules/Weather.qml | 2 +- nix/hm-module.nix | 8 ++++++-- 10 files changed, 79 insertions(+), 32 deletions(-) diff --git a/modules/BarIcon.qml b/modules/BarIcon.qml index 965e2ab..82a4df5 100644 --- a/modules/BarIcon.qml +++ b/modules/BarIcon.qml @@ -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 } diff --git a/modules/Bluetooth.qml b/modules/Bluetooth.qml index c6e530e..746b115 100644 --- a/modules/Bluetooth.qml +++ b/modules/Bluetooth.qml @@ -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 diff --git a/modules/Cpu.qml b/modules/Cpu.qml index b372566..22ea307 100644 --- a/modules/Cpu.qml +++ b/modules/Cpu.qml @@ -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 + } } diff --git a/modules/Disk.qml b/modules/Disk.qml index 39969e0..673b6f2 100644 --- a/modules/Disk.qml +++ b/modules/Disk.qml @@ -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 + } } diff --git a/modules/Memory.qml b/modules/Memory.qml index 851e850..df7f61a 100644 --- a/modules/Memory.qml +++ b/modules/Memory.qml @@ -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 + } } diff --git a/modules/Network.qml b/modules/Network.qml index 65d07e8..03ea73e 100644 --- a/modules/Network.qml +++ b/modules/Network.qml @@ -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 diff --git a/modules/Temperature.qml b/modules/Temperature.qml index 59c40b4..5062059 100644 --- a/modules/Temperature.qml +++ b/modules/Temperature.qml @@ -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 + } } diff --git a/modules/Theme.qml b/modules/Theme.qml index ef4972e..27b904e 100644 --- a/modules/Theme.qml +++ b/modules/Theme.qml @@ -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) diff --git a/modules/Weather.qml b/modules/Weather.qml index f4cf705..2b65aaf 100644 --- a/modules/Weather.qml +++ b/modules/Weather.qml @@ -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 } diff --git a/nix/hm-module.nix b/nix/hm-module.nix index f7feb2d..c6206f2 100644 --- a/nix/hm-module.nix +++ b/nix/hm-module.nix @@ -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"