✨ ags: make osd work, new window management system, lots of improvements
This commit is contained in:
+27
-15
@@ -1,36 +1,48 @@
|
||||
import { App } from "astal/gtk3"
|
||||
import { Bar } from "./window/Bar";
|
||||
import { OSD } from "./window/OSD";
|
||||
|
||||
import { OSD, OSDModes, setOSDMode } from "./window/OSD";
|
||||
import { ControlCenter } from "./window/ControlCenter";
|
||||
|
||||
import { runStyleHandler } from "./scripts/style-handler";
|
||||
import { handleArguments } from "./scripts/arg-handler";
|
||||
import { monitorPaths } from "./scripts/reload-handler";
|
||||
import { Wireplumber } from "./scripts/volume";
|
||||
import { Windows } from "./windows";
|
||||
import { Time, timeout } from "astal/time";
|
||||
|
||||
|
||||
export const astalInstanceName = "astal"
|
||||
let osdTimer: (Time|undefined);
|
||||
|
||||
App.start({
|
||||
instanceName: astalInstanceName || "astal",
|
||||
instanceName: "astal",
|
||||
requestHandler(request: string, res: (result: any) => void) {
|
||||
console.log(`[LOG] Arguments received: ${request}`)
|
||||
res(handleArguments(request));
|
||||
},
|
||||
main() {
|
||||
console.log(`[LOG] Initialized astal instance as: ${ astalInstanceName || "astal" }`);
|
||||
console.log(`[LOG] Initialized astal instance as: ${ App.instanceName || "astal" }`);
|
||||
console.log(`[LOG] Running Stylesheet handler`);
|
||||
runStyleHandler();
|
||||
//console.log(`[LOG] Starting to monitor scripts to automatically reload instance`);
|
||||
//monitorPaths(); // Only for debugging purposes(testing new widgets and stuff)
|
||||
|
||||
Wireplumber.getDefault().getDefaultSink().connect("notify::volume", () =>
|
||||
!Windows.isVisible(ControlCenter) && triggerOSD(OSDModes.SINK));
|
||||
}
|
||||
});
|
||||
|
||||
// Windows list
|
||||
export function getWindowsMap(): Object {
|
||||
return {
|
||||
"bar": Bar,
|
||||
"osd": OSD,
|
||||
"control-center": ControlCenter,
|
||||
//"floating-notifications": FloatingNotifications
|
||||
};
|
||||
function triggerOSD(osdModeParam: OSDModes) {
|
||||
setOSDMode(osdModeParam);
|
||||
|
||||
Windows.open(OSD);
|
||||
if(!osdTimer) {
|
||||
osdTimer = timeout(3000, () => {
|
||||
Windows.close(OSD);
|
||||
osdTimer = undefined;
|
||||
});
|
||||
} else {
|
||||
osdTimer.cancel();
|
||||
osdTimer = timeout(3000, () => {
|
||||
Windows.close(OSD);
|
||||
osdTimer = undefined;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user