⚡ ags(control-center): drop astal variables onDestroy()
This commit is contained in:
@@ -4,9 +4,6 @@ import AstalHyprland from "gi://AstalHyprland";
|
|||||||
import { Windows } from "../../windows";
|
import { Windows } from "../../windows";
|
||||||
import { Wallpaper } from "../../scripts/wallpaper";
|
import { Wallpaper } from "../../scripts/wallpaper";
|
||||||
|
|
||||||
const uptime = new Variable<string>("Just turned on").poll(1000,
|
|
||||||
() => exec("uptime -p").replace(/^up /, "")
|
|
||||||
);
|
|
||||||
|
|
||||||
function LockButton(): Widget.Button {
|
function LockButton(): Widget.Button {
|
||||||
return new Widget.Button({
|
return new Widget.Button({
|
||||||
@@ -60,7 +57,11 @@ function LogoutButton(): Widget.Button {
|
|||||||
} as Widget.ButtonProps);
|
} as Widget.ButtonProps);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const QuickActions = () => new Widget.Box({
|
export const QuickActions = () => {
|
||||||
|
const uptime = new Variable<string>("Just turned on").poll(1000,
|
||||||
|
() => exec("uptime -p").replace(/^up /, ""));
|
||||||
|
|
||||||
|
return new Widget.Box({
|
||||||
className: "quickactions",
|
className: "quickactions",
|
||||||
children: [
|
children: [
|
||||||
new Widget.Box({
|
new Widget.Box({
|
||||||
@@ -79,6 +80,7 @@ export const QuickActions = () => new Widget.Box({
|
|||||||
className: "uptime",
|
className: "uptime",
|
||||||
xalign: 0,
|
xalign: 0,
|
||||||
tooltipText: "Uptime",
|
tooltipText: "Uptime",
|
||||||
|
onDestroy: () => uptime.drop(),
|
||||||
label: uptime().as((uptime: string) => ` ${uptime}`)
|
label: uptime().as((uptime: string) => ` ${uptime}`)
|
||||||
} as Widget.LabelProps)
|
} as Widget.LabelProps)
|
||||||
]
|
]
|
||||||
@@ -97,4 +99,5 @@ export const QuickActions = () => new Widget.Box({
|
|||||||
]
|
]
|
||||||
} as Widget.BoxProps)
|
} as Widget.BoxProps)
|
||||||
]
|
]
|
||||||
} as Widget.BoxProps);
|
} as Widget.BoxProps);
|
||||||
|
}
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ export function PageSound(): Page {
|
|||||||
new Widget.Label({
|
new Widget.Label({
|
||||||
className: "sub-header",
|
className: "sub-header",
|
||||||
label: tr("apps"),
|
label: tr("apps"),
|
||||||
|
visible: endpoints.filter((ep) => ep.mediaClass === AstalWp.MediaClass.AUDIO_STREAM ||
|
||||||
|
ep.mediaClass === AstalWp.MediaClass.VIDEO_STREAM).length > 0,
|
||||||
setup: (self) => self.set_alignment(0, .5)
|
setup: (self) => self.set_alignment(0, .5)
|
||||||
} as Widget.LabelProps),
|
} as Widget.LabelProps),
|
||||||
...endpoints.filter((ep) => ep.mediaClass === AstalWp.MediaClass.AUDIO_STREAM ||
|
...endpoints.filter((ep) => ep.mediaClass === AstalWp.MediaClass.AUDIO_STREAM ||
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ export function Tile(props: TileProps): (() => Gtk.Widget) {
|
|||||||
onClick: () => {
|
onClick: () => {
|
||||||
if(toggled.get()) {
|
if(toggled.get()) {
|
||||||
toggled.set(false);
|
toggled.set(false);
|
||||||
console.log(toggled.get());
|
|
||||||
props.onToggledOff && props.onToggledOff();
|
props.onToggledOff && props.onToggledOff();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user