elkowar / eww

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

[FEATURE] Timeout duration for windows to be temporarily shown and then automatically hidden #846

Open isti115 opened 1 year ago

isti115 commented 1 year ago

Description of the requested feature

I am creating a volume indicator, that I would like to appear on screen whenever I make adjustments to the audio levels, but only for about three seconds, and disappear afterwards. (Yes, I know about wob, but I'd also like to display media information on the popup.)

My current workaround is to have the widget call a delayed close command for itself like this:

(defpoll dummy
  :interval "0s"
  'sleep 3; eww --config $HOME/.config/eww/volume/ close volume')

Which is a bit hacky and impractical. I think that it would also be a useful behavior to have the timeout period reset if a new open call arrives, e.g. keeping the volume panel open during adjustments and only hiding it three seconds after the last interaction. Sort of debouncing to the trailing edge.

Proposed configuration syntax

I think that in terms of configuration syntax, it would be enough to add a numeric :timeout property to defwindow.

Or, on a second thought, maybe this should be a parameter given to the open command instead? (Like --toggle.)


ps.: I'd be happy to work on this myself, if you agree with the inclusion of this feature and could give me some pointers in case I get stuck.

elkowar commented 1 year ago

Definitely planning to implement this, probably via a command line flag like "--duration" on the eww open command!

Harsh-007-max commented 1 year ago

so how do we actually use the dummy named variable I want to use it for my volbar