diff --git a/docs/guide/example.md b/docs/guide/example.md index de9d2070..ae9c777b 100644 --- a/docs/guide/example.md +++ b/docs/guide/example.md @@ -4,7 +4,9 @@ Simple dialog example to get a `no`/`yes` answer. ![2024-11-13_00-45-58](https://github.com/user-attachments/assets/73a20155-fa0e-4156-aff8-3a0d055abb9b) -```tsx +:::code-group + +```tsx [dialog.ts] #!/usr/bin/ags run import { App, Astal, Gtk, Gdk } from "astal/gtk3" @@ -88,10 +90,12 @@ App.start({ }) ``` +::: + Then it can be used in any script. ```sh -if [[ "$(script -a Shutdown)" == "yes" ]]; then +if [[ "$(./dialog.ts -a Shutdown)" == "yes" ]]; then shutdown now fi ``` diff --git a/docs/guide/migrate.md b/docs/guide/migrate.md index dc8db76d..93529e5a 100644 --- a/docs/guide/migrate.md +++ b/docs/guide/migrate.md @@ -56,7 +56,7 @@ App.config({ }) App.main({ // [!code ++:5] main() { - Widget.Window() + new Widget.Window() } }) ``` @@ -186,7 +186,7 @@ is also a lot more flexible. ## Globals -`App`, `Service`, `Utils`, `Widget`, `Variable` is no longer globally available +`App`, `Service`, `Utils`, `Widget`, `Variable` are no longer globally available ```js import { Widget, App } from "astal/gtk3" @@ -199,7 +199,7 @@ import Variable from "astal/variable" ## Services These are no longer called `Service`. There is no longer a distinction -between a `Service` and `GObject.Object` and they are no longer builtin. +between a `Service` and `GObject.Object` and there are no longer builtin Services. These are now simply external [libraries](https://aylur.github.io/astal/guide/libraries/references#astal-libraries) that will have to be installed next to AGS. They are now implemented in Vala or C @@ -254,7 +254,7 @@ File, Process and Time utility functions are available from their own Utils.exec("command") // [!code --:3] Utils.readFile("file") Utils.timeout(1000, callback) -import { exec, readFile, timeout} from "astal" // [!code ++:4] +import { exec, readFile, timeout } from "astal" // [!code ++:4] exec("command") readFile("file") timeout(1000, callback) @@ -283,6 +283,19 @@ To make windows toggleable through cli you will have to now [pass the `App` instance to `Window`](https://aylur.github.io/astal/guide/typescript/cli-app#toggling-windows-by-their-name) instances instead of passing a an array of windows to `App.config`. +```js +App.config({ // [!code --:5] + windows: [ + Widget.Window({ name: "window-name" }) + ] +}) +App.start({ // [!code ++:5] + main() { + + } +}) +``` + `ags --run-js` have been retired in favor of [requests](https://aylur.github.io/astal/guide/typescript/cli-app#messaging-from-cli). ```ts