commit - a20ff3ff0fde0e491b71a745cddec65a4072de66
commit + 577714ad5aded98e7cf76260a1556660281292da
blob - 2ffc7b8043f388e465ebe84ecc7fefa2aa632d3c
blob + 5d2fc8e15b42e88ca7161f818e2d0e78ac4758e2
--- Makefile
+++ Makefile
install -d $(DESTDIR)$(PREFIX)/bin
install -m 755 bxbar $(DESTDIR)$(PREFIX)/bin/bxbar
install -m 755 bxinfo $(DESTDIR)$(PREFIX)/bin/bxinfo
- install -m 755 bxbar-ctl.lua $(DESTDIR)$(PREFIX)/bin/bxbar-ctl
+ install -m 755 bxbarrc.lua $(DESTDIR)$(PREFIX)/bin/bxbarrc.lua
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/bxbar
rm -f $(DESTDIR)$(PREFIX)/bin/bxinfo
- rm -f $(DESTDIR)$(PREFIX)/bin/bxbar-ctl
+ rm -f $(DESTDIR)$(PREFIX)/bin/bxbarrc.lua
.PHONY: all clean install uninstall
blob - 49a72351d78295e0ec728fad37516674622b94c6 (mode 644)
blob + /dev/null
--- bxbar-ctl.lua
+++ /dev/null
-#!/usr/bin/env lua5.4
--- bxbar-ctl
-
--- Enforce Lua 5.4+
-if not _VERSION:match("5.4") then
- io.stderr:write("Error: Lua 5.4 required (got " .. _VERSION .. ").\n")
- os.exit(1)
-end
-
-local function get_x11_info()
- local h = io.popen("bxinfo", "r")
- if not h then return "?", "" end
- local total_s = h:read("*l")
- local current_s = h:read("*l")
- local occ_str = h:read("*l")
- local win_title = h:read("*l") or ""
- h:close()
-
- if not total_s or not current_s then return "?", "" end
-
- local total = tonumber(total_s)
- local current = tonumber(current_s)
- local occupied = {}
- if occ_str then
- for n in occ_str:gmatch("%d+") do
- occupied[tonumber(n)] = true
- end
- end
-
- local ws_str = ""
- for i = 0, total - 1 do
- if i == current then
- ws_str = ws_str .. "[" .. (i + 1) .. "*]"
- elseif occupied[i] then
- ws_str = ws_str .. "[" .. (i + 1) .. "]"
- end
- end
-
- ws_str = ws_str ~= "" and ws_str or "?"
- return ws_str, win_title
-end
-
-while true do
- local ws, title = get_x11_info()
- local dt = os.date("%Y-%m-%d %a %H:%M")
-
- -- Left: workspaces + active title | Right: datetime (battery later)
- local left = ws .. " " .. title
- local right = dt
-
- io.write(left .. " | " .. right .. "\n")
- io.flush()
- os.execute("sleep 2")
-end
-
blob - /dev/null
blob + 49a72351d78295e0ec728fad37516674622b94c6 (mode 644)
--- /dev/null
+++ bxbarrc.lua
+#!/usr/bin/env lua5.4
+-- bxbar-ctl
+
+-- Enforce Lua 5.4+
+if not _VERSION:match("5.4") then
+ io.stderr:write("Error: Lua 5.4 required (got " .. _VERSION .. ").\n")
+ os.exit(1)
+end
+
+local function get_x11_info()
+ local h = io.popen("bxinfo", "r")
+ if not h then return "?", "" end
+ local total_s = h:read("*l")
+ local current_s = h:read("*l")
+ local occ_str = h:read("*l")
+ local win_title = h:read("*l") or ""
+ h:close()
+
+ if not total_s or not current_s then return "?", "" end
+
+ local total = tonumber(total_s)
+ local current = tonumber(current_s)
+ local occupied = {}
+ if occ_str then
+ for n in occ_str:gmatch("%d+") do
+ occupied[tonumber(n)] = true
+ end
+ end
+
+ local ws_str = ""
+ for i = 0, total - 1 do
+ if i == current then
+ ws_str = ws_str .. "[" .. (i + 1) .. "*]"
+ elseif occupied[i] then
+ ws_str = ws_str .. "[" .. (i + 1) .. "]"
+ end
+ end
+
+ ws_str = ws_str ~= "" and ws_str or "?"
+ return ws_str, win_title
+end
+
+while true do
+ local ws, title = get_x11_info()
+ local dt = os.date("%Y-%m-%d %a %H:%M")
+
+ -- Left: workspaces + active title | Right: datetime (battery later)
+ local left = ws .. " " .. title
+ local right = dt
+
+ io.write(left .. " | " .. right .. "\n")
+ io.flush()
+ os.execute("sleep 2")
+end
+