Aylur / astal

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

Don't close tooltip when Variable updates #108

Closed danielwerg closed 2 hours ago

danielwerg commented 2 hours ago

Have you read through the documentation?

Describe your question

I have Variable that updates every 5000 ms with pool and then being display as tooltip using tooltipText.

https://github.com/user-attachments/assets/fba337c9-e620-4bb8-8e50-e014e297cb1c

On every update tooltip closes, is there way to prevent this?


https://aylur.github.io/astal/guide/ags/faq returns 404

Aylur commented 2 hours ago

Can't repro, binding tooltipText works as expected

import App from "astal/gtk3/app"
import Variable from "astal/variable"
import Astal from "gi://Astal?version=3.0"

App.start({
    instanceName: "test",
    main() {
        const test = Variable(0).poll(1000, () => Math.random())

        return <window keymode={Astal.Keymode.ON_DEMAND}>
            <button tooltipText={test(String)} onClicked={() => App.quit()}>
                <icon icon="window-close-symbolic" />
            </button>
        </window>
    }
})

I'm assuming you are doing something like this

import App from "astal/gtk3/app"
import Variable from "astal/variable"
import Astal from "gi://Astal?version=3.0"

App.start({
    instanceName: "t",
    main() {
        const test = Variable(0).poll(1000, () => Math.random())

        return <window keymode={Astal.Keymode.ON_DEMAND}>
            {test(test => (
                // the whole button is rerendered, expect tooltip to go away 
                <button tooltipText={String(test)} onClicked={() => App.quit()}>
                    <icon icon="window-close-symbolic" />
                </button>
            ))}
        </window>
    }
})