Skip to content

Commit

Permalink
ags: add simple bar
Browse files Browse the repository at this point in the history
  • Loading branch information
brckd committed Mar 28, 2024
1 parent 47c7c58 commit 42d18d8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
8 changes: 7 additions & 1 deletion modules/home/ags/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
Expand All @@ -12,11 +13,16 @@ in {
programs.ags = {
configDir = ./.;
};

xdg.configFile."ags".recursive = true;

xdg.configFile."ags/src/style/colors.css".text =
concatMapStringsSep "\n"
(color: "@define-color ${color} ${colors.withHashtag.${color}};")
colorNames;

xdg.configFile."ags/src/assets/nixos-symbolic.svg".source = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/NixOS/nixos-artwork/35ebbbf01c3119005ed180726c388a01d4d1100c/logo/white.svg";
hash = "sha256-Ed2l6i2wi/YTcWCq23bspH/t3RYp6AodykpXF1Zgccw=";
};
};
}
5 changes: 4 additions & 1 deletion modules/home/ags/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import Bar from "./widget/Bar";

App.addIcons(`${App.configDir}/src/assets`);
App.config({
windows: [],
windows: [Bar(0)],
style: `${App.configDir}/src/style/global.css`,
});
21 changes: 21 additions & 0 deletions modules/home/ags/src/widget/Bar/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export default (monitor = 0) => Widget.Window({
monitor,
name: `bar-${monitor}`,
anchor: ['top', 'left', 'right'],
child: Widget.CenterBox({
startWidget: Widget.Box({
hexpand: true,
hpack: "start",
child: Widget.Icon("nixos-symbolic"),
}),
centerWidget: Widget.Box({
hpack: "center",
child: Widget.Label().poll(1000, self => self.label = Utils.exec("date")),
}),
endWidget: Widget.Box({
hexpand: true,
hpack: "end",
child: Widget.Icon("nixos-symbolic"),
}),
}),
});

0 comments on commit 42d18d8

Please sign in to comment.