elkowar/eww

[FEATURE] define placeholder "{}" as var

Opened this issue · 0 comments

Description of the requested feature

As far as I can see the {} placeholder in the :onscroll option in the eventbox widget is inserted into the executed command. To work with it the common way is to use a shell condition and do things depending on that.

The example:

(defwidget example []
    (eventbox :onscroll "if [ '{}' == 'up' ]; then echo up; else echo down; fi"

... more settings ...

)

It would be cool if the condition would be possible in the existing yuck way. To get this done we need a predefined variable that contains the event information. Something like this, so that no shell condition is needed (only a shell command is used as example):

(defwidget example []
    (eventbox :onscroll "${( onscroll.direction == "up" ? "echo up" : "echo down" )}"

... more settings ...

)

This idea is probably not only relevant for :onscroll but also for other functions that use {}.