Created
March 3, 2013 06:50
-
-
Save butchler/5075038 to your computer and use it in GitHub Desktop.
Battery indicator snippet from my AwesomeWM rc.lua.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
-- Battery level widget | |
-- Create widget to show battery level | |
batterywidget = wibox.widget.textbox() | |
-- Create timer to update widget | |
batterytimer = timer({ timeout = 30 }) | |
batterytimer:connect_signal("timeout", function() | |
local battery_info = vicious.widgets.bat("This argument doesn't seem to be used for anything.", "BAT0") | |
local battery_percentage = battery_info[2] | |
batterywidget:set_text(" | " .. battery_percentage .. "% | ") | |
end) | |
batterytimer:start() | |
-- Trigger timeout immediately so that it shows the battery level as soon as awesome starts | |
batterytimer:emit_signal("timeout") | |
... | |
-- Widgets that are aligned to the right | |
local right_layout = wibox.layout.fixed.horizontal() | |
if s == 1 then right_layout:add(wibox.widget.systray()) end | |
right_layout:add(batterywidget) | |
right_layout:add(mytextclock) | |
right_layout:add(mylayoutbox[s]) | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment