forked from Shinonome/dots-hyprland
fixed unwanted popup when changing device
This commit is contained in:
@@ -63,12 +63,11 @@ export default (monitor = 0) => {
|
|||||||
progress.value = updateValue;
|
progress.value = updateValue;
|
||||||
}, 'notify::screen-value'),
|
}, 'notify::screen-value'),
|
||||||
});
|
});
|
||||||
|
|
||||||
const volumeIndicator = OsdValue({
|
const volumeIndicator = OsdValue({
|
||||||
name: 'Volume',
|
name: 'Volume',
|
||||||
extraClassName: 'osd-volume',
|
extraClassName: 'osd-volume',
|
||||||
extraProgressClassName: 'osd-volume-progress',
|
extraProgressClassName: 'osd-volume-progress',
|
||||||
attribute: { headphones: undefined },
|
attribute: { headphones: undefined , device: undefined},
|
||||||
nameSetup: (self) => Utils.timeout(1, () => {
|
nameSetup: (self) => Utils.timeout(1, () => {
|
||||||
const updateAudioDevice = (self) => {
|
const updateAudioDevice = (self) => {
|
||||||
const usingHeadphones = (Audio.speaker?.stream?.port)?.toLowerCase().includes('headphone');
|
const usingHeadphones = (Audio.speaker?.stream?.port)?.toLowerCase().includes('headphone');
|
||||||
@@ -87,8 +86,14 @@ export default (monitor = 0) => {
|
|||||||
}),
|
}),
|
||||||
progressSetup: (self) => self.hook(Audio, (progress) => {
|
progressSetup: (self) => self.hook(Audio, (progress) => {
|
||||||
const updateValue = Audio.speaker?.volume;
|
const updateValue = Audio.speaker?.volume;
|
||||||
|
const newDevice = (Audio.speaker?.name);
|
||||||
|
// print(newDevice, device);
|
||||||
if (!isNaN(updateValue)) {
|
if (!isNaN(updateValue)) {
|
||||||
if (updateValue !== progress.value) Indicator.popup(1);
|
if ((volumeIndicator.attribute.device === undefined || newDevice === volumeIndicator.attribute.device)
|
||||||
|
&& updateValue !== progress.value) {
|
||||||
|
Indicator.popup(1);
|
||||||
|
}
|
||||||
|
volumeIndicator.attribute.device = newDevice;
|
||||||
progress.value = updateValue;
|
progress.value = updateValue;
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user