add awesome widgets for volume and battery

This commit is contained in:
2017-02-13 23:37:56 +03:00
parent 69c068e3a9
commit ac2d40c132
2 changed files with 146 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
local wibox = require("wibox")
local awful = require("awful")
volume_widget_text = wibox.widget.textbox()
volume_widget_text:set_align("right")
function update_volume(widget)
local fd = io.popen("amixer sget Master")
local status = fd:read("*all")
fd:close()
local volume = string.match(status, "(%d?%d?%d)%%")
volume = string.format("%d", volume)
status = string.match(status, "%[(o[^%]]*)%]")
if string.find(status, "on", 1, true) then
volume = " <span font_weight='bold'>" .. volume .. "</span> "
else
volume = " <span font_weight='bold' strikethrough='true'>" .. volume .. "</span> "
end
widget:set_markup(volume)
end
update_volume(volume_widget_text)
volume_widget = wibox.widget.background()
volume_widget:set_widget(volume_widget_text)
--volume_widget:set_bg('#000066')