elkowar / eww

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

[FEATURE] Way to make the main window hide and only show on hover (similar to how MacOS's dock works) #831

Open ffernn-dev opened 1 year ago

ffernn-dev commented 1 year ago

Description of the requested feature

Not quite sure how this would be implemented in config, perhaps just :autohide true. Basically if your window is a bar and you turn this on, it will hide and slide in when the mouse is on the edge of the screen it's pinned to.

Proposed configuration syntax

No response

Additional context

No response

fufexan commented 1 year ago

This can already be done with a revealer somewhat. You can have an eventbox containing a revealer which contains the window contents. By default the revealer is inactive, and when hovering over the eventbox you can update a variable that triggers the revealer's state, thus showing the window.

Zettexe commented 1 year ago

Heres some code I have for doing this for anyone interested in doing the same (its a bottom bar but im sure you can figure out how to put it anywhere you wish)

(defwidget bottom_bar_layout []
  (box 
    :class "bar bottom"
    :halign "start"
    :space-evenly false
    (player)
    (separator)
    (disk)
    (separator_single)
  )
)

(defvar show_bar false)
(defwindow bottom-bar
  :monitor 0
  :geometry (geometry
    :y "0px"
    :width "100%"
    :height "1px"
    :anchor "bottom center"
  )
  :stacking "fg"
  (eventbox
    :halign "start" 
    :onhover "${EWW_CMD} update show_bar=true"
    :onhoverlost "${EWW_CMD} update show_bar=false"
    (revealer
      :transition "slideup"
      :reveal show_bar
      :duration "350ms"
      (bottom_bar_layout)
    )
  )
)