battery and mail widgets
This commit is contained in:
parent
56cf7bf61f
commit
871d2d42e1
104
wibox.lua
104
wibox.lua
|
@ -13,11 +13,7 @@ end
|
||||||
spacer = widget({ type = "textbox", name = "spacer" })
|
spacer = widget({ type = "textbox", name = "spacer" })
|
||||||
spacer.text = " "
|
spacer.text = " "
|
||||||
|
|
||||||
separator = widget({ type = "textbox", name = "separator", align = "center" })
|
|
||||||
separator.text = " )( "
|
|
||||||
|
|
||||||
nullwidget = widget({ type = "textbox", name = "nullwidget" })
|
nullwidget = widget({ type = "textbox", name = "nullwidget" })
|
||||||
separator.text = ""
|
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- {{{ Wibox
|
-- {{{ Wibox
|
||||||
|
@ -31,23 +27,89 @@ mysystray = widget({ type = "systray" })
|
||||||
clock = widget({ type = "textbox" })
|
clock = widget({ type = "textbox" })
|
||||||
vicious.register(clock, vicious.widgets.date, "%b %d, %R", 60)
|
vicious.register(clock, vicious.widgets.date, "%b %d, %R", 60)
|
||||||
|
|
||||||
memwidget = widget({ type = "textbox" })
|
|
||||||
vicious.register(memwidget, vicious.widgets.mem, "RAM: $1% ($2MB / $3MB) ", 13)
|
|
||||||
|
|
||||||
|
|
||||||
|
-- mail widget {{{
|
||||||
|
mailwidget = widget({ type = "textbox" })
|
||||||
|
vicious.register(mailwidget, vicious.widgets.mdir,
|
||||||
|
function(widget, args)
|
||||||
|
if args[1] > 0 then
|
||||||
|
naughty.notify({
|
||||||
|
title = "New mail arrived",
|
||||||
|
text = "Unread "..args[2].." / New "..args[1],
|
||||||
|
position = "top_left"
|
||||||
|
|
||||||
|
})
|
||||||
|
widget.bg = theme.bg_urgent
|
||||||
|
widget.fg = theme.fg_urgent
|
||||||
|
elseif args[2] > 0 then
|
||||||
|
widget.bg = theme.bg_focus
|
||||||
|
widget.fg = theme.fg_focus
|
||||||
|
else
|
||||||
|
widget.bg = theme.bg_normal
|
||||||
|
widget.fg = theme.fg_normal
|
||||||
|
end
|
||||||
|
return "⬓⬓ Unread "..args[2].." / New "..args[1].. " "
|
||||||
|
end, 181, {os.getenv("HOME") .. "/.maildir/"})
|
||||||
|
--}}}
|
||||||
|
|
||||||
|
|
||||||
|
-- battery {{{
|
||||||
if exists("/proc/acpi/battery/BAT0") then
|
if exists("/proc/acpi/battery/BAT0") then
|
||||||
batwidget1 = widget({ type = "textbox" })
|
batwidget0 = widget({ type = "textbox" })
|
||||||
vicious.register(batwidget1, vicious.widgets.bat, " )( BAT0: $1$2% - $3", 61, "BAT0")
|
vicious.register(batwidget0, vicious.widgets.bat,
|
||||||
else batwidget1 = nullwidget end
|
function (widget, args)
|
||||||
|
if args[2] == 0 then return ""
|
||||||
|
else
|
||||||
|
if args[2] < 15 then
|
||||||
|
widget.bg = theme.bg_urgent
|
||||||
|
widget.fg = theme.fg_urgent
|
||||||
|
else
|
||||||
|
widget.bg = theme.bg_normal
|
||||||
|
widget.fg = theme.fg_normal
|
||||||
|
end
|
||||||
|
return "( BAT0: "..args[1]..args[2].."% - "..args[3].." )"
|
||||||
|
end
|
||||||
|
end, 61, "BAT0")
|
||||||
|
else batwidget0 = nullwidget end
|
||||||
|
|
||||||
if exists("/proc/acpi/battery/BAT1") then
|
if exists("/proc/acpi/battery/BAT1") then
|
||||||
batwidget2 = widget({ type = "textbox" })
|
batwidget1 = widget({ type = "textbox" })
|
||||||
vicious.register(batwidget2, vicious.widgets.bat, " )( BAT1: $1$2% - $3", 61, "BAT1")
|
vicious.register(batwidget1, vicious.widgets.bat,
|
||||||
else batwidget2 = nullwidget end
|
function (widget, args)
|
||||||
|
if args[2] == 0 then return ""
|
||||||
|
else
|
||||||
|
if args[2] < 15 then
|
||||||
|
widget.bg = theme.bg_urgent
|
||||||
|
widget.fg = theme.fg_urgent
|
||||||
|
else
|
||||||
|
widget.bg = theme.bg_normal
|
||||||
|
widget.fg = theme.fg_normal
|
||||||
|
end
|
||||||
|
return "( BAT1: "..args[1]..args[2].."% - "..args[3].." )"
|
||||||
|
end
|
||||||
|
end, 61, "BAT1")
|
||||||
|
else batwidget1 = nullwidget end
|
||||||
|
|
||||||
if exists("/proc/acpi/battery/BAT2") then
|
if exists("/proc/acpi/battery/BAT2") then
|
||||||
batwidget3 = widget({ type = "textbox" })
|
batwidget2 = widget({ type = "textbox" })
|
||||||
vicious.register(batwidget3, vicious.widgets.bat, " )( BAT2: $1$2% - $3", 61, "BAT2")
|
vicious.register(batwidget2, vicious.widgets.bat,
|
||||||
else batwidget3 = nullwidget end
|
function (widget, args)
|
||||||
|
if args[2] == 0 then return ""
|
||||||
|
else
|
||||||
|
if args[2] < 15 then
|
||||||
|
widget.bg = theme.bg_urgent
|
||||||
|
widget.fg = theme.fg_urgent
|
||||||
|
else
|
||||||
|
widget.bg = theme.bg_normal
|
||||||
|
widget.fg = theme.fg_normal
|
||||||
|
end
|
||||||
|
return "( BAT2: "..args[1]..args[2].."% - "..args[3].." )"
|
||||||
|
end
|
||||||
|
end, 61, "BAT2")
|
||||||
|
else batwidget2 = nullwidget end
|
||||||
|
|
||||||
|
--}}}
|
||||||
|
|
||||||
cpulabel = widget({ type = "textbox" })
|
cpulabel = widget({ type = "textbox" })
|
||||||
vicious.register(cpulabel, vicious.widgets.cpu, "CPU: $1%")
|
vicious.register(cpulabel, vicious.widgets.cpu, "CPU: $1%")
|
||||||
|
@ -89,23 +151,25 @@ for s = 1, screen.count() do
|
||||||
leftwibox[s].widgets = {
|
leftwibox[s].widgets = {
|
||||||
mytaglist[s],
|
mytaglist[s],
|
||||||
mylayoutbox[s],
|
mylayoutbox[s],
|
||||||
|
mailwidget,
|
||||||
spacer,
|
spacer,
|
||||||
layout = awful.widget.layout.horizontal.rightleft
|
layout = awful.widget.layout.horizontal.rightleft
|
||||||
}
|
}
|
||||||
rightwibox[s].widgets = {
|
rightwibox[s].widgets = {
|
||||||
{
|
{
|
||||||
clock,
|
clock, spacer,
|
||||||
separator, spacer, memwidget,
|
batwidget0,
|
||||||
batwidget1,
|
batwidget1,
|
||||||
batwidget2,
|
batwidget2,
|
||||||
batwidget3,
|
|
||||||
wlanwidget,
|
wlanwidget,
|
||||||
separator, spacer, cpulabel, cpuwidget,
|
spacer, cpulabel, cpuwidget,
|
||||||
spacer,
|
spacer,
|
||||||
layout = awful.widget.layout.horizontal.leftright
|
layout = awful.widget.layout.horizontal.leftright
|
||||||
},
|
},
|
||||||
separator, spacer, s == 1 and mysystray or nil,
|
spacer, s == 1 and mysystray or nil,
|
||||||
layout = awful.widget.layout.horizontal.leftright
|
layout = awful.widget.layout.horizontal.leftright
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
-- }}}
|
-- }}}
|
||||||
|
--
|
||||||
|
-- vim:foldmethod=marker
|
||||||
|
|
Loading…
Reference in a new issue