diff --git a/app.ts b/app.ts index c6b304d..64c62ce 100644 --- a/app.ts +++ b/app.ts @@ -1,11 +1,25 @@ import app from "ags/gtk4/app" -import style from "./style.scss" +import { exec } from "ags/process" +import GLib from "gi://GLib?version=2.0" import Bar from "./widget/Bar" import PowerMenu from "./widget/PowerMenu" import { restoreTheme } from "./theme" +const HOME = GLib.getenv("HOME") || "" +const colorsPath = `${HOME}/.cache/wal/colors.scss` + +if (!GLib.file_test(colorsPath, GLib.FileTest.EXISTS)) { + console.log("No pywal colors found, generating default from pywal.png...") + const agsDir = `${HOME}/.config/ags` + exec(`wal -q -n -i ${agsDir}/pywal.png`) +} + +const scss = `${HOME}/.config/ags/style.scss` +const css = `/tmp/ags-compiled-style.css` +exec(`sass ${scss} ${css}`) + app.start({ - css: style, + css: css, main() { restoreTheme() app.get_monitors().map(Bar) diff --git a/pywal.png b/pywal.png new file mode 100644 index 0000000..4151adc Binary files /dev/null and b/pywal.png differ