commit dd102aa1db20b7623d92da065e0554aad1ef700f from: Brett Fisher date: Mon Jun 15 23:07:14 2026 UTC bxbarrc.lua: Refactor workspace loop and refine battery UX. - Use table.insert and table.concat for workspace string building. - Update battery icon logic to use math.ceil for more intuitive visual depletion. - Remove dead code remnants and redundant comments. commit - 2dd667eec2ef8330aa980436f2f15e6bc6129d16 commit + dd102aa1db20b7623d92da065e0554aad1ef700f blob - 2f76ebb2abc7bd4924b30f1350d2cd0a8d5396e9 blob + 7a99241d2e4d8fd091fe38c30b00c653205ca9da --- bxbarrc.lua +++ bxbarrc.lua @@ -45,15 +45,16 @@ local function get_x11_info() end end - local ws_str = "" + local parts = {} for i = 0, total - 1 do if i == current then - ws_str = ws_str .. "[" .. (i + 1) .. "*]" + table.insert(parts, "[" .. (i + 1) .. "*]") elseif occupied[i] then - ws_str = ws_str .. "[" .. (i + 1) .. "]" + table.insert(parts, "[" .. (i + 1) .. "]") end end + local ws_str = table.concat(parts) ws_str = ws_str ~= "" and ws_str or "?" return ws_str, win_title end @@ -67,10 +68,8 @@ local function get_battery(bat_path) local status = h and h:read("*l") or "Unknown" if h then h:close() end --- local filled = math.floor(cap / 12.5) --- local bar = string.rep("|", filled) .. string.rep(" ", 8 - filled) - local filled = math.floor(cap / 25) - local bar = string.rep("|", filled) .. string.rep(" ", 4 - filled) + local filled = math.min(3, math.ceil(cap / 33.33)) + local bar = string.rep("|", filled) .. string.rep(" ", 3 - filled) local charging = (status == "Charging") and "+" or "" return "[" .. bar .. "] " .. cap .. "%" .. charging