Compare commits

...

2 Commits

Author SHA1 Message Date
Joshua Yuen 1e8e3742f6
more stuff 2026-09-12 00:38:11 -04:00
Joshua Yuen e9bd47d83b
WIP AGS stuff 2026-09-12 00:29:23 -04:00
17 changed files with 412 additions and 0 deletions

View File

@ -1,5 +1,47 @@
{
"nodes": {
"ags": {
"inputs": {
"astal": "astal",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1775689345,
"narHash": "sha256-tM3s7CX+tgxlYW0Sk3nzVThg2MHn08foIuMxABupxIs=",
"owner": "aylur",
"repo": "ags",
"rev": "bbee2f18939f1ec7ff720e717cf305e73635628f",
"type": "github"
},
"original": {
"owner": "aylur",
"repo": "ags",
"type": "github"
}
},
"astal": {
"inputs": {
"nixpkgs": [
"ags",
"nixpkgs"
]
},
"locked": {
"lastModified": 1773914523,
"narHash": "sha256-GOL+bR30FPImAzy4NNsTMY1gpoINMsLTXR0WJBRSq30=",
"owner": "aylur",
"repo": "astal",
"rev": "41b50290c6a1cdce7b482897c22fe49286912b9a",
"type": "github"
},
"original": {
"owner": "aylur",
"repo": "astal",
"type": "github"
}
},
"base16": {
"inputs": {
"fromYaml": "fromYaml"
@ -260,6 +302,7 @@
},
"root": {
"inputs": {
"ags": "ags",
"elephant": "elephant",
"home-manager": "home-manager",
"install-system": "install-system",

View File

@ -18,6 +18,11 @@
inputs.nixpkgs.follows = "nixpkgs";
};
ags = {
url = "github:aylur/ags";
inputs.nixpkgs.follows = "nixpkgs";
};
elephant = {
url = "github:abenz1267/elephant/master";
inputs.nixpkgs.follows = "nixpkgs";

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

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

10
modules/home/ags/app.ts Normal file
View File

@ -0,0 +1,10 @@
import app from "ags/gtk4/app"
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,57 @@
{
config,
lib,
pkgs,
inputs,
...
}:
with lib;
let
cfg = config.modules.ags;
hyprlandCfg = config.modules.hyprland;
astalPackages = with inputs.ags.packages.${pkgs.system}; [
io
astal4
battery
powerprofiles
];
extraPackages = astalPackages ++ [
pkgs.libadwaita
pkgs.libsoup_3
];
myShell = pkgs.stdenv.mkDerivation {
name = "my-shell";
src = ./.;
nativeBuildInputs = with pkgs; [
wrapGAppsHook3
gobject-introspection
inputs.ags.packages.${pkgs.system}.default
];
buildInputs = extraPackages ++ [ pkgs.gjs ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
mkdir -p $out/share
cp -r * $out/share
ags bundle app.ts $out/bin/my-shell -d "SRC='$out/share'"
runHook postInstall
'';
};
in
{
config = mkIf cfg.enable {
home.packages = [ myShell ];
wayland.windowManager.hyprland.settings.exec-once = mkIf hyprlandCfg.enable [
"my-shell"
];
};
}

21
modules/home/ags/env.d.ts vendored Normal file
View File

@ -0,0 +1,21 @@
declare const SRC: string
declare module "inline:*" {
const content: string
export default content
}
declare module "*.scss" {
const content: string
export default content
}
declare module "*.blp" {
const content: string
export default content
}
declare module "*.css" {
const content: string
export default content
}

View File

@ -0,0 +1,70 @@
{
"nodes": {
"ags": {
"inputs": {
"astal": "astal",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1775689345,
"narHash": "sha256-tM3s7CX+tgxlYW0Sk3nzVThg2MHn08foIuMxABupxIs=",
"owner": "aylur",
"repo": "ags",
"rev": "bbee2f18939f1ec7ff720e717cf305e73635628f",
"type": "github"
},
"original": {
"owner": "aylur",
"repo": "ags",
"type": "github"
}
},
"astal": {
"inputs": {
"nixpkgs": [
"ags",
"nixpkgs"
]
},
"locked": {
"lastModified": 1782062955,
"narHash": "sha256-FGZHls4eQJ8y3pvf5h3b83PfXlve3vD/Gj3g1qoAK6o=",
"owner": "aylur",
"repo": "astal",
"rev": "11842ae3045c1367fb3a62a2302dba0d9ccb4a33",
"type": "github"
},
"original": {
"owner": "aylur",
"repo": "astal",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1782467914,
"narHash": "sha256-pGvFkM8N0xEkIIXDe5YYfbEAvHrk4IxBrjB/x8OomhE=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e73de5be04e0eff4190a1432b946d469c794e7b4",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"ags": "ags",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View File

@ -0,0 +1,74 @@
{
description = "My Awesome Desktop Shell";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
ags = {
url = "github:aylur/ags";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
ags,
}: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
pname = "my-shell";
entry = "app.ts";
astalPackages = with ags.packages.${system}; [
io
astal4 # or astal3 for gtk3
battery
powerprofiles
# notifd tray wireplumber
];
extraPackages =
astalPackages
++ [
pkgs.libadwaita
pkgs.libsoup_3
];
in {
packages.${system} = {
default = pkgs.stdenv.mkDerivation {
name = pname;
src = ./.;
nativeBuildInputs = with pkgs; [
wrapGAppsHook3
gobject-introspection
ags.packages.${system}.default
];
buildInputs = extraPackages ++ [pkgs.gjs];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
mkdir -p $out/share
cp -r * $out/share
ags bundle ${entry} $out/bin/${pname} -d "SRC='$out/share'"
runHook postInstall
'';
};
};
devShells.${system} = {
default = pkgs.mkShell {
buildInputs = [
(ags.packages.${system}.default.override {
inherit extraPackages;
})
];
};
};
};
}

View File

@ -0,0 +1,10 @@
{
"dependencies": {
"ags": "*",
"gnim": "*"
},
"prettier": {
"semi": false,
"tabWidth": 2
}
}

View File

@ -0,0 +1,20 @@
// https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/theme/Adwaita/_colors-public.scss
$fg-color: #{"@theme_fg_color"};
$bg-color: #{"@theme_bg_color"};
window.Bar {
background: transparent;
color: $fg-color;
font-weight: bold;
> centerbox {
background: $bg-color;
border-radius: 10px;
margin: 8px;
}
button {
border-radius: 8px;
margin: 2px;
}
}

View File

@ -0,0 +1,14 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"strict": true,
"module": "ES2022",
"target": "ES2020",
"lib": ["ES2023"],
"moduleResolution": "Bundler",
// "checkJs": true,
// "allowJs": true,
"jsx": "react-jsx",
"jsxImportSource": "ags/gtk4"
}
}

View File

@ -0,0 +1,33 @@
import app from "ags/gtk4/app"
import { Astal, Gtk, Gdk } from "ags/gtk4"
import { createPoll } from "ags/time"
import BatteryWidget from "./Battery";
export default function Bar(gdkmonitor: Gdk.Monitor) {
const time = createPoll("", 1000, "date '+%a %b %d %l:%M:%S %p'");
const { TOP, LEFT, RIGHT } = Astal.WindowAnchor;
return (
<window
visible
name="bar"
class="Bar"
gdkmonitor={gdkmonitor}
exclusivity={Astal.Exclusivity.EXCLUSIVE}
anchor={TOP | LEFT | RIGHT}
application={app}
>
<centerbox cssName="centerbox">
<menubutton $type="center" hexpand halign={Gtk.Align.CENTER}>
<label label={time} />
<popover>
<Gtk.Calendar />
</popover>
</menubutton>
<box $type="end">
<BatteryWidget />
</box>
</centerbox>
</window>
)
}

View File

@ -0,0 +1,36 @@
import AstalBattery from "gi://AstalBattery";
import AstalPowerProfiles from "gi://AstalPowerProfiles";
import { createBinding } from "ags";
import { Gtk } from "ags/gtk4";
export default function BatteryWidget() {
const battery = AstalBattery.get_default()
const powerprofiles = AstalPowerProfiles.get_default()
const percent = createBinding(
battery,
"percentage",
)((p) => `${Math.floor(p * 100)}%`)
const setProfile = (profile: string) => {
powerprofiles.set_active_profile(profile)
}
return (
<menubutton visible={createBinding(battery, "isPresent")}>
<box>
<image iconName={createBinding(battery, "iconName")} />
<label label={percent} />
</box>
<popover>
<box orientation={Gtk.Orientation.VERTICAL}>
{powerprofiles.get_profiles().map(({ profile }) => (
<button onClicked={() => setProfile(profile)}>
<label label={profile} xalign={0} />
</button>
))}
</box>
</popover>
</menubutton>
)
}

View File

@ -3,6 +3,7 @@
}:
{
imports = [
./ags
./direnv.nix
./discord.nix
./firefox.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 shell";
};
};
}

View File

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

View File

@ -15,6 +15,8 @@
modules.localsend.enable = true;
modules.ags.enable = true;
modules.zsh.enable = true;
modules.shell.defaultShell = "zsh";