⚡ ags(apps-window, osd): drop astal variables on ::destroy
This commit is contained in:
@@ -117,6 +117,7 @@ export const AppsWindow = (mon: number): (Widget.Window) => {
|
|||||||
marginTop: 64,
|
marginTop: 64,
|
||||||
onDestroy: () => {
|
onDestroy: () => {
|
||||||
searchSubscription?.();
|
searchSubscription?.();
|
||||||
|
searchString.drop();
|
||||||
flowboxConnections.map(id => flowbox.disconnect(id));
|
flowboxConnections.map(id => flowbox.disconnect(id));
|
||||||
},
|
},
|
||||||
onKeyPressEvent: (_, event: Gdk.Event) => {
|
onKeyPressEvent: (_, event: Gdk.Event) => {
|
||||||
|
|||||||
+22
-9
@@ -7,20 +7,26 @@ export enum OSDModes {
|
|||||||
BRIGHTNESS
|
BRIGHTNESS
|
||||||
}
|
}
|
||||||
|
|
||||||
let osdMode: Variable<OSDModes> = new Variable<OSDModes>(OSDModes.SINK);
|
let osdMode: (Variable<OSDModes>|null);
|
||||||
let osdIcon: Binding<string | undefined> = osdMode().as((mode: OSDModes) => {
|
let osdIcon: (Binding<string | undefined>|null);
|
||||||
|
|
||||||
|
export function setOSDMode(newMode: OSDModes): void {
|
||||||
|
if(!osdMode) return;
|
||||||
|
|
||||||
|
osdMode.set(newMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const OSD = (mon: number) => {
|
||||||
|
osdMode = new Variable<OSDModes>(OSDModes.SINK);
|
||||||
|
osdIcon = osdMode().as((mode: OSDModes) => {
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
case OSDModes.SINK: return "";
|
case OSDModes.SINK: return "";
|
||||||
case OSDModes.BRIGHTNESS: return "";
|
case OSDModes.BRIGHTNESS: return "";
|
||||||
default: return "";
|
default: return "";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export function setOSDMode(newMode: OSDModes): void {
|
return new Widget.Window({
|
||||||
osdMode.set(newMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
export const OSD = (mon: number) => new Widget.Window({
|
|
||||||
namespace: "osd",
|
namespace: "osd",
|
||||||
layer: Astal.Layer.OVERLAY,
|
layer: Astal.Layer.OVERLAY,
|
||||||
anchor: Astal.WindowAnchor.BOTTOM,
|
anchor: Astal.WindowAnchor.BOTTOM,
|
||||||
@@ -29,6 +35,12 @@ export const OSD = (mon: number) => new Widget.Window({
|
|||||||
focusOnClick: false,
|
focusOnClick: false,
|
||||||
clickThrough: true,
|
clickThrough: true,
|
||||||
monitor: mon,
|
monitor: mon,
|
||||||
|
onDestroy: () => {
|
||||||
|
osdMode?.drop();
|
||||||
|
|
||||||
|
osdMode = null;
|
||||||
|
osdIcon = null;
|
||||||
|
},
|
||||||
child: new Widget.Box({
|
child: new Widget.Box({
|
||||||
className: "osd",
|
className: "osd",
|
||||||
children: [
|
children: [
|
||||||
@@ -76,4 +88,5 @@ export const OSD = (mon: number) => new Widget.Window({
|
|||||||
} as Widget.BoxProps)
|
} as Widget.BoxProps)
|
||||||
]
|
]
|
||||||
} as Widget.BoxProps)
|
} as Widget.BoxProps)
|
||||||
} as Widget.WindowProps);
|
} as Widget.WindowProps);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user