fix(ags osd): only show speaker osd when using keys

This commit is contained in:
matt1432 2023-12-15 09:17:03 -05:00
parent 1efe609696
commit e01d1721a6
2 changed files with 11 additions and 5 deletions

View file

@ -1,4 +1,5 @@
import Audio from 'resource:///com/github/Aylur/ags/service/audio.js'; import Audio from 'resource:///com/github/Aylur/ags/service/audio.js';
import Variable from 'resource:///com/github/Aylur/ags/variable.js';
import { Label } from 'resource:///com/github/Aylur/ags/widget.js'; import { Label } from 'resource:///com/github/Aylur/ags/widget.js';
import OSD from './ctor.js'; import OSD from './ctor.js';
@ -10,12 +11,17 @@ import { MicIcon } from '../misc/audio-icons.js';
const AUDIO_MAX = 1.5; const AUDIO_MAX = 1.5;
const ShowSpeaker = Variable(true);
globalThis.showSpeaker = () => {
ShowSpeaker.value = !ShowSpeaker.value;
};
export const SpeakerOSD = (stack) => OSD({ export const SpeakerOSD = (stack) => OSD({
stack, stack,
icon: { binds: [['icon', SpeakerIcon, 'value']] }, icon: { binds: [['icon', SpeakerIcon, 'value']] },
info: { info: {
mod: Audio, mod: ShowSpeaker,
signal: 'speaker-changed',
logic: (self) => { logic: (self) => {
if (!Audio.speaker) { if (!Audio.speaker) {
return; return;

View file

@ -182,13 +182,13 @@ in {
",Print, exec, grim -g \"$(slurp)\" - | swappy -f -" ",Print, exec, grim -g \"$(slurp)\" - | swappy -f -"
"$mainMod SHIFT, C, exec, wl-color-picker" "$mainMod SHIFT, C, exec, wl-color-picker"
",XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle" ",XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle & ags -r 'showSpeaker()' &"
",XF86AudioMicMute, exec, pactl set-source-mute @DEFAULT_SOURCE@ toggle" ",XF86AudioMicMute, exec, pactl set-source-mute @DEFAULT_SOURCE@ toggle"
]; ];
binde = [ binde = [
",XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+" ",XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+ & ags -r 'showSpeaker()' &"
",XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" ",XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- & ags -r 'showSpeaker()' &"
]; ];
# Mouse Binds # Mouse Binds