Aylur / astal

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

When add centerbox #129

Closed aopuce closed 5 days ago

aopuce commented 5 days ago

Have you read through the documentation?

Describe what have you tried so far I have followed the installation instruction from astal docs for Arch Linux. When use my widget alone in a bar ags start as expected. But when add a centerbox tag to add more widget ags give me an error:

(gjs:109712): Gjs-CRITICAL **: 11:13:34.424: JS ERROR: Error: Wrong type undefined; object GtkWidget expected
_setChildren@file:///run/user/1000/ags.js:365:9
Widget@file:///run/user/1000/ags.js:428:16
CenterBox@file:///run/user/1000/ags.js:663:5
jsx@file:///run/user/1000/ags.js:821:12
Container_default@file:///run/user/1000/ags.js:893:51
jsx@file:///run/user/1000/ags.js:824:12
Bar@file:///run/user/1000/ags.js:909:33
main@file:///run/user/1000/ags.js:918:32
mkApp/start/<@file:///run/user/1000/ags.js:607:15
_init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:263:34
import { App, Astal, Gtk, Gdk } from "astal/gtk3"
import  Workspaces  from "./Workspaces"
import Clock from "./Clock"

export default function Bar(gdkmonitor: Gdk.Monitor) {
    return <window
        className="Bar"
        gdkmonitor={gdkmonitor}
        namespace="bar"
        exclusivity={Astal.Exclusivity.EXCLUSIVE}
        anchor={Astal.WindowAnchor.TOP
            | Astal.WindowAnchor.LEFT
            | Astal.WindowAnchor.RIGHT}
        application={App}>
            <centerbox>
                <Workspaces />
                <Clock />
            </centerbox>
    </window>
}

Describe your question I don't understand how use centerbox tag, I had also try to add example's bar from this repository but ags return the same error.

kotontrion commented 5 days ago

Center box expects exactly three children, you specified only two.

The centerbox should be made more liberal in how many children it accepts though.

aopuce commented 5 days ago

@kotontrion thank you!