From 5cfc43c70d3fb37ac5fa0f5d77e7d2e9a57a1ead Mon Sep 17 00:00:00 2001 From: Barak Michener Date: Mon, 22 Apr 2013 16:19:37 -0400 Subject: [PATCH] add detail bar --- .config/awesome/rc.lua | 64 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 11 deletions(-) diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua index 348764b..a52987e 100644 --- a/.config/awesome/rc.lua +++ b/.config/awesome/rc.lua @@ -7,7 +7,7 @@ require("awful.util") require("beautiful") -- Notification library require("naughty") ---require("vicious") +vicious = require("vicious") -- {{{ Error handling -- Check if awesome encountered an error during startup and fell back to @@ -89,6 +89,11 @@ for s = 1, screen.count() do end -- }}} +spacer = widget({type = "textbox"}) +separator = widget({type = "textbox"}) +spacer.text = " " +separator.text = "|" + -- {{{ Menu -- Create a laucher widget and a main menu myawesomemenu = { @@ -114,16 +119,42 @@ mytextclock = awful.widget.textclock({ align = "right" }) -- Create a systray mysystray = widget({ type = "systray" }) ----- CPU ----- Initialize widget ---cpuwidget = awful.widget.graph() ----- Graph properties ---cpuwidget:set_width(50) ---cpuwidget:set_background_color("#494B4F") ---cpuwidget:set_color({ type = "linear", from = { 0, 0 }, to = { 10,0 }, stops = { {0, "#FF5656"}, {0.5, "#88A175"}, - --{1, "#AECF96" }}}) ----- Register widget ---vicious.register(cpuwidget, vicious.widgets.cpu, "$1") +-- CPU usage widget +cpuwidget = awful.widget.graph() +cpuwidget:set_width(50) +cpuwidget:set_height(30) +cpuwidget:set_background_color("#494B4F") +cpuwidget:set_color("#FF5656") +cpuwidget:set_gradient_colors({ "#FF5656", "#88A175", "#AECF96" }) + +cpuwidget_t = awful.tooltip({ objects = { cpuwidget.widget },}) + +-- Register CPU widget +vicious.register(cpuwidget, vicious.widgets.cpu, + function (widget, args) + cpuwidget_t:set_text("CPU Usage: " .. args[1] .. "%") + return args[1] + end) + +-- RAM usage widget +memwidget = awful.widget.progressbar() +memwidget:set_width(15) +memwidget:set_height(30) +memwidget:set_vertical(true) +memwidget:set_background_color('#494B4F') +memwidget:set_color('#AECF96') +memwidget:set_gradient_colors({ '#AECF96', '#88A175', '#FF5656' }) + +-- RAM usage tooltip +memwidget_t = awful.tooltip({ objects = { memwidget.widget },}) + +vicious.cache(vicious.widgets.mem) +vicious.register(memwidget, vicious.widgets.mem, + function (widget, args) + memwidget_t:set_text(" RAM: " .. args[2] .. "MB / " .. args[3] .. "MB ") + return args[1] + end, 13) + --update every 13 seconds -- Create a wibox for each screen and add it mywibox = {} @@ -202,6 +233,17 @@ for s = 1, screen.count() do mylayoutbox[s], mytextclock, s == 1 and mysystray or nil, + spacer, + separator, + spacer, + cpuwidget.widget, + spacer, + separator, + spacer, + memwidget.widget, + spacer, + separator, + spacer, mytasklist[s], layout = awful.widget.layout.horizontal.rightleft }