(defvar reveal_shortcuts true) (defwidget shortcuts_revealer [] (revealer-on-press :revealvar reveal_shortcuts :revealvar-name "reveal_shortcuts" (button :width 300 :class "revealer-title" "Shortcuts ${reveal_shortcuts ? '' : ''}") (shortcuts))) (defwidget shortcuts [] (box :class "shortcuts" :orientation "v" :space-evenly false :halign "center" :width 300 :height 75 (box ; :visible {jq(workspacesArray, '.[]\|select(.focused==true).num') <= 10} :visible (arraylength(sway_info.workspace_profile.scripts) > 0) :orientation "h" :space-evenly true :halign "center" (for script in {jq(sway_info,'[.workspace_profile.scripts[0,1,2]]','r')} (button :visible "${script?.name!='null'}" :onclick "${script?.command}" :tooltip "${script?.name}" (label :width 60 :height 60 :justify "center" :text "${script?.icon}")) ) ; (button ; :width 60 ; :height 60 ; :onclick "hass-cli -a services -I area_id -i left_bedroom -d light -s toggle" ; (label ; :justify "center" ; :text "󱣝" ; :tooltip "Turn on bedroom lights")) ) (box :visible (arraylength(sway_info.workspace_profile.scripts) > 3) :orientation "h" :space-evenly true :halign "center" (for script in {jq(sway_info, '[.workspace_profile.scripts[3,4,5]]','r')} (button :visible "${script?.name!='null'}" :onclick "${script?.command}" :tooltip "${script?.name}" (label :width 60 :height 60 :justify "center" :text {script?.icon})) )) ))