35 lines
902 B
TypeScript
35 lines
902 B
TypeScript
import app from "ags/gtk4/app";
|
|
import { Gdk } from "ags/gtk4";
|
|
import style from "./style.scss";
|
|
import Bar from "./Bar";
|
|
import NotificationPopups from "./notifications/NotificationPopups";
|
|
|
|
const PREFERRED_MONITOR = "eDP-1";
|
|
|
|
function pick_monitor(): Gdk.Monitor | undefined {
|
|
const monitors = app.get_monitors();
|
|
return (
|
|
monitors.find((m: Gdk.Monitor) => m.get_connector() === PREFERRED_MONITOR) ??
|
|
monitors[0]
|
|
);
|
|
}
|
|
|
|
function register_windows(monitor: Gdk.Monitor) {
|
|
let scale = (monitor.get_geometry().width >= 3000) ? 1.2 : 1;
|
|
Bar(monitor, scale);
|
|
NotificationPopups();
|
|
}
|
|
|
|
app.start({
|
|
css: style,
|
|
iconTheme: "Papirus",
|
|
main() {
|
|
const monitor = pick_monitor();
|
|
if (!monitor) {
|
|
console.error("No monitors available, not creating the bar.");
|
|
return;
|
|
}
|
|
register_windows(monitor);
|
|
},
|
|
});
|