(deflisten activeWorkspace :initial '1' 'scripts/bar/active-workspace') (deflisten workspacesArray :initial '[{"name": "placeholder","focused":true,"num":0}]' 'scripts/bar/workspaces') (defvar wsreveal false) (defwidget workspaces [array] (eventbox :onhover "${EWW_CMD} update wsreveal=true" :onhoverlost "${EWW_CMD} update wsreveal=false" (box :class "workspaces ${((activeWorkspace > '30') ? 'profile-work' : ((activeWorkspace > '20') ? 'profile-school' : ((activeWorkspace > '10') ? 'profile-development' : ((activeWorkspace > '0') ? 'profile-personal' : ''))))}" :orientation "h" :space-evenly false :halign "start" (revealer :class "ws-left" :reveal wsreveal :transition "slideleft" :duration "500ms" (box (for entry in array (literal :visible {((entry.num <= activeWorkspace) && !entry.focused) ? true : false} :content {((entry.num <= activeWorkspace) && !entry.focused) ? "(workspace :ws entry :side 'left')" : "(box :visible false)"})))) (box :class "ws-center ${wsreveal}" (for entry in array (literal :visible {entry.focused ? true : false} :content {entry.focused ? "(workspace :ws entry :side 'center' :lastws ${jq(array,'.[-1].num')})" : "(box :visible false)"}))) (revealer :class "ws-right" :reveal wsreveal :transition "slideright" :duration "500ms" (box (for entry in array (literal :visible {((entry.num >= activeWorkspace) && !entry.focused) ? true : false} :content {((entry.num >= activeWorkspace) && !entry.focused) ? "(workspace :ws entry :side 'right')" : "(box :visible false)"}))))))) (defwidget workspace [ws side ?lastws ?firstws] (button :onclick `swaymsg workspace "${ws.name}"` :class '${side} ${ws.num == lastws ? "last-workspace" : (ws.num == firstws ? "first-workspace" : "middle-workspace")} ${((ws.num > '30') ? 'profile-work' : ((ws.num > '20') ? 'profile-school' : ((ws.num > '10') ? 'profile-development' : ((ws.num > '0') ? 'profile-personal' : ''))))}' (box '${replace(ws.name,".*:","")}' (label :class "workspace-number" :text {jq(captures(ws.num, '[0-9]$'),'.[].[]','r')}))))