This commit is contained in:
Nickolaj Jepsen 2025-02-19 23:42:24 +01:00
parent 73d096b328
commit 3b0ed14d85
36 changed files with 663 additions and 1032 deletions

View file

@ -5,6 +5,11 @@
config,
...
}: let
primaryMonitorName =
if builtins.length config.monitors > 0
then (builtins.elemAt config.monitors 0).name
else "";
packageName = "fireproof-shell";
cfg = config.modules.astral;
package = inputs.ags.lib.bundle {
@ -27,9 +32,9 @@
in {
options = {
modules.astral.primaryMonitor = lib.mkOption {
type = lib.types.string;
default = "";
example = "M27Q";
type = lib.types.str;
default = primaryMonitorName;
example = "DP-1";
};
modules.astral.notificationIgnores = lib.mkOption {
type = lib.types.listOf lib.types.str;
@ -44,32 +49,32 @@ in {
};
config = {
environment.systemPackages = [package inputs.ags.packages.${pkgs.system}.agsFull];
environment.systemPackages = [package inputs.ags.packages.${pkgs.system}.agsFull];
fireproof.home-manager = {
systemd.user.services.astal = {
Unit = {
Description = "Astal";
Documentation = "https://github.com/Aylur/astal";
After = ["graphical-session.target"];
};
fireproof.home-manager = {
systemd.user.services.astal = {
Unit = {
Description = "Astal";
Documentation = "https://github.com/Aylur/astal";
After = ["graphical-session.target"];
};
Service = {
ExecStart = "${package}/bin/${packageName}";
Restart = "on-failure";
KillMode = "mixed";
Slice = "app-graphical.slice";
DefaultEnvironment = ''
ASTRAL_PRIMARY_MONITOR=${cfg.primaryMonitor}
ASTRAL_NOTIFICATION_IGNORE=${lib.concatStringsSep "," cfg.notificationIgnores}
ASTRAL_TRAY_IGNORE=${lib.concatStringsSep "," cfg.trayIgnore}
'';
};
Service = {
ExecStart = "${package}/bin/${packageName}";
Restart = "on-failure";
KillMode = "mixed";
Slice = "app-graphical.slice";
Environment = [
"ASTRAL_PRIMARY_MONITOR=${cfg.primaryMonitor}"
"ASTRAL_NOTIFICATION_IGNORE=${lib.concatStringsSep "," cfg.notificationIgnores}"
"ASTRAL_TRAY_IGNORE=${lib.concatStringsSep "," cfg.trayIgnore}"
];
};
Install = {
WantedBy = ["graphical-session.target"];
Install = {
WantedBy = ["graphical-session.target"];
};
};
};
};
};
}
}

View file

@ -1,4 +1,4 @@
import GLib from "gi://GLib"
import GLib from "gi://GLib";
type ignoreFn = (test: string) => boolean;
@ -18,7 +18,7 @@ const envArray = (name: string): string[] => {
const value = GLib.getenv(name);
if (!value) return [];
return value.split(",");
}
};
const envIgnoreArray = (name: string): ignoreFn[] => {
return envArray(name).map((r: string) => {
@ -27,7 +27,7 @@ const envIgnoreArray = (name: string): ignoreFn[] => {
}
return (test: string) => test === r;
});
}
};
export default {
monitor: {

View file

@ -12,12 +12,13 @@ export const getMonitors = (): {
} => {
const scanFn = [
// Monitor in config
(monitor: Gdk.Monitor) => config.monitor.main === monitor.get_model(),
(monitor: Gdk.Monitor) => config.monitor.main === monitor.get_connector(),
// First monitor
() => true,
];
const monitors = App.get_monitors();
console.log("config.monitor.main", config.monitor.main);
const main =
scanFn.map((fn) => monitors.find(fn)).find((m) => m) || monitors[0];
const secondary = monitors