summaryrefslogtreecommitdiff
path: root/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Services/CavaService.qml
diff options
context:
space:
mode:
authornippy <you@example.com>2026-04-18 13:49:56 +0200
committernippy <you@example.com>2026-04-18 13:49:56 +0200
commit5d94c0a7d44a2255b81815a52a7056a94a39842d (patch)
tree759bdea9645c6a62f9e1e4c001f7d81cccd120d2 /raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Services/CavaService.qml
parente79cdf210b267f21a186255ce1a4d50029439d54 (diff)
downloadRaveOS-PKGBUILD-5d94c0a7d44a2255b81815a52a7056a94a39842d.tar.gz
RaveOS-PKGBUILD-5d94c0a7d44a2255b81815a52a7056a94a39842d.zip
update Raveos themes
Diffstat (limited to 'raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Services/CavaService.qml')
-rw-r--r--raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Services/CavaService.qml76
1 files changed, 76 insertions, 0 deletions
diff --git a/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Services/CavaService.qml b/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Services/CavaService.qml
new file mode 100644
index 0000000..d3e5717
--- /dev/null
+++ b/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Services/CavaService.qml
@@ -0,0 +1,76 @@
+pragma Singleton
+pragma ComponentBehavior: Bound
+
+import QtQuick
+import Quickshell
+import Quickshell.Io
+
+Singleton {
+ id: root
+
+ property list<int> values: Array(6)
+ property int refCount: 0
+ property bool cavaAvailable: false
+
+ Process {
+ id: cavaCheck
+
+ command: ["which", "cava"]
+ running: false
+ onExited: exitCode => {
+ root.cavaAvailable = exitCode === 0 && Quickshell.env("DMS_DISABLE_CAVA") !== "1";
+ }
+ }
+
+ Component.onCompleted: {
+ cavaCheck.running = true;
+ }
+
+ Process {
+ id: cavaProcess
+
+ running: root.cavaAvailable && root.refCount > 0
+ command: ["sh", "-c", `cat <<'CAVACONF' | cava -p /dev/stdin
+[general]
+framerate=25
+bars=6
+autosens=0
+sensitivity=30
+lower_cutoff_freq=50
+higher_cutoff_freq=12000
+
+[output]
+method=raw
+raw_target=/dev/stdout
+data_format=ascii
+channels=mono
+mono_option=average
+
+[smoothing]
+noise_reduction=35
+integral=90
+gravity=95
+ignore=2
+monstercat=1.5
+CAVACONF`]
+
+ onRunningChanged: {
+ if (!running) {
+ root.values = Array(6).fill(0);
+ }
+ }
+
+ stdout: SplitParser {
+ splitMarker: "\n"
+ onRead: data => {
+ if (root.refCount > 0 && data.length > 0) {
+ const parts = data.split(";");
+ if (parts.length >= 6) {
+ const points = [parseInt(parts[0], 10), parseInt(parts[1], 10), parseInt(parts[2], 10), parseInt(parts[3], 10), parseInt(parts[4], 10), parseInt(parts[5], 10)];
+ root.values = points;
+ }
+ }
+ }
+ }
+ }
+}