use svg icons instead of goofy font

This commit is contained in:
lucy 2026-08-24 21:02:17 +02:00
commit 5df124dc5f
6 changed files with 83 additions and 37 deletions

View file

@ -1,4 +1,6 @@
import Quickshell.Services.UPower import Quickshell.Services.UPower
import Quickshell
import Quickshell.Widgets
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Effects import QtQuick.Effects
@ -15,30 +17,33 @@ BarComponent {
implicitHeight: Config.moduleHeight implicitHeight: Config.moduleHeight
implicitWidth: batLayout.implicitWidth + 16 implicitWidth: batLayout.implicitWidth + 16
function batteryIcon(percent) { function batteryIcon(percent, charging) {
if (root.charging) if(percent <= 10) return charging ? "battery-empty-charging" : "battery-empty"
return "battery_android_frame_bolt"; if(percent <= 30) return charging ? "battery-level-30-charging" : "battery-level-30"
if (percent <= 15) if(percent <= 40) return charging ? "battery-level-40-charging" : "battery-level-40"
return "battery_android_alert"; if(percent <= 50) return charging ? "battery-level-50-charging" : "battery-level-50"
if (percent <= 30) if(percent <= 60) return charging ? "battery-level-60-charging" : "battery-level-60"
return "battery_android_frame_2"; if(percent <= 70) return charging ? "battery-level-70-charging" : "battery-level-70"
if (percent <= 50) if(percent <= 80) return charging ? "battery-level-80-charging" : "battery-level-80"
return "battery_android_frame_3"; if(percent <= 90) return charging ? "battery-level-90-charging" : "battery-level-90"
if (percent <= 70) if(percent >= 90) return charging ? "battery-level-100-charging" : "battery-level-100"
return "battery_android_frame_4";
if (percent <= 85)
return "battery_android_frame_5";
if (percent <= 100)
return "battery_android_frame_full";
} }
RowLayout { RowLayout {
id: batLayout id: batLayout
anchors.centerIn: root anchors.centerIn: root
MaterialIcon { IconImage {
text: root.batteryIcon(root.percent) source: Quickshell.iconPath(root.batteryIcon(root.percent, root.charging) + "-symbolic")
} implicitSize: Config.iconSize
layer.enabled: true
layer.effect: MultiEffect {
colorization: 1.0
colorizationColor: Colors.text
brightness: 0.5
}
}
StyledText { StyledText {
text: Math.floor(root.percent) + "%" text: Math.floor(root.percent,root.charging) + "%"
} }
} }
} }

View file

@ -3,6 +3,8 @@ import Quickshell.Services.Mpris
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Effects import QtQuick.Effects
import Quickshell
import Quickshell.Widgets
import qs import qs
import qs.widgets import qs.widgets
import qs.settings import qs.settings
@ -18,13 +20,21 @@ BarComponent {
} }
return null; return null;
} }
visible: spotify !== null && spotify.playbackState === MprisPlaybackState.Playing visible: spotify !== null
active: clickHandler.containsMouse
RowLayout { RowLayout {
id: songLayout id: songLayout
anchors.centerIn: root anchors.centerIn: root
MaterialIcon { IconImage {
text: "music_note_2" source: Quickshell.iconPath("folder-music-symbolic")
} implicitSize: Config.iconSize
layer.enabled: true
layer.effect: MultiEffect {
colorization: 1.0
colorizationColor: Colors.text
brightness: 0.5
}
}
StyledText { StyledText {
Layout.maximumWidth: 400 Layout.maximumWidth: 400
Layout.maximumHeight: Config.barHeight / 1.6 Layout.maximumHeight: Config.barHeight / 1.6
@ -32,4 +42,12 @@ BarComponent {
elide: Text.ElideRight elide: Text.ElideRight
} }
} }
MouseArea {
id: clickHandler
anchors.fill: root
hoverEnabled: true
onClicked: root.spotify.togglePlaying()
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
}
} }

View file

