(defpoll software_list :interval "43200s"
  'software-release-monitor')
(defwidget softwareupdates [json]
  (box
    :visible {(jq(workspacesArray, '.[]\|select(.focused==true).num') <= 19) && (jq(workspacesArray, '.[]\|select(.focused==true).num') >= 10)}
    :class "notes"
    :orientation "v"
    :halign "baseline"
    :width 300
    :height 150
    :space-evenly true
    (for software in json
      (button :onclick "notify-send '${software.package_name} is ${(software.up_to_date == 'true' ) ? 'up to date!' : 'outdated!'}' 'upstream: ${software.upstream_version}\\npackage: ${software.package_version}'"
        (box 
          :orientation "h"
          :space-evenly false
          (label
;;            :xalign 0
            :halign "start"
            :hexpand true
            :wrap false
            :truncate true
            :text "${software.package_name}")
          (box
            :orientation "v"
            :halign "end"
            (label
              :valign "end"
              :halign "end"
              :class "details"
              :text "${software.upstream_version} ")
            (label
              :valign "start"
              :halign "end"
              :class "details"
              :text "${software.package_version} "))
          (label
            :halign "end"
            :class "status"
            :style {(software.up_to_date == "true" ) ? "color: green;" : "color: red;"}
            :text {(software.up_to_date == "true" ) ? "" : ""}))))
    ))
