dedup, monospace font for icons
This commit is contained in:
parent
cd45c2d9cf
commit
00838e1d64
18 changed files with 67 additions and 80 deletions
|
|
@ -33,7 +33,7 @@ Row {
|
||||||
text: root.percent + "% "
|
text: root.percent + "% "
|
||||||
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
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
modules/BarIcon.qml
Normal file
12
modules/BarIcon.qml
Normal 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
12
modules/BarLabel.qml
Normal 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
|
||||||
|
}
|
||||||
|
|
@ -11,23 +11,19 @@ Row {
|
||||||
readonly property real pct: (dev?.percentage ?? 0) * 100
|
readonly property real pct: (dev?.percentage ?? 0) * 100
|
||||||
readonly property bool charging: dev?.state === UPowerDeviceState.Charging
|
readonly property bool charging: dev?.state === UPowerDeviceState.Charging
|
||||||
|
|
||||||
Text {
|
M.BarIcon {
|
||||||
text: {
|
icon: {
|
||||||
if (root.charging)
|
if (root.charging) return "";
|
||||||
return "";
|
|
||||||
const icons = ["", "", "", "", "", "", "", "", "", "", ""];
|
const icons = ["", "", "", "", "", "", "", "", "", "", ""];
|
||||||
return icons[Math.min(10, Math.floor(root.pct / 10))];
|
return icons[Math.min(10, Math.floor(root.pct / 10))];
|
||||||
}
|
}
|
||||||
color: root.pct < 15 ? M.Theme.base08 : M.Theme.base05
|
color: root.pct < 15 ? M.Theme.base08 : M.Theme.base05
|
||||||
font.pixelSize: M.Theme.fontSize + 2
|
font.pixelSize: M.Theme.fontSize + 2
|
||||||
font.family: M.Theme.fontFamily
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
Text {
|
M.BarLabel {
|
||||||
text: Math.round(root.pct) + "%"
|
label: Math.round(root.pct) + "%"
|
||||||
color: root.pct < 15 ? M.Theme.base08 : M.Theme.base05
|
color: root.pct < 15 ? M.Theme.base08 : M.Theme.base05
|
||||||
font.pixelSize: M.Theme.fontSize
|
|
||||||
font.family: M.Theme.fontFamily
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ Row {
|
||||||
text: root.status === "connected" ? (" " + root.device) : ""
|
text: root.status === "connected" ? (" " + 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.iconFontFamily
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,6 @@ Text {
|
||||||
text: " " + root.usage.toString().padStart(2) + "%@" + root.freqGhz.toFixed(2)
|
text: " " + root.usage.toString().padStart(2) + "%@" + root.freqGhz.toFixed(2)
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,6 @@ Text {
|
||||||
text: " " + root.freePct + "% " + root.totalTb.toFixed(1)
|
text: " " + root.freePct + "% " + root.totalTb.toFixed(1)
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,12 @@ import QtQuick
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import "." as M
|
import "." as M
|
||||||
|
|
||||||
Text {
|
M.BarIcon {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property bool active: false
|
property bool active: false
|
||||||
|
|
||||||
text: root.active ? "" : ""
|
icon: root.active ? "" : ""
|
||||||
color: M.Theme.base05
|
|
||||||
font.pixelSize: M.Theme.fontSize + 1
|
|
||||||
font.family: M.Theme.fontFamily
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: toggle
|
id: toggle
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,6 @@ Text {
|
||||||
text: " " + root.percent + "%"
|
text: " " + root.percent + "%"
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,18 +10,12 @@ Row {
|
||||||
readonly property MprisPlayer player: Mpris.players.values[0] ?? null
|
readonly property MprisPlayer player: Mpris.players.values[0] ?? null
|
||||||
readonly property bool playing: player?.playbackState === MprisPlaybackState.Playing
|
readonly property bool playing: player?.playbackState === MprisPlaybackState.Playing
|
||||||
|
|
||||||
Text {
|
M.BarIcon {
|
||||||
text: root.playing ? "" : (root.player?.playbackState === MprisPlaybackState.Paused ? "" : "")
|
icon: root.playing ? "" : (root.player?.playbackState === MprisPlaybackState.Paused ? "" : "")
|
||||||
color: M.Theme.base05
|
|
||||||
font.pixelSize: M.Theme.fontSize + 1
|
|
||||||
font.family: M.Theme.fontFamily
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
Text {
|
M.BarLabel {
|
||||||
text: root.player?.identity ?? ""
|
label: root.player?.identity ?? ""
|
||||||
color: M.Theme.base05
|
|
||||||
font.pixelSize: M.Theme.fontSize
|
|
||||||
font.family: M.Theme.fontFamily
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ Row {
|
||||||
}
|
}
|
||||||
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
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,24 +28,16 @@ Row {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
M.BarIcon {
|
||||||
text: {
|
icon: {
|
||||||
if (root.inhibited)
|
if (root.inhibited) return root.count > 0 ? "" : "";
|
||||||
return root.count > 0 ? "" : "";
|
if (root.dnd) return root.count > 0 ? "" : "";
|
||||||
if (root.dnd)
|
|
||||||
return root.count > 0 ? "" : "";
|
|
||||||
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
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
Text {
|
M.BarLabel {
|
||||||
text: root.count > 0 ? String(root.count) : ""
|
label: root.count > 0 ? String(root.count) : ""
|
||||||
color: M.Theme.base05
|
|
||||||
font.pixelSize: M.Theme.fontSize
|
|
||||||
font.family: M.Theme.fontFamily
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,18 @@ import QtQuick
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import "." as M
|
import "." as M
|
||||||
|
|
||||||
Text {
|
M.BarIcon {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property string profile: ""
|
property string profile: ""
|
||||||
|
|
||||||
|
icon: {
|
||||||
|
if (root.profile === "performance") return "";
|
||||||
|
if (root.profile === "power-saver") return "";
|
||||||
|
if (root.profile === "balanced") return "";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: proc
|
id: proc
|
||||||
running: true
|
running: true
|
||||||
|
|
@ -21,18 +28,4 @@ Text {
|
||||||
repeat: true
|
repeat: true
|
||||||
onTriggered: proc.running = 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
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,6 @@ Text {
|
||||||
text: " " + root.celsius + "°C"
|
text: " " + root.celsius + "°C"
|
||||||
color: root.celsius > 80 ? M.Theme.base08 : M.Theme.base05
|
color: root.celsius > 80 ? M.Theme.base08 : 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
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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 Mono"
|
||||||
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)
|
||||||
|
|
|
||||||
|
|
@ -14,24 +14,16 @@ Row {
|
||||||
readonly property real volume: sink?.audio?.volume ?? 0
|
readonly property real volume: sink?.audio?.volume ?? 0
|
||||||
readonly property bool muted: sink?.audio?.muted ?? false
|
readonly property bool muted: sink?.audio?.muted ?? false
|
||||||
|
|
||||||
Text {
|
M.BarIcon {
|
||||||
text: root.muted ? "" : (root.volume > 0.5 ? "" : (root.volume > 0 ? "" : ""))
|
icon: root.muted ? "" : (root.volume > 0.5 ? "" : (root.volume > 0 ? "" : ""))
|
||||||
color: M.Theme.base05
|
|
||||||
font.pixelSize: M.Theme.fontSize + 1
|
|
||||||
font.family: M.Theme.fontFamily
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
M.BarLabel {
|
||||||
Text {
|
label: Math.round(root.volume * 100) + "%"
|
||||||
text: Math.round(root.volume * 100) + "%"
|
|
||||||
color: M.Theme.base05
|
|
||||||
font.pixelSize: M.Theme.fontSize
|
|
||||||
font.family: M.Theme.fontFamily
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
TapHandler {
|
TapHandler {
|
||||||
onTapped: if (root.sink?.audio)
|
onTapped: if (root.sink?.audio) root.sink.audio.muted = !root.sink.audio.muted
|
||||||
root.sink.audio.muted = !root.sink.audio.muted
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,8 @@ import QtQuick
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import "." as M
|
import "." as M
|
||||||
|
|
||||||
Text {
|
M.BarIcon {
|
||||||
text: ""
|
icon: ""
|
||||||
color: M.Theme.base05
|
|
||||||
font.pixelSize: M.Theme.fontSize + 2
|
|
||||||
font.family: M.Theme.fontFamily
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: proc
|
id: proc
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ let
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
fontFamily = f.sansSerif.name;
|
fontFamily = f.sansSerif.name;
|
||||||
|
iconFontFamily = f.monospace.name;
|
||||||
fontSize = f.sizes.desktop;
|
fontSize = f.sizes.desktop;
|
||||||
barOpacity = 1.0 - config.stylix.opacity.desktop;
|
barOpacity = 1.0 - config.stylix.opacity.desktop;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue