summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAylur <[email protected]>2024-10-03 21:39:40 +0000
committerAylur <[email protected]>2024-10-03 21:39:40 +0000
commita6141011c2bed071eb908f4468274f44e18dc64a (patch)
treee0fdb65386d99f3d9a5860e41a737e4f1805fb84 /docs
parentc3093f12a7318618cfc5a136f618896daea9c5ab (diff)
docs: window toggling
Diffstat (limited to 'docs')
-rw-r--r--docs/guide/ags/cli-app.md36
1 files changed, 36 insertions, 0 deletions
diff --git a/docs/guide/ags/cli-app.md b/docs/guide/ags/cli-app.md
index ceed56a..93f9901 100644
--- a/docs/guide/ags/cli-app.md
+++ b/docs/guide/ags/cli-app.md
@@ -95,6 +95,42 @@ ags -m "return 'hello';"
# hello
```
+## Toggling Windows by their name
+
+In order for AGS to know about your windows, you have to register them.
+You can do this by specifying a **unique** `name` and calling `App.add_window`
+
+```tsx
+import { App } from "astal"
+
+function Bar() {
+ return <window name="Bar" setup={self => App.add_window(self)}>
+ <box />
+ </window>
+}
+```
+
+You can also invoke `App.add_window` by simply passing the `App` to the `application` prop.
+
+```tsx
+import { App } from "astal"
+
+function Bar() {
+ return <window name="Bar" application={App}>
+ <box />
+ </window>
+}
+```
+
+:::warning
+When assigning the `application` prop make sure `name` comes before.
+Props are set sequentially and if name is applied after application it won't work.
+:::
+
+```sh
+ags -t Bar
+```
+
## App without AGS
As mentioned before AGS is only a scaffolding tool. You can setup