💥 ags: fix startup issues (and with that, errors with focusedClient bar widget)

This commit is contained in:
retrozinndev
2025-02-04 21:45:18 -03:00
parent 11f919ab1d
commit 80969071c4
21 changed files with 363 additions and 200 deletions
@@ -1,16 +1,22 @@
import { bind } from "astal";
import { Gtk, Widget } from "astal/gtk3";
import { Astal, Widget } from "astal/gtk3";
import AstalWp from "gi://AstalWp?version=0.1";
import { Wireplumber } from "../../scripts/volume";
const wp = AstalWp.get_default();
export function Audio() {
return wp && new Widget.Button({
return wp && new Widget.EventBox({
className: "audio",
child: new Widget.Box({
children: [
new Widget.EventBox({
className: "sink",
onScroll: (_, event) =>
event.delta_y > 0 ?
Wireplumber.getDefault().decreaseSinkVolume(5)
:
Wireplumber.getDefault().increaseSinkVolume(5),
child: new Widget.Box({
children: [
new Widget.Label({
@@ -22,11 +28,16 @@ export function Audio() {
label: bind(wp!.defaultSpeaker, "volume").as((volume: number) =>
Math.round(volume * 100).toString() + "%")
} as Widget.LabelProps)
]
]
})
} as Widget.EventBoxProps),
new Widget.EventBox({
className: "source",
onScroll: (_, event) =>
event.delta_y > 0 ?
Wireplumber.getDefault().decreaseSourceVolume(5)
:
Wireplumber.getDefault().increaseSourceVolume(5),
child: new Widget.Box({
children: [
new Widget.Label({
@@ -42,5 +53,5 @@ export function Audio() {
} as Widget.EventBoxProps)
]
} as Widget.BoxProps)
} as Widget.ButtonProps);
} as Widget.EventBoxProps);
}
@@ -13,7 +13,11 @@ export function FocusedWindow() {
new Widget.Icon({
className: "icon",
icon: bind(hyprland, "focusedClient").as((client: AstalHyprland.Client) =>
getAppIcon(client.initialClass) || "image-missing"),
client ?
(getAppIcon(client.initialClass) || client.initialClass)
:
"image-missing"
),
iconSize: Gtk.IconSize.SMALL_TOOLBAR
}),
new Widget.Box({
@@ -25,13 +29,13 @@ export function FocusedWindow() {
className: "class",
xalign: 0,
label: bind(hyprland, "focusedClient").as((client: AstalHyprland.Client) =>
client?.["class"])
client ? client.class : "")
} as Widget.LabelProps),
new Widget.Label({
className: "title",
xalign: 0,
label: bind(hyprland, "focusedClient").as((client: AstalHyprland.Client) =>
client?.["title"])
client ? client.title : "")
} as Widget.LabelProps)
]
})