osds: volume mute colour and show on mute
This commit is contained in:
parent
338669214f
commit
d2457db2c3
2 changed files with 15 additions and 15 deletions
|
|
@ -42,7 +42,7 @@ const SliderOsd = ({
|
||||||
fillIcons?: boolean;
|
fillIcons?: boolean;
|
||||||
monitor: Monitor;
|
monitor: Monitor;
|
||||||
type: keyof typeof config;
|
type: keyof typeof config;
|
||||||
windowSetup: (self: Widget.Window, hideAfterTimeout: () => void) => void;
|
windowSetup: (self: Widget.Window, show: () => void) => void;
|
||||||
className?: string;
|
className?: string;
|
||||||
initValue: number;
|
initValue: number;
|
||||||
drawAreaSetup: (self: Widget.DrawingArea, icon: Variable<string>) => void;
|
drawAreaSetup: (self: Widget.DrawingArea, icon: Variable<string>) => void;
|
||||||
|
|
@ -60,7 +60,10 @@ const SliderOsd = ({
|
||||||
time = timeout(config[type].hideDelay, () => self.hide());
|
time = timeout(config[type].hideDelay, () => self.hide());
|
||||||
};
|
};
|
||||||
self.connect("show", hideAfterTimeout);
|
self.connect("show", hideAfterTimeout);
|
||||||
windowSetup(self, hideAfterTimeout);
|
windowSetup(self, () => {
|
||||||
|
self.show();
|
||||||
|
hideAfterTimeout();
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<box className={type}>
|
<box className={type}>
|
||||||
|
|
@ -75,6 +78,7 @@ const SliderOsd = ({
|
||||||
|
|
||||||
const icon = Variable("");
|
const icon = Variable("");
|
||||||
drawAreaSetup(self, icon);
|
drawAreaSetup(self, icon);
|
||||||
|
self.hook(icon, () => self.queue_draw());
|
||||||
|
|
||||||
// Init size
|
// Init size
|
||||||
const styleContext = self.get_style_context();
|
const styleContext = self.get_style_context();
|
||||||
|
|
@ -123,7 +127,7 @@ const SliderOsd = ({
|
||||||
cr.arc(radius, height - radius, radius, halfPi, Math.PI); // Bottom left
|
cr.arc(radius, height - radius, radius, halfPi, Math.PI); // Bottom left
|
||||||
cr.fill();
|
cr.fill();
|
||||||
|
|
||||||
const fg = styleContext.get_color(Gtk.StateFlags.NORMAL);
|
const fg = pContext.get_background_color(Gtk.StateFlags.NORMAL);
|
||||||
cr.setAntialias(cairo.Antialias.BEST);
|
cr.setAntialias(cairo.Antialias.BEST);
|
||||||
|
|
||||||
// Progress number, at top/right
|
// Progress number, at top/right
|
||||||
|
|
@ -202,11 +206,9 @@ const Volume = ({ monitor, audio }: { monitor: Monitor; audio: AstalWp.Audio })
|
||||||
fillIcons
|
fillIcons
|
||||||
monitor={monitor}
|
monitor={monitor}
|
||||||
type="volume"
|
type="volume"
|
||||||
windowSetup={(self, hideAfterTimeout) => {
|
windowSetup={(self, show) => {
|
||||||
self.hook(audio.defaultSpeaker, "notify::volume", () => {
|
self.hook(audio.defaultSpeaker, "notify::volume", show);
|
||||||
self.show();
|
self.hook(audio.defaultSpeaker, "notify::mute", show);
|
||||||
hideAfterTimeout();
|
|
||||||
});
|
|
||||||
}}
|
}}
|
||||||
className={audio.defaultSpeaker.mute ? "mute" : ""}
|
className={audio.defaultSpeaker.mute ? "mute" : ""}
|
||||||
initValue={audio.defaultSpeaker.volume}
|
initValue={audio.defaultSpeaker.volume}
|
||||||
|
|
@ -236,12 +238,7 @@ const Brightness = ({ monitor }: { monitor: Monitor }) => (
|
||||||
<SliderOsd
|
<SliderOsd
|
||||||
monitor={monitor}
|
monitor={monitor}
|
||||||
type="brightness"
|
type="brightness"
|
||||||
windowSetup={(self, hideAfterTimeout) => {
|
windowSetup={(self, show) => self.hook(monitor, "notify::brightness", show)}
|
||||||
self.hook(monitor, "notify::brightness", () => {
|
|
||||||
self.show();
|
|
||||||
hideAfterTimeout();
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
initValue={monitor.brightness}
|
initValue={monitor.brightness}
|
||||||
drawAreaSetup={(self, icon) => {
|
drawAreaSetup={(self, icon) => {
|
||||||
const update = () => {
|
const update = () => {
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,9 @@
|
||||||
min-width: lib.s(300);
|
min-width: lib.s(300);
|
||||||
min-height: lib.s(32);
|
min-height: lib.s(32);
|
||||||
background-color: scheme.$teal;
|
background-color: scheme.$teal;
|
||||||
color: scheme.$base;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.volume .inner.mute {
|
||||||
|
background-color: scheme.$overlay0;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue