mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-03 20:32:07 -04:00
audio: disable effects when mpris player is playing
This commit is contained in:
@@ -32,11 +32,7 @@ Singleton {
|
|||||||
property var mediaDevicesConnections: null
|
property var mediaDevicesConnections: null
|
||||||
|
|
||||||
property var deviceAliases: ({})
|
property var deviceAliases: ({})
|
||||||
property string wireplumberConfigPath: {
|
property string wireplumberConfigPath: Paths.strip(StandardPaths.writableLocation(StandardPaths.ConfigLocation)) + "/wireplumber/wireplumber.conf.d/51-dms-audio-aliases.conf"
|
||||||
const homeUrl = StandardPaths.writableLocation(StandardPaths.HomeLocation);
|
|
||||||
const homePath = homeUrl.toString().replace("file://", "");
|
|
||||||
return homePath + "/.config/wireplumber/wireplumber.conf.d/51-dms-audio-aliases.conf";
|
|
||||||
}
|
|
||||||
property bool wireplumberReloading: false
|
property bool wireplumberReloading: false
|
||||||
|
|
||||||
readonly property int sinkMaxVolume: {
|
readonly property int sinkMaxVolume: {
|
||||||
@@ -146,9 +142,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function writeWireplumberConfig() {
|
function writeWireplumberConfig() {
|
||||||
const homeUrl = StandardPaths.writableLocation(StandardPaths.HomeLocation);
|
const configDir = Paths.strip(StandardPaths.writableLocation(StandardPaths.ConfigLocation)) + "/wireplumber/wireplumber.conf.d";
|
||||||
const homePath = homeUrl.toString().replace("file://", "");
|
|
||||||
const configDir = homePath + "/.config/wireplumber/wireplumber.conf.d";
|
|
||||||
const configContent = generateWireplumberConfig();
|
const configContent = generateWireplumberConfig();
|
||||||
|
|
||||||
const shellCmd = `mkdir -p "${configDir}" && cat > "${wireplumberConfigPath}" << 'EOFCONFIG'
|
const shellCmd = `mkdir -p "${configDir}" && cat > "${wireplumberConfigPath}" << 'EOFCONFIG'
|
||||||
@@ -282,9 +276,7 @@ EOFCONFIG
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadDeviceAliases() {
|
function loadDeviceAliases() {
|
||||||
const homeUrl = StandardPaths.writableLocation(StandardPaths.HomeLocation);
|
const configPath = wireplumberConfigPath;
|
||||||
const homePath = homeUrl.toString().replace("file://", "");
|
|
||||||
const configPath = homePath + "/.config/wireplumber/wireplumber.conf.d/51-dms-audio-aliases.conf";
|
|
||||||
|
|
||||||
Proc.runCommand("readWireplumberConfig", ["cat", configPath], (output, exitCode) => {
|
Proc.runCommand("readWireplumberConfig", ["cat", configPath], (output, exitCode) => {
|
||||||
if (exitCode !== 0) {
|
if (exitCode !== 0) {
|
||||||
@@ -658,34 +650,38 @@ EOFCONFIG
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isMediaPlaying() {
|
||||||
|
return MprisController.activePlayer?.isPlaying ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
function playVolumeChangeSound() {
|
function playVolumeChangeSound() {
|
||||||
if (soundsAvailable && volumeChangeSound && !notificationsAudioMuted) {
|
if (!soundsAvailable || !volumeChangeSound || notificationsAudioMuted || isMediaPlaying())
|
||||||
volumeChangeSound.play();
|
return;
|
||||||
}
|
volumeChangeSound.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
function playPowerPlugSound() {
|
function playPowerPlugSound() {
|
||||||
if (soundsAvailable && powerPlugSound && !notificationsAudioMuted) {
|
if (!soundsAvailable || !powerPlugSound || notificationsAudioMuted || isMediaPlaying())
|
||||||
powerPlugSound.play();
|
return;
|
||||||
}
|
powerPlugSound.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
function playPowerUnplugSound() {
|
function playPowerUnplugSound() {
|
||||||
if (soundsAvailable && powerUnplugSound && !notificationsAudioMuted) {
|
if (!soundsAvailable || !powerUnplugSound || notificationsAudioMuted || isMediaPlaying())
|
||||||
powerUnplugSound.play();
|
return;
|
||||||
}
|
powerUnplugSound.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
function playNormalNotificationSound() {
|
function playNormalNotificationSound() {
|
||||||
if (soundsAvailable && normalNotificationSound && !SessionData.doNotDisturb && !notificationsAudioMuted) {
|
if (!soundsAvailable || !normalNotificationSound || SessionData.doNotDisturb || notificationsAudioMuted || isMediaPlaying())
|
||||||
normalNotificationSound.play();
|
return;
|
||||||
}
|
normalNotificationSound.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
function playCriticalNotificationSound() {
|
function playCriticalNotificationSound() {
|
||||||
if (soundsAvailable && criticalNotificationSound && !SessionData.doNotDisturb && !notificationsAudioMuted) {
|
if (!soundsAvailable || !criticalNotificationSound || SessionData.doNotDisturb || notificationsAudioMuted || isMediaPlaying())
|
||||||
criticalNotificationSound.play();
|
return;
|
||||||
}
|
criticalNotificationSound.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
function playVolumeChangeSoundIfEnabled() {
|
function playVolumeChangeSoundIfEnabled() {
|
||||||
|
|||||||
Reference in New Issue
Block a user