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

How to check for focus on specific window? #115

Open danielwerg opened 1 week ago

danielwerg commented 1 week ago

Have you read through the documentation?

Describe what have you tried so far

<clock-widget
  ...
  onHover={() => setWindowVisible('calendar', true)}
  onHoverLost={async () => {
    await sleep(1000);
    // check if calendar is in focus?
    setWindowVisible('calendar', false);
  }}
/>

Describe your question

I'm trying to open calendar widget by hovering or clicking on clock widget, don't have issue with that part. But I haven't figured a good way to close it. Couldn't figure out how to do it with hover. Closing by clicking on clock again works it's just too much mouse movement. Maybe pressing a key like ESC could work?