From eee0d5b4ecf2579aca07ed0c5fbc052df6a59c88 Mon Sep 17 00:00:00 2001 From: Joshua Yuen Date: Sat, 12 Sep 2026 01:28:49 -0400 Subject: [PATCH] Build AGS scaffolding --- modules/home/ags/.gitignore | 2 + modules/home/ags/app/app.ts | 10 ++++ modules/home/ags/app/style.scss | 19 ++++++++ modules/home/ags/app/widget/Bar.tsx | 34 ++++++++++++++ modules/home/ags/default.nix | 72 +++++++++++++++++++++++++++++ modules/home/default.nix | 1 + modules/options/ags.nix | 13 ++++++ modules/options/default.nix | 1 + profiles/desktop/default.nix | 1 + 9 files changed, 153 insertions(+) create mode 100644 modules/home/ags/.gitignore create mode 100644 modules/home/ags/app/app.ts create mode 100644 modules/home/ags/app/style.scss create mode 100644 modules/home/ags/app/widget/Bar.tsx create mode 100644 modules/home/ags/default.nix create mode 100644 modules/options/ags.nix diff --git a/modules/home/ags/.gitignore b/modules/home/ags/.gitignore new file mode 100644 index 0000000..298eb4d --- /dev/null +++ b/modules/home/ags/.gitignore @@ -0,0 +1,2 @@ +node_modules/ +@girs/ diff --git a/modules/home/ags/app/app.ts b/modules/home/ags/app/app.ts new file mode 100644 index 0000000..83217ef --- /dev/null +++ b/modules/home/ags/app/app.ts @@ -0,0 +1,10 @@ +import { App } from "astal/gtk3" +import style from "./style.scss" +import Bar from "./widget/Bar" + +App.start({ + css: style, + main() { + App.get_monitors().map(Bar) + }, +}) diff --git a/modules/home/ags/app/style.scss b/modules/home/ags/app/style.scss new file mode 100644 index 0000000..9e4d14c --- /dev/null +++ b/modules/home/ags/app/style.scss @@ -0,0 +1,19 @@ +@use "palette" as *; + +* { + all: unset; + font-family: $font-family; + font-size: $font-size; +} + +.Bar { + background: transparent; +} + +.bar { + background: $base01; + border-radius: 10px; + margin: 8px; + padding: 4px 12px; + color: $base05; +} diff --git a/modules/home/ags/app/widget/Bar.tsx b/modules/home/ags/app/widget/Bar.tsx new file mode 100644 index 0000000..b4a7fdf --- /dev/null +++ b/modules/home/ags/app/widget/Bar.tsx @@ -0,0 +1,34 @@ +import { App, Astal, Gdk, Gtk } from "astal/gtk3" + +export default function Bar(gdkmonitor: Gdk.Monitor) { + const { TOP, LEFT, RIGHT } = Astal.WindowAnchor + + return ( + + + + + + + + ) +} diff --git a/modules/home/ags/default.nix b/modules/home/ags/default.nix new file mode 100644 index 0000000..5998d72 --- /dev/null +++ b/modules/home/ags/default.nix @@ -0,0 +1,72 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; +let + cfg = config.modules.ags; + hyprlandCfg = config.modules.hyprland; + colors = config.lib.stylix.colors.withHashtag; + + base16Names = [ + "base00" + "base01" + "base02" + "base03" + "base04" + "base05" + "base06" + "base07" + "base08" + "base09" + "base0A" + "base0B" + "base0C" + "base0D" + "base0E" + "base0F" + ]; + + palette = pkgs.writeText "palette.scss" (concatStringsSep "\n" ( + map (name: "$" + name + ": " + colors.${name} + ";") base16Names + ++ [ + ''$font-family: "${config.stylix.fonts.sansSerif.name}";'' + "$font-size: ${toString config.stylix.fonts.sizes.desktop}px;" + ] + )); + + astalDeps = with pkgs.astal; [ + astal3 + io + hyprland + network + battery + wireplumber + ]; + + ags-bar = pkgs.ags.bundle { + pname = "ags-bar"; + version = "0.1.0"; + src = ./app; + entry = "app.ts"; + dependencies = astalDeps; + postUnpack = '' + cp ${palette} "$sourceRoot/palette.scss" + ''; + }; +in +{ + config = mkIf cfg.enable { + home.packages = [ + ags-bar + pkgs.ags + pkgs.dart-sass + ]; + + wayland.windowManager.hyprland = mkIf hyprlandCfg.enable { + settings.exec-once = [ "ags-bar" ]; + }; + }; +} diff --git a/modules/home/default.nix b/modules/home/default.nix index 3569945..f140278 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -3,6 +3,7 @@ }: { imports = [ + ./ags ./battlenet.nix ./direnv.nix ./discord.nix diff --git a/modules/options/ags.nix b/modules/options/ags.nix new file mode 100644 index 0000000..5e74ccd --- /dev/null +++ b/modules/options/ags.nix @@ -0,0 +1,13 @@ +{ + lib, + ... +}: +with lib; +{ + options.modules.ags = { + enable = mkEnableOption { + default = false; + description = "Enable the AGS status bar"; + }; + }; +} diff --git a/modules/options/default.nix b/modules/options/default.nix index 620d505..0844099 100644 --- a/modules/options/default.nix +++ b/modules/options/default.nix @@ -3,6 +3,7 @@ }: { imports = [ + ./ags.nix ./battlenet.nix ./discord.nix ./dictation.nix diff --git a/profiles/desktop/default.nix b/profiles/desktop/default.nix index ee48f5d..f133a2c 100644 --- a/profiles/desktop/default.nix +++ b/profiles/desktop/default.nix @@ -10,6 +10,7 @@ ",preferred,auto,auto" ]; }; + modules.ags.enable = true; modules.plasma.enable = false; modules.display.manager = "gdm";