init
This commit is contained in:
21
packages/ags/example/ts-starter-config/README.md
Normal file
21
packages/ags/example/ts-starter-config/README.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# TypeScript Starter Config
|
||||
|
||||
Dependency: `bun`
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.config/ags
|
||||
git clone https://github.com/Aylur/ags.git /tmp/ags
|
||||
cp -r /tmp/ags/example/ts-starter-config/* ~/.config/ags
|
||||
```
|
||||
|
||||
optionally setup types
|
||||
|
||||
```bash
|
||||
ags --init -c ~/.config/ags/config.js
|
||||
```
|
||||
|
||||
running
|
||||
|
||||
```bash
|
||||
ags -c ~/.config/ags/config.js &
|
||||
```
|
||||
15
packages/ags/example/ts-starter-config/config.js
Normal file
15
packages/ags/example/ts-starter-config/config.js
Normal file
@@ -0,0 +1,15 @@
|
||||
const main = '/tmp/ags/main.js';
|
||||
|
||||
try {
|
||||
await Utils.execAsync([
|
||||
'bun', 'build', `${App.configDir}/main.ts`,
|
||||
'--outfile', main,
|
||||
'--external', 'resource://*',
|
||||
'--external', 'gi://*',
|
||||
'--external', 'file://*',
|
||||
]);
|
||||
await import(`file://${main}`);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
App.quit();
|
||||
}
|
||||
26
packages/ags/example/ts-starter-config/main.ts
Normal file
26
packages/ags/example/ts-starter-config/main.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
const time = Variable('', {
|
||||
poll: [1000, function() {
|
||||
return Date().toString();
|
||||
}],
|
||||
});
|
||||
|
||||
const Bar = (monitor: number) => Widget.Window({
|
||||
monitor,
|
||||
name: `bar${monitor}`,
|
||||
anchor: ['top', 'left', 'right'],
|
||||
exclusivity: 'exclusive',
|
||||
child: Widget.CenterBox({
|
||||
start_widget: Widget.Label({
|
||||
hpack: 'center',
|
||||
label: 'Welcome to AGS!',
|
||||
}),
|
||||
end_widget: Widget.Label({
|
||||
hpack: 'center',
|
||||
label: time.bind(),
|
||||
}),
|
||||
}),
|
||||
});
|
||||
|
||||
App.config({
|
||||
windows: [Bar(0)],
|
||||
});
|
||||
Reference in New Issue
Block a user