(deflisten activeWorkspace :initial '0' 'scripts/bar/active-workspace') (deflisten workspacesArray :initial '[{"name": "placeholder","focused":true,"num":0}]' 'scripts/bar/workspaces') (defvar wsreveal true) (defwidget workspaces [array] (box :class "workspaces" :orientation "h" :space-evenly false :halign "start" (revealer :reveal wsreveal :transition "slideleft" :duration "500ms" (box (for entry in array (literal :visible {(entry.num < activeWorkspace) ? true : false} :content {(entry.num < activeWorkspace) ? "(workspace :ws entry)" : "(box :visible false)"})))) (box (for entry in array (literal :visible {entry.focused ? true : false} :content {entry.focused ? "(workspace :ws entry)" : "(box :visible false)"}))) (revealer :reveal wsreveal :transition "slideright" :duration "500ms" (box (for entry in array (literal :visible {(entry.num > activeWorkspace) ? true : false} :content {(entry.num > activeWorkspace) ? "(workspace :ws entry)" : "(box :visible false)"})))))) ; (for entry in array ; {entry.focused ? (workspace :ws entry) : ""}))) ; (for ws in {} ; (box ; (literal ; :visible {(entry.num < jq(array, '.. | select(.type?) | select(.focused==true).num', 'r')) ? true : false} ; :content {(entry.num < jq(array, '.. | select(.type?) | select(.focused==true).num', 'r')) ? "(workspace :ws entry)" : "(box :visible false)"}) ; (literal ; :visible {entry.focused ? true : false} ; :content {entry.focused ? "(workspace :ws entry)" : "(box :visible false)"}) ; (literal ; :visible {(entry.num > jq(array, '.. | select(.type?) | select(.focused==true).num')) ? true : false} ; :content {(entry.num > jq(array, '.. | select(.type?) | select(.focused==true).num')) ? "(workspace :ws entry)" : "(box :visible false)"}))))) ;; {entry.focused ? "${entry.num}" : ""}))) ; (button :onclick `swaymsg workspace "${entry.name}"` ; :class {entry.focused ? "focused" : ""} ; (box ; '${replace(entry.name,".*:","")}' ; (label ; :class "workspace-number" ; :text {jq(captures(entry.num, '[0-9]$'),'.[].[]','r')})))))) (defwidget workspace [ws] (button :onclick `swaymsg workspace "${ws.name}"` :class {ws.focused ? "focused" : ""} (box '${replace(ws.name,".*:","")}' (label :class "workspace-number" :text {jq(captures(ws.num, '[0-9]$'),'.[].[]','r')})))) ;(defwidget workspaces [array] ;(box :class "workspaces" ; :orientation "h" ; :space-evenly false ; :halign "start" ; ; (for entry in array ; (button :onclick `swaymsg workspace "${entry.name}"` ; :class {entry.focused ? "focused" : ""} ; (box ; '${replace(entry.name,".*:","")}' ; (label ; :class "workspace-number" ; :text {jq(captures(entry.num, '[0-9]$'),'.[].[]','r')}))))))