mirror of
https://github.com/nickolaj-jepsen/nixos.git
synced 2026-01-22 16:16:50 +01:00
complete rework v3
This commit is contained in:
parent
7409e9ca10
commit
366a0e221a
131 changed files with 20171 additions and 585 deletions
42
parts/modules/desktop/astal/src/config.ts
Normal file
42
parts/modules/desktop/astal/src/config.ts
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import GLib from "gi://GLib"
|
||||
|
||||
type ignoreFn = (test: string) => boolean;
|
||||
|
||||
interface Config {
|
||||
monitor: {
|
||||
main: string;
|
||||
};
|
||||
notification: {
|
||||
ignore: ignoreFn[];
|
||||
};
|
||||
tray: {
|
||||
ignore: ignoreFn[];
|
||||
};
|
||||
}
|
||||
|
||||
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) => {
|
||||
if (r.startsWith("/")) {
|
||||
return new RegExp(r.slice(1, -1)).test;
|
||||
}
|
||||
return (test: string) => test === r;
|
||||
});
|
||||
}
|
||||
|
||||
export default {
|
||||
monitor: {
|
||||
main: GLib.getenv("ASTRAL_PRIMARY_MONITOR") || "",
|
||||
},
|
||||
notification: {
|
||||
ignore: envIgnoreArray("ASTRAL_NOTIFICATION_IGNORE"),
|
||||
},
|
||||
tray: {
|
||||
ignore: envIgnoreArray("ASTRAL_TRAY_IGNORE"),
|
||||
},
|
||||
} as Config;
|
||||
Loading…
Add table
Add a link
Reference in a new issue