Skip to content

Instantly share code, notes, and snippets.

@spahl
Created May 23, 2015 05:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spahl/ecf80325d9e35867f7f7 to your computer and use it in GitHub Desktop.
Save spahl/ecf80325d9e35867f7f7 to your computer and use it in GitHub Desktop.
i3status + awesome wm
general {
output_format = none
interval = 0
}
order += "run_watch DHCP"
order += "wireless _first_"
order += "ethernet _first_"
order += "battery 1"
order += "battery 0"
wireless _first_ {
format_up = "W: (%quality at %essid) %ip"
format_down = "W: down"
}
ethernet _first_ {
format_up = "E: %ip (%speed)"
format_down = "E: down"
}
battery 0 {
last_full_capacity = true
integer_battery_capacity = true
format_down = "No battery"
status_chr = "⚇"
status_bat = "⚡"
status_full = "☻"
hide_seconds = true
format = "B1: %status %percentage %remaining"
}
battery 1 {
last_full_capacity = true
integer_battery_capacity = true
format_down = "No battery"
status_chr = "⚇"
status_bat = "⚡"
status_full = "☻"
hide_seconds = true
format = "B0: %status %percentage %remaining"
}
run_watch DHCP {
pidfile = "/var/run/dhcpcd*.pid"
}
local setmetatable = setmetatable
local io = require("io")
local textbox = require("wibox.widget.textbox")
local capi = { timer = timer }
local i3status = { mt = {} }
function read_status()
local p = io.popen("i3status")
local status = p:read()
p:close()
return " " .. status .. " |"
end
function i3status.new(format, timeout)
local timeout = timeout or 60
local w = textbox()
local timer = capi.timer { timeout = timeout }
timer:connect_signal("timeout", function() w:set_markup(read_status()) end)
timer:start()
timer:emit_signal("timeout")
return w
end
function i3status.mt:__call(...)
return i3status.new(...)
end
return setmetatable(i3status, i3status.mt)
@chr1swallace
Copy link

I would love to use i3status in awesome, but am still learning awesome. Could you show me the code to include in rc.lua to get this to show please?

@QuAzI
Copy link

QuAzI commented Feb 10, 2018

Nice solution!

@chr1swallace:
Save i3status.lua to ~/.config/awesome/i3status.lua
Add to ~/.config/awesome/rc.lua something like this

local i3status = require("i3status")
...
right_layout:add(i3status())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment