ags icon indicating copy to clipboard operation
ags copied to clipboard

v3

Open Aylur opened this issue 10 months ago • 3 comments

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

What this means for you is a few things:

  • fundamental distinction between class and function components
  • no more astalify wrappers, JSX expressions handle everything
    • in cases where you need the type of the widget the jsx function 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)
  • few syntax changes, e.g
    • onSignal -> $signal
    • onNotifyProperty -> $$property
    • setup -> $
    • cssClasses -> class (in gtk4, its just an alias, cssClasses can still be used)
    • className -> class (gtk3)
  • Variable API is gone and replaced by State Poll Watch
  • new For component which takes care of list rendering (idea taken from Solidjs)
  • dynamic rendering is a bit less intuitive with the With component but its a lot more performant
  • children property can be typechecked with TypeScript
  • and a few more smaller changes

For the cli a few QOL changes

  • --gtk4 flag 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 avatar Mar 08 '25 01:03 Aylur

@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 🥳

sharmapukar217 avatar Apr 08 '25 07:04 sharmapukar217

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

Aylur avatar Apr 08 '25 14:04 Aylur

thank you @Aylur. I'll try the new version and if possible i could help for documentation if you need.

sharmapukar217 avatar Apr 08 '25 16:04 sharmapukar217

image Any plans to reduce memory footprint? It hogs gigs of RAM tho.

AlphaNecron avatar Jun 03 '25 11:06 AlphaNecron

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

thomascft avatar Jun 10 '25 15:06 thomascft

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") {

thomascft avatar Jun 10 '25 21:06 thomascft

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

Aylur avatar Jun 12 '25 00:06 Aylur

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?

AlphaNecron avatar Jun 15 '25 13:06 AlphaNecron