💥 ags(control-center/mixer): get application icon by stream name

This commit is contained in:
retrozinndev
2025-04-23 14:21:20 -03:00
parent ef474e9742
commit ddf4f659b5
3 changed files with 8 additions and 12 deletions
+4
View File
@@ -72,6 +72,10 @@
} }
& .page .content { & .page .content {
& > eventbox > box {
margin: 6px 0;
}
& label.name { & label.name {
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
+1 -1
View File
@@ -69,7 +69,7 @@ class Pages extends Widget.Revealer {
close(onClosed?: () => void): void { close(onClosed?: () => void): void {
if(!this.isOpen) return; if(!this.isOpen) return;
this.set_reveal_child(false); this.revealChild = false;
timeout(this.transitionDuration, () => { timeout(this.transitionDuration, () => {
this.remove(this.#page!); this.remove(this.#page!);
this.page = undefined; this.page = undefined;
+3 -11
View File
@@ -21,7 +21,7 @@ export function PageMixer(): Page {
orientation: Gtk.Orientation.HORIZONTAL, orientation: Gtk.Orientation.HORIZONTAL,
children: [ children: [
new Widget.Icon({ new Widget.Icon({
icon: getStreamIcon(ep) ?? "application-x-executable-symbolic", icon: getAppIcon(ep.name.split(' ')[0]) || "application-x-executable-symbolic",
css: "font-size: 18px; margin-right: 6px;" css: "font-size: 18px; margin-right: 6px;"
} as Widget.IconProps), } as Widget.IconProps),
new Widget.Box({ new Widget.Box({
@@ -38,6 +38,8 @@ export function PageMixer(): Page {
onDestroy: () => connections.map(id => eventbox.disconnect(id)), onDestroy: () => connections.map(id => eventbox.disconnect(id)),
child: new Widget.Label({ child: new Widget.Label({
label: ep.name || "Unknown", label: ep.name || "Unknown",
truncate: true,
tooltipText: ep.name,
className: "name", className: "name",
xalign: 0 xalign: 0
} as Widget.LabelProps) } as Widget.LabelProps)
@@ -60,13 +62,3 @@ export function PageMixer(): Page {
]) ])
} as PageProps); } as PageProps);
} }
function getStreamIcon(endpoint: AstalWp.Endpoint): (string|undefined) {
let icon = getAppIcon(endpoint.icon);
if(icon) return icon;
icon = getAppIcon(endpoint.name.split(' ')[0]);
if(icon) return icon;
return undefined;
}