fix(status-bar): poll for new monitors

This commit is contained in:
2025-09-16 17:54:00 -07:00
parent 9c89c72647
commit b47a0724ae

View File

@@ -1,11 +1,29 @@
import { App } from "astal/gtk3"; import { App, Gdk } from "astal/gtk3";
import style from "./style.scss"; import style from "./style.scss";
import Bar from "./widget/Bar"; import Bar from "./widget/Bar";
import { GLib } from "astal";
App.start({ App.start({
css: style, css: style,
icons: "icons", icons: "icons",
main() { main() {},
App.get_monitors().map(Bar); });
},
let knownMonitors = new Set();
function checkMonitors() {
const currentMonitors = App.get_monitors();
currentMonitors.forEach((monitor) => {
if (!knownMonitors.has(monitor.model)) {
knownMonitors.add(monitor.model);
Bar(monitor);
}
});
}
checkMonitors();
GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 10, () => {
checkMonitors();
return true;
}); });