dedup, monospace font for icons

This commit is contained in:
Damocles 2026-04-11 00:35:37 +02:00
parent cd45c2d9cf
commit 00838e1d64
18 changed files with 67 additions and 80 deletions

View file

@ -33,7 +33,7 @@ Row {
text: root.percent + "% "
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize
font.family: M.Theme.fontFamily
font.family: M.Theme.iconFontFamily
anchors.verticalCenter: parent.verticalCenter
}
}

12
modules/BarIcon.qml Normal file
View file

@ -0,0 +1,12 @@
import QtQuick
import "." as M
Text {
property string icon: ""
text: icon
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize + 1
font.family: M.Theme.iconFontFamily
verticalAlignment: Text.AlignVCenter
}

12
modules/BarLabel.qml Normal file
View file

@ -0,0 +1,12 @@
import QtQuick
import "." as M
Text {
property string label: ""
text: label
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize
font.family: M.Theme.fontFamily
verticalAlignment: Text.AlignVCenter
}

View file

@ -11,23 +11,19 @@ Row {
readonly property real pct: (dev?.percentage ?? 0) * 100
readonly property bool charging: dev?.state === UPowerDeviceState.Charging
Text {
text: {
if (root.charging)
return "";
M.BarIcon {
icon: {
if (root.charging) return "";
const icons = ["󰂎", "󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂", "󱟢"];
return icons[Math.min(10, Math.floor(root.pct / 10))];
}
color: root.pct < 15 ? M.Theme.base08 : M.Theme.base05
font.pixelSize: M.Theme.fontSize + 2
font.family: M.Theme.fontFamily
anchors.verticalCenter: parent.verticalCenter
}
Text {
text: Math.round(root.pct) + "%"
M.BarLabel {
label: Math.round(root.pct) + "%"
color: root.pct < 15 ? M.Theme.base08 : M.Theme.base05
font.pixelSize: M.Theme.fontSize
font.family: M.Theme.fontFamily
anchors.verticalCenter: parent.verticalCenter
}
}

View file

@ -32,7 +32,7 @@ Row {
text: root.status === "connected" ? (" " + root.device) : ""
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize + 1
font.family: M.Theme.fontFamily
font.family: M.Theme.iconFontFamily
anchors.verticalCenter: parent.verticalCenter
}
}

View file

@ -54,6 +54,6 @@ 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
font.family: M.Theme.iconFontFamily
verticalAlignment: Text.AlignVCenter
}

View file

@ -33,6 +33,6 @@ Text {
text: " " + root.freePct + "% " + root.totalTb.toFixed(1)
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize
font.family: M.Theme.fontFamily
font.family: M.Theme.iconFontFamily
verticalAlignment: Text.AlignVCenter
}

View file

@ -2,16 +2,12 @@ import QtQuick
import Quickshell.Io
import "." as M
Text {
M.BarIcon {
id: root
property bool active: false
text: root.active ? "" : ""
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize + 1
font.family: M.Theme.fontFamily
verticalAlignment: Text.AlignVCenter
icon: root.active ? "" : ""
Process {
id: toggle

View file

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

View file

@ -10,18 +10,12 @@ Row {
readonly property MprisPlayer player: Mpris.players.values[0] ?? null
readonly property bool playing: player?.playbackState === MprisPlaybackState.Playing
Text {
text: root.playing ? "" : (root.player?.playbackState === MprisPlaybackState.Paused ? "󰏤" : "󰓛")
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize + 1
font.family: M.Theme.fontFamily
M.BarIcon {
icon: root.playing ? "" : (root.player?.playbackState === MprisPlaybackState.Paused ? "󰏤" : "󰓛")
anchors.verticalCenter: parent.verticalCenter
}
Text {
text: root.player?.identity ?? ""
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize
font.family: M.Theme.fontFamily
M.BarLabel {
label: root.player?.identity ?? ""
anchors.verticalCenter: parent.verticalCenter
}

View file

@ -54,7 +54,7 @@ Row {
}
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize + 1
font.family: M.Theme.fontFamily
font.family: M.Theme.iconFontFamily
anchors.verticalCenter: parent.verticalCenter
}
}

View file

@ -28,24 +28,16 @@ Row {
}
}
Text {
text: {
if (root.inhibited)
return root.count > 0 ? "󰂛" : "󰪑";
if (root.dnd)
return root.count > 0 ? "󰂠" : "󰪓";
M.BarIcon {
icon: {
if (root.inhibited) return root.count > 0 ? "󰂛" : "󰪑";
if (root.dnd) return root.count > 0 ? "󰂠" : "󰪓";
return root.count > 0 ? "󱅫" : "󰂜";
}
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize + 2
font.family: M.Theme.fontFamily
anchors.verticalCenter: parent.verticalCenter
}
Text {
text: root.count > 0 ? String(root.count) : ""
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize
font.family: M.Theme.fontFamily
M.BarLabel {
label: root.count > 0 ? String(root.count) : ""
anchors.verticalCenter: parent.verticalCenter
}

View file

@ -2,11 +2,18 @@ import QtQuick
import Quickshell.Io
import "." as M
Text {
M.BarIcon {
id: root
property string profile: ""
icon: {
if (root.profile === "performance") return "";
if (root.profile === "power-saver") return "";
if (root.profile === "balanced") return "";
return "";
}
Process {
id: proc
running: true
@ -21,18 +28,4 @@ Text {
repeat: true
onTriggered: proc.running = true
}
text: {
if (root.profile === "performance")
return "";
if (root.profile === "power-saver")
return "";
if (root.profile === "balanced")
return "";
return "";
}
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize + 1
font.family: M.Theme.fontFamily
verticalAlignment: Text.AlignVCenter
}

View file

@ -22,6 +22,6 @@ 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
font.family: M.Theme.iconFontFamily
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 Mono"
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

@ -14,24 +14,16 @@ Row {
readonly property real volume: sink?.audio?.volume ?? 0
readonly property bool muted: sink?.audio?.muted ?? false
Text {
text: root.muted ? "" : (root.volume > 0.5 ? "" : (root.volume > 0 ? "" : ""))
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize + 1
font.family: M.Theme.fontFamily
M.BarIcon {
icon: root.muted ? "" : (root.volume > 0.5 ? "" : (root.volume > 0 ? "" : ""))
anchors.verticalCenter: parent.verticalCenter
}
Text {
text: Math.round(root.volume * 100) + "%"
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize
font.family: M.Theme.fontFamily
M.BarLabel {
label: Math.round(root.volume * 100) + "%"
anchors.verticalCenter: parent.verticalCenter
}
TapHandler {
onTapped: if (root.sink?.audio)
root.sink.audio.muted = !root.sink.audio.muted
onTapped: if (root.sink?.audio) root.sink.audio.muted = !root.sink.audio.muted
}
}

View file

@ -2,12 +2,8 @@ import QtQuick
import Quickshell.Io
import "." as M
Text {
text: ""
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize + 2
font.family: M.Theme.fontFamily
verticalAlignment: Text.AlignVCenter
M.BarIcon {
icon: ""
Process {
id: proc

View file

@ -37,6 +37,7 @@ let
;
};
fontFamily = f.sansSerif.name;
iconFontFamily = f.monospace.name;
fontSize = f.sizes.desktop;
barOpacity = 1.0 - config.stylix.opacity.desktop;
}