Aylur / astal

Building blocks for creating custom desktop shells
https://aylur.github.io/astal/
GNU Lesser General Public License v2.1
208 stars 22 forks source link

AstalHyprland: Can't convert non-null pointer to JS value #87

Closed vafu closed 2 hours ago

vafu commented 2 hours ago

Describe the bug Unable to get hyprland workspaces

To Reproduce

import { App } from "astal/gtk3"
import AstalHyprland from "gi://AstalHyprland?version=0.1"

App.start({
    main() {
        console.log(AstalHyprland.get_default().workspaces)
    },
})

Expected behavior no crash

Actual behavior

(gjs:415135): Gjs-CRITICAL **: 23:59:50.138: JS ERROR: Error: Can't convert non-null pointer to JS value
main@file:///run/user/1000/ags.js:741:31
mkApp/start/<@file:///run/user/1000/ags.js:557:15
_init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:263:34
kotontrion commented 2 hours ago

This is a common issue: https://aylur.github.io/astal/guide/typescript/faq#error-can-t-convert-non-null-pointer-to-js-value

gjs can't access GObect properties when they are arrays/lists. You have to use the getter method.

vafu commented 2 hours ago

omg I'm blind, ty