mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-09 07:12:07 -04:00
feat(lockscreen): enable use of videos as screensaver in the lock screen (#1819)
* feat(lockscreen): enable use of videos as screensaver in the lock screen * reducing debug logs * feature becomes available only when QtMultimedia is available
This commit is contained in:
committed by
GitHub
parent
5d09acca4c
commit
bd6ad53875
@@ -7,6 +7,7 @@ import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Services.Pipewire
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
@@ -14,7 +15,7 @@ Singleton {
|
||||
readonly property PwNode sink: Pipewire.defaultAudioSink
|
||||
readonly property PwNode source: Pipewire.defaultAudioSource
|
||||
|
||||
property bool soundsAvailable: false
|
||||
readonly property bool soundsAvailable: MultimediaService.available
|
||||
property bool gsettingsAvailable: false
|
||||
property var availableSoundThemes: []
|
||||
property string currentSoundTheme: ""
|
||||
@@ -312,24 +313,6 @@ EOFCONFIG
|
||||
}
|
||||
}
|
||||
|
||||
function detectSoundsAvailability() {
|
||||
try {
|
||||
const testObj = Qt.createQmlObject(`
|
||||
import QtQuick
|
||||
import QtMultimedia
|
||||
Item {}
|
||||
`, root, "AudioService.TestComponent");
|
||||
if (testObj) {
|
||||
testObj.destroy();
|
||||
}
|
||||
soundsAvailable = true;
|
||||
return true;
|
||||
} catch (e) {
|
||||
soundsAvailable = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function checkGsettings() {
|
||||
Proc.runCommand("checkGsettings", ["sh", "-c", "gsettings get org.gnome.desktop.sound theme-name 2>/dev/null"], (output, exitCode) => {
|
||||
gsettingsAvailable = (exitCode === 0);
|
||||
@@ -1028,10 +1011,7 @@ EOFCONFIG
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (!detectSoundsAvailability()) {
|
||||
console.warn("AudioService: QtMultimedia not available - sound effects disabled");
|
||||
} else {
|
||||
console.info("AudioService: Sound effects enabled");
|
||||
if (soundsAvailable) {
|
||||
checkGsettings();
|
||||
Qt.callLater(createSoundPlayers);
|
||||
}
|
||||
|
||||
35
quickshell/Services/MultimediaService.qml
Normal file
35
quickshell/Services/MultimediaService.qml
Normal file
@@ -0,0 +1,35 @@
|
||||
pragma Singleton
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
property bool available: false
|
||||
|
||||
function detectAvailability() {
|
||||
try {
|
||||
const testObj = Qt.createQmlObject(`
|
||||
import QtQuick
|
||||
import QtMultimedia
|
||||
Item {}
|
||||
`, root, "MultimediaService.TestComponent");
|
||||
if (testObj) {
|
||||
testObj.destroy();
|
||||
}
|
||||
available = true;
|
||||
return true;
|
||||
} catch (e) {
|
||||
available = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (!detectAvailability()) {
|
||||
console.warn("MultimediaService: QtMultimedia not available");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user