mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-07 19:59:14 -04:00
fix(CavaService): prevent 100% CPU EOF spin loop by using temp file (#2471)
* fix(CavaService): prevent 100% CPU EOF spin loop by using temp config file * cava: make tmp file non-deterministic --------- Co-authored-by: bbedward <bbedward@gmail.com>
This commit is contained in:
committed by
GitHub
parent
6b141a9b06
commit
304baf6f60
@@ -1,9 +1,11 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import QtCore
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
|
import qs.Common
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
@@ -11,6 +13,7 @@ Singleton {
|
|||||||
property list<int> values: Array(6)
|
property list<int> values: Array(6)
|
||||||
property int refCount: 0
|
property int refCount: 0
|
||||||
property bool cavaAvailable: false
|
property bool cavaAvailable: false
|
||||||
|
readonly property string _confPath: `${Paths.strip(StandardPaths.writableLocation(StandardPaths.TempLocation))}/dms-cava-${Date.now()}-${Math.floor(Math.random() * 1000000)}.conf`
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: cavaCheck
|
id: cavaCheck
|
||||||
@@ -30,7 +33,7 @@ Singleton {
|
|||||||
id: cavaProcess
|
id: cavaProcess
|
||||||
|
|
||||||
running: root.cavaAvailable && root.refCount > 0
|
running: root.cavaAvailable && root.refCount > 0
|
||||||
command: ["sh", "-c", `cat <<'CAVACONF' | cava -p /dev/stdin
|
command: ["sh", "-c", `cat <<'CAVACONF' > ${root._confPath}
|
||||||
[general]
|
[general]
|
||||||
framerate=25
|
framerate=25
|
||||||
bars=6
|
bars=6
|
||||||
@@ -52,7 +55,8 @@ integral=90
|
|||||||
gravity=95
|
gravity=95
|
||||||
ignore=2
|
ignore=2
|
||||||
monstercat=1.5
|
monstercat=1.5
|
||||||
CAVACONF`]
|
CAVACONF
|
||||||
|
exec cava -p ${root._confPath} < /dev/null`]
|
||||||
|
|
||||||
onRunningChanged: {
|
onRunningChanged: {
|
||||||
if (!running) {
|
if (!running) {
|
||||||
|
|||||||
Reference in New Issue
Block a user