Skip to content

Commit

Permalink
readd missing page: App
Browse files Browse the repository at this point in the history
  • Loading branch information
Aylur committed Jan 20, 2024
1 parent 6e72f5a commit f0bf14a
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const config = [
'Variables',
'Services',
'Utils',
'App',
'Custom Service',
'Subclassing GTK Widgets',
'Examples',
Expand Down
57 changes: 57 additions & 0 deletions src/content/docs/config/app.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: App
description: The Gtk.Application Instance
---

This is the main `Gtk.Application` instance that is running.

## signals

* `window-toggled`: `(windowName: string, visible: boolean)`
* `config-parsed`: emitted on startup

## properties

* `windows`: `Gtk.Window[]`
* `configDir`: `string` path to the config directory

## methods

* `addWindow`: `(window: Gtk.Window) => void`
* `removeWindow`: `(window: Gtk.Window) => void`
* `getWindow`: `(name: string) => Gtk.Window`
* `closeWindow`: `(name: string) => void`
* `openWindow`: `(name: string) => void`
* `toggleWindow`: `(name: string) => void`
* `quit`: `() => void`
* `resetCss`: `() => void`
* `applyCss`: `(path: string) => void`

## Window toggled signal

```js
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
import App from 'resource:///com/github/Aylur/ags/app.js';

// this is only signaled for windows exported in config.js
// or added with App.addWindow
const label = Widget.Label()
.hook(App, (self, windowName, visible) => {
self.label = `${windowName} is ${visible ? 'visible' : 'not visible'}`;
}, 'window-toggled')
});
```

## Applying CSS

If you want to change the style sheet on runtime

```js
import App from 'resource:///com/github/Aylur/ags/app.js';

// if you apply multiple, they are all going to apply on top of each other
App.applyCss('path-to-file');

// to reset applied stylesheets
App.resetCss();
```

0 comments on commit f0bf14a

Please sign in to comment.