(defwidget hardware [ ?cpu ?memory ?visible ] (eventbox :class "hardware-eventbox button" :onclick "sh ${EWW_CONFIG_DIR}/scripts/eww-window.sh toggle hardware-monitor" :visible { visible == "" || visible ? true : false } (box :class "hardware" :space-evenly false (box :class "cpu" :visible { cpu == "" || cpu ? true : false } :tooltip { "CPU: " + arraylength(EWW_CPU?.cores) + " Threads" } (label :text " ${ round(EWW_CPU?.avg, 0) }%") ) (box :class "memory" :visible { memory == "" || memory ? true : false } :tooltip { "Total Memory: " + round(EWW_RAM?.total_mem / 1000000000, 1) + " GiB(s)" } (label :text " ${ round(EWW_RAM?.used_mem_perc, 0) }%") ) ) ) )