elkowar / eww

ElKowars wacky widgets
https://elkowar.github.io/eww
MIT License
8.78k stars 366 forks source link

[WIDGET] Popover widget #234

Open elkowar opened 2 years ago

elkowar commented 2 years ago

Description of the widget

The gtk popover widget can be used to open a small window at a position relative to the main widget. This may have many uses for small dialog popups, etc.

Implementation proposal

https://gtk-rs.org/gtk3-rs/stable/latest/docs/gtk/struct.Popover.html

undefinedDarkness commented 2 years ago

Ill do this at some point if no one else wants to

elkowar commented 2 years ago

Implementing this is probably slightly more complex than most other widgets, as it requires the parent widget to be known before rendering it. I also don't quite know how the config would look - just have an "active" attribute or sth?

undefinedDarkness commented 2 years ago

maybe?

<!-- on-click is dumb, need to think a better way to do that -->
<widget on-click="popover(popup-inner)">...idk widget stuff..</widget>
<popup-inner>
idk whatever you want
</popup-inner>

so when the hover / click event is triggered itll create a popover widget and stuff the contents of window-name in there? idk yuck syntax perfectly just yet

undefinedDarkness commented 2 years ago

Or the other way my monkey brain thinks of is some way to attach a window of popover type, but unless eww gets an id system you wouldnt be able to attach to certain widgets instead of the whole thing

VuiMuich commented 2 years ago

Or the other way my monkey brain thinks of is some way to attach a window of popover type, but unless eww gets an id system you wouldnt be able to attach to certain widgets instead of the whole thing

Maybe give it some :attach-anchor :x Int :y Int?

Sorry for mixing syntax and possibly butchering yuck syntax

elkowar commented 2 years ago

Is there any reason not to just go with

(defvar isopen "false")
(defwidget foo []
  (box
    (button :onclick "eww update isopen=${!isopen}"
      "Click me")
    (popover :open isopen :direction "right"
      "popover content")))
undefinedDarkness commented 2 years ago

Well you cant reuse the popover contents but that would be super unique anyway so yeah thats probably correct

elkowar commented 2 years ago

what do you mean "can't reuse the popover content"?

undefinedDarkness commented 2 years ago

Its nothing, just me being dumb

druskus20 commented 1 year ago

this would be the perfect Christmas present 👀