Skip to content

Commit c58cf37

Browse files
committed
add ags
1 parent d2cb740 commit c58cf37

File tree

7 files changed

+104
-0
lines changed

7 files changed

+104
-0
lines changed

modules/home-manager/ags/.envrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
use nix -A shell
2+
3+
nix build -f ./default.nix agsTypes -o ./types
4+
5+
typescript="$(nix build -f ./default.nix pkgs.nodePackages.typescript^out --print-out-paths --no-link)"
6+
7+
mkdir -p .vscode
8+
tee .vscode/settings.json <<EOF
9+
{
10+
"typescript.tsdk": "$typescript/lib/node_modules/typescript/lib"
11+
}
12+
EOF

modules/home-manager/ags/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/.direnv
2+
/types
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"typescript.tsdk": "/nix/store/8h5s7xk9pq5i0nqv5qhs6pn4vw8mrj5f-typescript-5.5.2/lib/node_modules/typescript/lib"
3+
}

modules/home-manager/ags/config.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* @import { Variable as VariableT } from "./types/variable"
3+
*/
4+
5+
/**
6+
* @param {VariableT<number>} _var
7+
*/
8+
function incLoop(_var) {
9+
_var.value++;
10+
setTimeout(() => incLoop(_var), 1000);
11+
}
12+
13+
const myVar = Variable(0);
14+
15+
incLoop(myVar);
16+
17+
18+
const myBar = Widget.Window({
19+
name: "bar",
20+
anchor: ["bottom", "left", "right"],
21+
class_name: "bar",
22+
exclusivity: "exclusive",
23+
child: Widget.Label({
24+
label: myVar.bind().as(v => `value: ${v}`)
25+
}),
26+
})
27+
28+
App.config({
29+
style: 'style.css',
30+
windows: [
31+
myBar
32+
]
33+
})

modules/home-manager/ags/default.nix

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{pkgs ? import <nixpkgs> {}}: {
2+
shell = with pkgs;
3+
mkShell {
4+
packages = [
5+
nodePackages.typescript
6+
nodePackages.typescript-language-server
7+
ags
8+
];
9+
};
10+
11+
agsTypes =
12+
pkgs.runCommandLocal "ags-types" {
13+
nativeBuildInputs = [
14+
pkgs.which
15+
pkgs.ags
16+
];
17+
} ''
18+
ags --init --config ./config.js
19+
ln -vsfT $(realpath ./types) $out
20+
'';
21+
22+
inherit pkgs;
23+
}

modules/home-manager/ags/style.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
window {
2+
font-size: 1.5rem;
3+
}
4+
5+
window.bar {
6+
background-color: red;
7+
/* padding: 20px; */
8+
}
9+
10+
window.bar > * {
11+
padding: 20px;
12+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2022",
4+
"module": "ES2022",
5+
"lib": [
6+
"ES2022"
7+
],
8+
"allowJs": true,
9+
"checkJs": true,
10+
"strict": true,
11+
"noImplicitAny": false,
12+
"baseUrl": ".",
13+
"typeRoots": [
14+
"./types"
15+
],
16+
"skipLibCheck": true,
17+
"strictNullChecks": true,
18+
}
19+
}

0 commit comments

Comments
 (0)