[Astal] Fix audio issues
This commit is contained in:
parent
2e8f1ec9ae
commit
4189258def
@ -1,4 +1,4 @@
|
|||||||
import { bind, Binding } from "astal";
|
import { bind } from "astal";
|
||||||
import { Gtk } from "astal/gtk4";
|
import { Gtk } from "astal/gtk4";
|
||||||
import AstalWp from "gi://AstalWp";
|
import AstalWp from "gi://AstalWp";
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ const AudioModule = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const SinkPicker = (type: AstalWp.MediaClass) => {
|
const SinkPicker = (type: AstalWp.MediaClass) => {
|
||||||
const devices = bind(wp, "endpoints");
|
const devices = bind(wp, "nodes");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<box vertical>
|
<box vertical>
|
||||||
|
51
config/astal/components/QuickActions/modules/Audio/dump
Normal file
51
config/astal/components/QuickActions/modules/Audio/dump
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
|
||||||
|
{devices.as(d => {
|
||||||
|
return d.map(device => {
|
||||||
|
if (device.get_media_class() !== type) {
|
||||||
|
return <box cssClasses={[ 'empty' ]}></box>;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
cssClasses={bind(device, "id").as(id => {
|
||||||
|
if (
|
||||||
|
id ===
|
||||||
|
(type ===
|
||||||
|
AstalWp.MediaClass.AUDIO_SPEAKER
|
||||||
|
? wp.defaultSpeaker.id
|
||||||
|
: type ===
|
||||||
|
AstalWp.MediaClass
|
||||||
|
.AUDIO_MICROPHONE
|
||||||
|
? wp.defaultMicrophone.id
|
||||||
|
: "")
|
||||||
|
) {
|
||||||
|
return [
|
||||||
|
"sink-option",
|
||||||
|
"currently-selected-sink-option",
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
return ["sink-option"];
|
||||||
|
}
|
||||||
|
})}
|
||||||
|
child={
|
||||||
|
<box halign={Gtk.Align.START}>
|
||||||
|
<image
|
||||||
|
iconName={bind(device, "icon").as(
|
||||||
|
icon => icon,
|
||||||
|
)}
|
||||||
|
marginEnd={3}
|
||||||
|
></image>
|
||||||
|
<label
|
||||||
|
label={bind(
|
||||||
|
device,
|
||||||
|
"description",
|
||||||
|
).as(t => t ?? "")}
|
||||||
|
></label>
|
||||||
|
</box>
|
||||||
|
}
|
||||||
|
onClicked={() => {
|
||||||
|
device.set_is_default(true);
|
||||||
|
}}
|
||||||
|
></button>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
})}
|
Loading…
x
Reference in New Issue
Block a user