add material icons to status

This commit is contained in:
lucy 2026-01-16 14:44:10 +01:00
parent f4f652ed8a
commit 051c1815b3
10 changed files with 113 additions and 34 deletions

View File

@ -19,13 +19,14 @@ Variants {
right: true right: true
} }
implicitHeight: Settings.config.barHeight implicitHeight: Settings.config.barHeight
Row { RowLayout {
id: leftStuff id: leftStuff
spacing: 10 spacing: 10
anchors.left: parent.left anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Workspaces { Workspaces {
property var screen: modelData property var screen: root.modelData
Layout.leftMargin: 10
} }
Title { Title {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -35,17 +36,19 @@ Variants {
Row { Row {
id: centerStuff id: centerStuff
anchors.centerIn: parent anchors.centerIn: parent
Clock {}
} }
Row { RowLayout {
id: rightStuff id: rightStuff
spacing: 10 spacing: 20
anchors.right: parent.right anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Clock {}
Volume {} Volume {}
SystemTray {}
Battery {} Battery {}
SystemTray {
Layout.rightMargin: 10
}
} }
} }
} }

View File

@ -12,28 +12,55 @@ Loader {
sourceComponent: Item { sourceComponent: Item {
id: root id: root
property bool frame1: UPower.displayDevice.percentage <= 0.16
property bool frame2: UPower.displayDevice.percentage < 0.32
property bool frame3: UPower.displayDevice.percentage < 0.48
property bool frame4: UPower.displayDevice.percentage < 0.74
property bool frame5: UPower.displayDevice.percentage < 0.90
property bool frame6: UPower.displayDevice.percentage <= 1
property bool charging: UPower.displayDevice.Charging
function getBatteryIcon() {
if (charging) {
return "battery_android_frame_bolt"
}
if (frame1) {
return "battery_android_frame_1";
}
if (frame2) {
return "battery_android_frame_2";
}
if (frame3) {
return "battery_android_frame_3";
}
if (frame4) {
return "battery_android_frame_4";
}
if (frame5) {
return "battery_android_frame_5";
}
if (frame6) {
return "battery_android_frame_full";
}
}
implicitWidth: batRow.implicitWidth implicitWidth: batRow.implicitWidth
implicitHeight: Settings.config.barHeight implicitHeight: Settings.config.barHeight
Rectangle {
id: batRow
implicitWidth: batText.implicitWidth + batIcon.implicitWidth + 10
color: "transparent"
implicitHeight: Settings.config.barHeight
Row { Row {
anchors.centerIn: batRow anchors.centerIn: parent
id: batRow
spacing: 5
CustomText { CustomText {
id: batText id: batText
text: Math.round(UPower.displayDevice.percentage * 100) + "%" text: Math.round(UPower.displayDevice.percentage * 100) + "%"
} }
CustomIcon {
IconImage {
id: batIcon id: batIcon
anchors.verticalCenter: parent.verticalCenter text: root.getBatteryIcon()
source: Quickshell.iconPath(UPower.displayDevice.iconName)
implicitSize: 12
}
} }
} }
} }
} }

View File

