Build AGS scaffolding

This commit is contained in:
Joshua Yuen 2026-09-12 01:28:49 -04:00
parent 5364812171
commit eee0d5b4ec
Signed by: josh
GPG Key ID: 530DA0331EFE99F5
9 changed files with 153 additions and 0 deletions

2
modules/home/ags/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules/
@girs/

View File

@ -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)
},
})

View File

@ -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;
}

View File

@ -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 (
<window
className="Bar"
namespace="ags-bar"
gdkmonitor={gdkmonitor}
exclusivity={Astal.Exclusivity.EXCLUSIVE}
anchor={TOP | LEFT | RIGHT}
application={App}
>
<centerbox className="bar">
<box
className="bar-left"
halign={Gtk.Align.START}
valign={Gtk.Align.CENTER}
/>
<box
className="bar-center"
halign={Gtk.Align.CENTER}
valign={Gtk.Align.CENTER}
/>
<box
className="bar-right"
halign={Gtk.Align.END}
valign={Gtk.Align.CENTER}
/>
</centerbox>
</window>
)
}

View File

@ -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" ];
};
};
}

View File

@ -3,6 +3,7 @@
}:
{
imports = [
./ags
./battlenet.nix
./direnv.nix
./discord.nix

13
modules/options/ags.nix Normal file
View File

@ -0,0 +1,13 @@
{
lib,
...
}:
with lib;
{
options.modules.ags = {
enable = mkEnableOption {
default = false;
description = "Enable the AGS status bar";
};
};
}

View File

@ -3,6 +3,7 @@
}:
{
imports = [
./ags.nix
./battlenet.nix
./discord.nix
./dictation.nix

View File

@ -10,6 +10,7 @@
",preferred,auto,auto"
];
};
modules.ags.enable = true;
modules.plasma.enable = false;
modules.display.manager = "gdm";