@ -1,6 +1,9 @@
//@ pragma IconTheme Adwaita
pragma ComponentBehavior: Bound pragma ComponentBehavior: Bound
import Quickshell.Services.Pipewire import Quickshell.Services.Pipewire
import Quickshell.Io import Quickshell.Io
import Quickshell.Widgets
import Quickshell
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Effects import QtQuick.Effects
@ -18,17 +21,18 @@ BarComponent {
function getVolumeIcon() { function getVolumeIcon() {
let volume = Pipewire.ready ? root.defaultAudio.audio.volume : null; let volume = Pipewire.ready ? root.defaultAudio.audio.volume : null;
if (root.mute) { if (root.mute) {
return "\ue04f"; return "audio-volume-muted";
} }
if (volume <= 0.33) { if (volume <= 0.33) {
return "\ue04e"; return "audio-volume-low";
} }
if (volume <= 0.66) { if (volume <= 0.66) {
return "\ue04d"; return "audio-volume-medium";
} }
if (volume >= 0.66) { if (volume >= 0.66) {
return "\ue050"; return "audio-volume-high";
} }
} }
PwObjectTracker { PwObjectTracker {
@ -45,10 +49,16 @@ BarComponent {
id: pwLayout id: pwLayout
anchors.centerIn: root anchors.centerIn: root
spacing: 4 spacing: 4
MaterialIcon { IconImage {
text: root.getVolumeIcon() source: Quickshell.iconPath(root.getVolumeIcon() + "-symbolic", root.getVolumeIcon())
opacity: root.defaultAudio?.audio.muted ? 0.6 : 1.0 implicitSize: 14
} layer.enabled: true
layer.effect: MultiEffect {
colorization: 1.0
colorizationColor: Colors.text
brightness: 0.5
}
}
StyledText { StyledText {
text: Math.round(root.defaultAudio?.audio.volume * 100) + "%" text: Math.round(root.defaultAudio?.audio.volume * 100) + "%"
opacity: root.defaultAudio?.audio.muted ? 0.6 : 1.0 opacity: root.defaultAudio?.audio.muted ? 0.6 : 1.0

View file

@ -16,6 +16,7 @@ BarComponent {
Repeater { Repeater {
model: WindowManager.screenProjection(root.barScreen).windowsets model: WindowManager.screenProjection(root.barScreen).windowsets
delegate: Rectangle { delegate: Rectangle {
id: wsContainer
required property var modelData required property var modelData
visible: modelData.shouldDisplay visible: modelData.shouldDisplay
StyledText { StyledText {
@ -23,6 +24,13 @@ BarComponent {
anchors.centerIn: parent anchors.centerIn: parent
text: parent.modelData.name text: parent.modelData.name
color: parent.modelData.active ? Colors.base0D: Colors.base03 color: parent.modelData.active ? Colors.base0D: Colors.base03
MouseArea {
id: clickHandler
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton
onClicked: parent.parent.modelData.activate()
}
} }
} }
} }

View file

@ -2,7 +2,6 @@ pragma ComponentBehavior: Bound
import Quickshell import Quickshell
import Quickshell.Wayland import Quickshell.Wayland
import Quickshell.Widgets import Quickshell.Widgets
import Quickshell.Hyprland
import QtQuick import QtQuick
import Qt.labs.folderlistmodel 2.11 import Qt.labs.folderlistmodel 2.11
import QtQuick.Effects import QtQuick.Effects
@ -16,10 +15,16 @@ BarComponent {
implicitWidth: Config.moduleHeight implicitWidth: Config.moduleHeight
required property int screenHeight required property int screenHeight
id: main id: main
MaterialIcon { IconImage {
anchors.centerIn: main source: Quickshell.iconPath("preferences-desktop-wallpaper-symbolic")
text: "\ue1bc" implicitSize: Config.iconSize
font.bold: true anchors.centerIn: parent
layer.enabled: true
layer.effect: MultiEffect {
colorization: 1.0
colorizationColor: Colors.text
brightness: 0.5
}
} }
MouseArea { MouseArea {
id: clickHandler id: clickHandler

View file

@ -9,4 +9,4 @@ primaryMon=eDP-1
rounding=4 rounding=4
showCorners=true showCorners=true
wallDir=file:///home/lucy/.walls wallDir=file:///home/lucy/.walls
wallpaper=@Variant(\0\0\0\x11\0\0\0\x1b/home/lucy/.walls/asuka.png) wallpaper=@Variant(\0\0\0\x11\0\0\0'/home/lucy/.walls/lance_of_longinus.png)