refactor(structure): move components to folders

This commit is contained in:
tux
2026-08-23 12:16:16 +05:30
parent ae6628f549
commit 494420d241
5 changed files with 2 additions and 0 deletions

13
services/Battery.qml Normal file
View File

@@ -0,0 +1,13 @@
pragma Singleton
import Quickshell
import QtQuick
import Quickshell.Services.UPower
Singleton {
id: root
readonly property int percentage: Math.round(UPower.displayDevice.percentage * 100)
readonly property real energyRate: UPower.displayDevice.changeRate
readonly property string iconName: root.percentage < 30 ? "battery-low.svg" : root.percentage < 70 ? "battery-medium.svg" : "battery-full.svg"
readonly property url icon: `${Quickshell.shellPath("assets")}/icons/${root.iconName}`
}

26
services/Cava.qml Normal file
View File

@@ -0,0 +1,26 @@
pragma Singleton
import QtQuick
import Quickshell
import Quickshell.Io
Singleton {
id: root
readonly property string configPath: {
const url = Quickshell.shellPath("assets/cava.conf").toString();
return url.startsWith("file://") ? decodeURIComponent(url.substring(7)) : url;
}
property var values: []
Process {
running: true
command: ["cava", "-p", root.configPath]
stdout: SplitParser {
onRead: line => {
root.values = line.split(";").map(Number).filter(v => !Number.isNaN(v));
}
}
}
}

16
services/Time.qml Normal file
View File

@@ -0,0 +1,16 @@
pragma Singleton
import Quickshell
import QtQuick
Singleton {
id: root
readonly property string time: {
Qt.formatDateTime(clock.date, "hh:mm AP");
}
SystemClock {
id: clock
precision: SystemClock.Minutes
}
}