Skip to content

change widgets class depending on output of script #681

Discussion options

You must be logged in to vote

Yes this is doable but it's not straight forward as you would think. This because one of the side effects/ feature of defpoll is that it cannot set its variable to an empty string if it's already set to something that isn't an empty string. To work around this problem you will probably need to edit your code like so:

(defwidget scratchpad-indicator []
 (box 
      :class "${matches(scratchpad, 'null')?'empty-scratchpad':'scratchpad'}"
      :orientation "h"
      :space-evenly false
      :halign "end"
      :spacing 10
   (button
       :class ""
   :onclick "scripts/scratchpad-indicator.sh ShowInfo"
       scratchpad)
))

(defpoll scratchpad :interval "1s"
 "scripts/scratchpad-indicator…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@justinesmithies
Comment options

Answer selected by justinesmithies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants