v3
There are two main goals with this:
- target regular gtk applications that use gjs
- having to maintain less code by removing the gjs and lua lib from the astal repo
- gjs lib is split into two:
- core lib is aylur/gjsx which targets gtk3 gtk4 and gnome shell extensions
- ags lib that has a few more utils and reexports gjsx
- lua lib will be maintained by tokyob0t
- I have no plans to work on a python lib anymore but there is a wip by 0x6e6174
- gjs lib is split into two:
What this means for you is a few things:
- fundamental distinction between class and function components
- no more
astalifywrappers, JSX expressions handle everything- in cases where you need the type of the widget the
jsxfunction can be used directly - you can still use the old v1 syntax by simply wrapping widgets in a jsx function call (its a one liner)
- in cases where you need the type of the widget the
- few syntax changes, e.g
onSignal->$signalonNotifyProperty->$$propertysetup->$cssClasses->class(in gtk4, its just an alias, cssClasses can still be used)className->class(gtk3)
VariableAPI is gone and replaced byStatePollWatch- new
Forcomponent which takes care of list rendering (idea taken from Solidjs) - dynamic rendering is a bit less intuitive with the
Withcomponent but its a lot more performant childrenproperty can be typechecked with TypeScript- and a few more smaller changes
For the cli a few QOL changes
--gtk4flag is no longer required, gtk version is inferred from code- bundling embeds js code into a bash script, which means its no longer needed to manually use LD_PRELOAD
- nix: remove
ags.lib.bundle, since it is very easy to write a derivation
TODO:
- [x] update docs
- [ ] port examples
@Aylur hi, eagerly waiting this and #660 to get merged so that i could start creating my first shell. Is there any expected date when these would be merged. I can't control my excitement 🥳
The latest ETA is around August It has actually been ready to use for a while now - I’ve already ported my private shell to it. I just haven’t had much time to work on the docs, since this release also involves rewriting the Astal docs.
If you want to try it out
# install dependencies: meson ninja golang gtk4 gtk4-layler-shell
git clone --branch v3 --recursive-submodules https://github.com/Aylur/ags.git
cd ags
meson setup --prefix $HOME/.local build # or `--prefix /usr` for system wide install
meson install -C build
or using nix
nix shell github:aylur/ags/v3#agsFull
thank you @Aylur. I'll try the new version and if possible i could help for documentation if you need.
Any plans to reduce memory footprint? It hogs gigs of RAM tho.
I made an Arch PKGBUILD that will use the latest commit of this branch in case anyone wants it: https://gist.github.com/thomascft/8989dd7aa83d04519d7185dcb392b490
Also, here's a patch for the Watch constructor. Figured I'd drop it here since it's probably not worth a PR.
diff --git a/lib/src/state.ts b/lib/src/state.ts
index d2ba279..a78510d 100644
--- a/lib/src/state.ts
+++ b/lib/src/state.ts
@@ -111,6 +111,13 @@ export class Watch<T> extends State<T> {
constructor(init: T)
+ constructor(
+ init: T,
+ exec: Exec,
+ transform?: Transform<T>,
+ onError?: ErrHandler<T>
+ )
+
constructor(init: T, exec?: Exec, transform?: Transform<T>, onError?: ErrHandler<T>) {
super(init)
if (typeof exec === "string") {
Any plans to reduce memory footprint? It hogs gigs of RAM tho
With https://github.com/Aylur/gjsx/pull/5 memory leaks now should be fixed, or at least there is now a way to fix them.
If you still experience leaks in the future it will be probably because you forgot to use onCleanup
With https://github.com/Aylur/gjsx/pull/5 memory leaks now should be fixed, or at least there is now a way to fix them.
If you still experience leaks in the future it will be probably because you forgot to use
onCleanup
Is this shipped out-of-the-box with libastal-git on AUR?