Aylur / astal

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

How to implement a calendar widget? #93

Closed mylinuxforwork closed 1 week ago

mylinuxforwork commented 1 week ago

Have you read through the documentation?

Describe what have you tried so far I am using ags in my configuration and v1 included the possibility to add a calendar widget.

Describe your question Is there a way with astral to generate a similar calendar widget? Couldn’t find it in the shipped widget list.

PoSayDone commented 1 week ago

Works for me

import { GObject } from "astal";
import { astalify, ConstructProps, Gtk } from "astal/gtk3";

class Calendar extends astalify(Gtk.Calendar) {
    static {
        GObject.registerClass(this);
    }

    constructor(
        props: ConstructProps<Gtk.Calendar, Gtk.Calendar.ConstructorProps>,
    ) {
        super(props as any);
    }
}

export default () => {
    return (
        <box className={"calendar"}>
            {new Calendar({ hexpand: true, vexpand: true })}
        </box>
    );
};
mylinuxforwork commented 1 week ago

@PoSayDone Great. Thank you. Will try later.

Aylur commented 1 week ago

https://aylur.github.io/ags/guide/migrate.html#widgets https://docs.gtk.org/gtk3/class.Calendar.html