File tree Expand file tree Collapse file tree 2 files changed +42
-5
lines changed Expand file tree Collapse file tree 2 files changed +42
-5
lines changed Original file line number Diff line number Diff line change @@ -19,11 +19,12 @@ function setChildren(parent: Gtk.Widget, children: Gtk.Widget[]) {
19
19
if ( ch )
20
20
parent . remove ( ch )
21
21
}
22
- else if ( parent instanceof Gtk . Container &&
23
- ! ( parent instanceof Astal . Box ||
24
- parent instanceof Astal . Stack ) ) {
25
- for ( const ch of parent . get_children ( ) )
26
- parent . remove ( ch )
22
+ else if (
23
+ parent instanceof Gtk . Container &&
24
+ ! ( parent instanceof Astal . Box || parent instanceof Astal . Stack )
25
+ ) {
26
+ for ( const ch of parent . get_children ( ) )
27
+ parent . remove ( ch )
27
28
}
28
29
29
30
// TODO: add more container types
Original file line number Diff line number Diff line change @@ -95,6 +95,42 @@ ags -m "return 'hello';"
95
95
# hello
96
96
```
97
97
98
+ ## Toggling Windows by their name
99
+
100
+ In order for AGS to know about your windows, you have to register them.
101
+ You can do this by specifying a ** unique** ` name ` and calling ` App.add_window `
102
+
103
+ ``` tsx
104
+ import { App } from " astal"
105
+
106
+ function Bar() {
107
+ return <window name = " Bar" setup = { self => App .add_window (self )} >
108
+ <box />
109
+ </window >
110
+ }
111
+ ```
112
+
113
+ You can also invoke ` App.add_window ` by simply passing the ` App ` to the ` application ` prop.
114
+
115
+ ``` tsx
116
+ import { App } from " astal"
117
+
118
+ function Bar() {
119
+ return <window name = " Bar" application = { App } >
120
+ <box />
121
+ </window >
122
+ }
123
+ ```
124
+
125
+ ::: warning
126
+ When assigning the ` application ` prop make sure ` name ` comes before.
127
+ Props are set sequentially and if name is applied after application it won't work.
128
+ :::
129
+
130
+ ``` sh
131
+ ags -t Bar
132
+ ```
133
+
98
134
## App without AGS
99
135
100
136
As mentioned before AGS is only a scaffolding tool. You can setup
You can’t perform that action at this time.
0 commit comments