@ -7,8 +7,11 @@ Item {
id: root id: root
implicitWidth: trayRow.implicitWidth implicitWidth: trayRow.implicitWidth
implicitHeight: Settings.config.barHeight implicitHeight: Settings.config.barHeight
anchors.verticalCenter: parent.verticalCenter
Row { Row {
id: trayRow id: trayRow
anchors.verticalCenter: parent.verticalCenter
Repeater { Repeater {
id: trayRepeater id: trayRepeater
model: SystemTray.items model: SystemTray.items

View File

@ -6,13 +6,14 @@ import "../../"
import Quickshell.Hyprland import Quickshell.Hyprland
Item { Item {
id: textContainer id: root
readonly property var activeWindow: Hyprland.activeToplevel
implicitWidth: text.implicitWidth implicitWidth: text.implicitWidth
implicitHeight: Settings.config.barHeight implicitHeight: Settings.config.barHeight
CustomText { CustomText {
id: text id: text
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: Hyprland.activeToplevel ? Hyprland.activeToplevel.title : "Desktop" text: root.activeWindow?.activated ?Hyprland.activeToplevel.title : "Desktop"
} }
} }

View File

@ -7,14 +7,45 @@ import "../../"
Item { Item {
id: root id: root
implicitWidth: volumeText.implicitWidth + 10 property var sink: Pipewire.defaultAudioSink
function getVolumeIcon() {
// Safety check: if Pipewire is dead or sink is missing
if (!sink)
return "volume_off";
// If muted, show the hush icon
if (sink.audio.muted)
return "volume_off";
// Volume is usually 0.0 to 1.0 (0% to 100%)
const vol = sink.audio.volume;
if (vol <= 0.25)
return "volume_mute";
if (vol < 0.75)
return "volume_down";
if (vol <= 1.00)
return "volume_up";
// If it's loud, prepare the ears!
return "volume_up";
}
implicitWidth: textRow.implicitWidth + 10
implicitHeight: Settings.config.barHeight implicitHeight: Settings.config.barHeight
Row {
anchors.centerIn: parent
spacing: 5
id: textRow
CustomText { CustomText {
id: volumeText id: volumeText
anchors.centerIn: parent
PwObjectTracker { PwObjectTracker {
objects: Pipewire.ready ? Pipewire.defaultAudioSink : [] objects: Pipewire.ready ? Pipewire.defaultAudioSink : []
} }
text: Pipewire.ready ? Pipewire.defaultAudioSink.audio.muted ? "mut: " + Math.round(Pipewire.defaultAudioSink.audio.volume * 100) + "%" : "vol: " + Math.round(Pipewire.defaultAudioSink.audio.volume * 100) + "%" : "failure" text: Pipewire.ready ? Math.round(root.sink.audio.volume * 100) + "%" : "failure"
}
CustomIcon {
id: volumeIcon
text: root.getVolumeIcon()
}
} }
} }

View File

@ -13,7 +13,7 @@ Item {
Row { Row {
id: workspaceRow id: workspaceRow
anchors.centerIn: parent anchors.centerIn: parent
spacing: 0 // Slightly increase spacing between workspace buttons spacing: 10 // Slightly increase spacing between workspace buttons
Repeater { Repeater {
id: wsRepeater id: wsRepeater
@ -21,6 +21,7 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
Rectangle { Rectangle {
id: workspaceNumber id: workspaceNumber
radius: 20
property bool isOnMon: { property bool isOnMon: {
if (!modelData) if (!modelData)
return false; return false;
@ -34,14 +35,15 @@ Item {
} }
required property var modelData required property var modelData
width: isOnMon ? Settings.config.barHeight + 10 : 0 width: isOnMon ? Settings.config.barHeight - Settings.config.barHeight / 2 : 0
height: isOnMon ? Settings.config.barHeight : 0 height: isOnMon ? Settings.config.barHeight - Settings.config.barHeight / 2 : 0
color: modelData.active ? Colors.foreground : "transparent" color: "transparent"
CustomText { CustomText {
anchors.centerIn: workspaceNumber anchors.centerIn: workspaceNumber
text: parent.modelData.id text: parent.modelData.id
color: parent.modelData.active ? Colors.background : Colors.foreground // Set contrasting color for workspace number color: Colors.foreground // Set contrasting color for workspace number
opacity: workspaceNumber.modelData.focused ? 1 : 0.5
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent

11
reusables/CustomIcon.qml Normal file
View File

@ -0,0 +1,11 @@
import QtQuick
import "../settings/"
import "../"
Text {
property real fill
font.family: "Material Symbols Rounded"
color: Colors.foreground
font.pixelSize: Settings.config.fontSize + 2
font.weight: 500
}

View File

@ -3,6 +3,7 @@ import "../settings/"
import "../" import "../"
Text { Text {
font.weight: 900
color: Colors.foreground color: Colors.foreground
font.family: Settings.config.font font.family: Settings.config.font
font.pixelSize: Settings.config.fontSize font.pixelSize: Settings.config.fontSize

View File

@ -22,7 +22,7 @@ Singleton {
adapter: JsonAdapter { adapter: JsonAdapter {
id: settingsAdapter id: settingsAdapter
property var currentWall: "/home/lucy/.walls/faris.jpg" property var currentWall: "/home/lucy/.walls/faris.jpg"
property var barHeight: 18 property var barHeight: 28
property var font: "JetBrainsMono Nerd Font" property var font: "JetBrainsMono Nerd Font"
property var fontSize: 12 property var fontSize: 12
property var rounding: 10 property var rounding: 10

View File

@ -1,5 +1,5 @@
{ {
"barHeight": 18, "barHeight": 28,
"currentWall": "/home/lucy/.walls/faris.jpg", "currentWall": "/home/lucy/.walls/faris.jpg",
"floating": true, "floating": true,
"font": "JetBrainsMono Nerd Font", "font": "JetBrainsMono Nerd Font",