revamp theme a lot
authorPierre Habouzit <madcoder@debian.org>
Tue, 27 Oct 2009 22:09:18 +0000 (23:09 +0100)
committerPierre Habouzit <madcoder@debian.org>
Tue, 27 Oct 2009 22:09:18 +0000 (23:09 +0100)
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
config/awesome/icons/clock.png [new file with mode: 0644]
config/awesome/icons/cpu.png [new file with mode: 0644]
config/awesome/icons/mem.png [new file with mode: 0644]
config/awesome/rc.lua
config/awesome/theme

diff --git a/config/awesome/icons/clock.png b/config/awesome/icons/clock.png
new file mode 100644 (file)
index 0000000..87c7a44
Binary files /dev/null and b/config/awesome/icons/clock.png differ
diff --git a/config/awesome/icons/cpu.png b/config/awesome/icons/cpu.png
new file mode 100644 (file)
index 0000000..976b867
Binary files /dev/null and b/config/awesome/icons/cpu.png differ
diff --git a/config/awesome/icons/mem.png b/config/awesome/icons/mem.png
new file mode 100644 (file)
index 0000000..c171c51
Binary files /dev/null and b/config/awesome/icons/mem.png differ
index bf69929..caa561e 100644 (file)
@@ -37,10 +37,6 @@ function fg(color, text)
     return '<span color="'..color..'">'..text..'</span>'
 end
 
-function heading(text)
-    return fg(beautiful.fg_focus, text)
-end
-
 -- }}}
 
 -- {{{ Tags
@@ -185,16 +181,16 @@ end
 -- }}}
 -- {{{ Widgets
 
-function make_imagebox(fname, w, h, bg)
-    local icon = image(fname)
+local icondir = awful.util.getdir("config").."/icons/"
+
+function make_icon(fname, left, right, h, bg)
+    local icon = image(icondir..fname)
     local ib   = widget { type = 'imagebox' }
+    local w    = left + icon.width + right
     local i    = image.argb32(w, h, nil)
 
-    if not bg then bg = beautiful.bg_normal end
-
-    i:draw_rectangle(0, 0, w, h, true, bg)
-    i:insert(icon, math.floor((w - icon.width) / 2),
-             math.floor((h - icon.height) / 2))
+    i:draw_rectangle(0, 0, w, h, true, beautiful.bg_normal)
+    i:insert(icon, left, math.floor((h - icon.height) / 2))
 
     ib.image = i
     return ib
@@ -216,43 +212,13 @@ mypromptbox = awful.widget.prompt{
     layout = awful.widget.layout.horizontal.leftright
 }
 
--- }}}
--- {{{ Load Average Widget
-
-loadwidget = widget({ type = 'textbox' })
-load_update = function()
-    -- Use /proc/loadavg to get the average system load on 1, 5 and 15 minute intervals
-    local f = io.open('/proc/loadavg')
-    local n = f:read()
-    f:close()
-
-    -- Find the third space
-    local pos = n:find(' ', n:find(' ', n:find(' ')+1)+1)
-
-    loadwidget.text = heading('Load')..': '..n:sub(1,pos-1)
-end
-load_update()
-
-t = timer { timeout = 10 }
-t:add_signal("timeout", load_update)
-t:start()
-
 -- }}}
 -- {{{ CPU Widgets
 
-cpuiconwidget = nil
---    make_imagebox(os.getenv("HOME")..'/tmp/famfamfam/computer.png', 18, 18)
+cpuicon = make_icon('cpu.png', 16, 4, 16)
 
 cputextwidget = widget({ type = 'textbox' })
 
-cpugraphwidget = awful.widget.graph{
-    width  = 40, height = 16,
-    layout = awful.widget.layout.horizontal.rightleft
-}
-cpugraphwidget:set_background_color('#333333')
-cpugraphwidget:set_border_color('#0a0a0a')
-cpugraphwidget:set_gradient_colors({ '#285577', '#285577', '#AEC6D8' })
-
 vicious.register(cputextwidget, vicious.widgets.cpu,
 function (widget, args)
     local r = tonumber(args[1])
@@ -261,29 +227,24 @@ function (widget, args)
         percent = '0'..percent
     end
     if r < 25 then
-        percent = fg('green', percent)
+        percent = fg(theme.fg_focus, percent)
     elseif r < 50 then
         percent = fg('yellow', percent)
     elseif r < 75 then
         percent = fg('orange', percent)
     else
-        percent = fg('red', percent)
-    end
-    for s = 1, screen.count() do
-        cpugraphwidget:add_value(r / 100)
+        percent = fg('#ff4040', percent)
     end
-    return ' '..percent..' '
+    return percent..' '
 end, 2)
 
 -- }}}
 -- {{{ Memory Usage Widget
 
-memiconwidget = nil
---    make_imagebox(os.getenv("HOME")..'/tmp/famfamfam/bricks.png', 18, 18)
+memicon = make_icon('mem.png', 16, 4, 16)
 
 memtextwidget = widget({ type = 'textbox' })
 
-memtextwidget.text = heading('MEM')..': '
 vicious.register(memtextwidget, vicious.widgets.mem, function (widget, args)
     -- Add extra preceding zeroes when needed
     local r = tonumber(args[1])
@@ -292,39 +253,33 @@ vicious.register(memtextwidget, vicious.widgets.mem, function (widget, args)
         percent = '0'..percent
     end
     if r < 50 then
-        percent = fg('green', percent)
+        percent = fg(theme.fg_focus, percent)
     elseif r < 80 then
         percent = fg('orange', percent)
     else
         percent = fg('red', percent)
     end
-    return ' '..percent..' '..args[2]..'M'
+    return percent..' '..args[2]..'M'
 end, 2)
 
--- }}}
--- {{{ spacers
-
-rspacer = widget({ type = 'textbox' })
-rspacer.text = " │ "
-
 -- }}}
 -- {{{ Clock
 
+clockicon = make_icon('clock.png', 16, 4, 16)
+
 clockwidget = widget({ type = "textbox" })
 vicious.register(clockwidget, vicious.widgets.date,
-                 fg("#dddddd", "%a %d %b - %H:%M"), 10)
+                 fg(theme.fg_focus, "%H:%M") .. " %a %d %b  ", 10)
 
 -- }}}
 -- {{{ Statusbar
 
 mainstatusbar = {}
-mysystray = widget({ type = "systray" })
-
 for s = 1, screen.count() do
     local lr_layout = awful.widget.layout.horizontal.leftright
     local rl_layout = awful.widget.layout.horizontal.rightleft
 
-    mainstatusbar[s] = awful.wibox{ position = "top", height = 18, screen = s }
+    mainstatusbar[s] = awful.wibox{ position = "top", height = 16, screen = s }
 
     mainstatusbar[s].widgets = {
         {
@@ -332,12 +287,10 @@ for s = 1, screen.count() do
             mypromptbox.widget,
             layout = lr_layout
         },
-        s == 1 and mysystray or nil,
-        s == 1 and rspacer or nil,
-        clockwidget, rspacer,
-        memtextwidget, memiconwidget, rspacer,
-        cpugraphwidget.widget, cputextwidget, cpuiconwidget, rspacer,
-        loadwidget, rspacer,
+        s == 1 and widget{ type = 'systray' } or nil,
+        clockwidget, clockicon,
+        memtextwidget, memicon,
+        cputextwidget, cpuicon,
         layout = awful.widget.layout.horizontal.rightleft
     }
 end
@@ -347,7 +300,6 @@ end
 -- {{{ Keys
 ---- {{{ Global keys
 
-local hist = os.getenv("HOME") .. "/.cache/awesome/history"
 globalkeys = awful.util.table.join(
     -- Mod+{A/S}: Switch to prev/next tag
     awful.key(k_m, "Left",  mtag.prev),
@@ -536,3 +488,4 @@ end
 -- }}}
 
 awful.util.spawn("xkbcomp -w 0 -R/usr/share/X11/xkb /home/madcoder/.Xkeyboard :0")
+awful.util.spawn("xsetroot -cursor_name left_ptr")
index 78c6b80..faa332a 100644 (file)
@@ -3,90 +3,26 @@
 ---------------------------
 
 theme = {}
-
 theme.font          = "Terminus 8"
+theme.wallpaper_cmd = { "xsetroot -solid rgb:00/00/0f" }
 
-theme.bg_normal     = "#222222"
-theme.bg_focus      = "#285577"
+theme.bg_normal     = "#00000f"
+theme.bg_graph      = "#111111"
+theme.bg_focus      = "#00000f"
 theme.bg_urgent     = "#a10000"
-theme.bg_minimize   = "#444444"
 
 theme.fg_normal     = "#888888"
-theme.fg_focus      = "#ffffff"
+theme.fg_focus      = "#f0dda0"
 theme.fg_urgent     = "#ffffff"
-theme.fg_minimize  =  "#ffffff"
 
 theme.border_width  = 1
+theme.border_graph  = "#00000f"
 theme.border_normal = "#333333"
 theme.border_focus  = "#4c7899"
 theme.border_marked = "#91231c"
 
--- There are another variables sets
--- overriding the default one when
--- defined, the sets are:
--- [taglist|tasklist]_[bg|fg]_[focus|urgent]
--- titlebar_[bg|fg]_[normal|focus]
--- Example:
---taglist_bg_focus = #ff0000
-
 -- Display the taglist squares
-theme.taglist_squares_sel = "/usr/share/awesome/themes/default/taglist/squarefw.png"
-theme.taglist_squares_unsel = "/usr/share/awesome/themes/default/taglist/squarew.png"
-
-theme.tasklist_floating_icon = "/usr/share/awesome/themes/default/tasklist/floatingw.png"
-
--- Variables set for theming menu
--- menu_[bg|fg]_[normal|focus]
--- menu_[border_color|border_width]
-theme.menu_submenu_icon = "/usr/share/awesome/themes/default/submenu.png"
-theme.menu_height   = "15"
-theme.menu_width    = "100"
-
--- You can add as many variables as
--- you wish and access them by using
--- beautiful.variable in your rc.lua
---bg_widget    = #cc0000
-
--- Define the image to load
-theme.titlebar_close_button_normal = "/usr/share/awesome/themes/default/titlebar/close_normal.png"
-theme.titlebar_close_button_focus = "/usr/share/awesome/themes/default/titlebar/close_focus.png"
-
-theme.titlebar_ontop_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/ontop_normal_inactive.png"
-theme.titlebar_ontop_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/ontop_focus_inactive.png"
-theme.titlebar_ontop_button_normal_active = "/usr/share/awesome/themes/default/titlebar/ontop_normal_active.png"
-theme.titlebar_ontop_button_focus_active = "/usr/share/awesome/themes/default/titlebar/ontop_focus_active.png"
-
-theme.titlebar_sticky_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/sticky_normal_inactive.png"
-theme.titlebar_sticky_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/sticky_focus_inactive.png"
-theme.titlebar_sticky_button_normal_active = "/usr/share/awesome/themes/default/titlebar/sticky_normal_active.png"
-theme.titlebar_sticky_button_focus_active = "/usr/share/awesome/themes/default/titlebar/sticky_focus_active.png"
-
-theme.titlebar_floating_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/floating_normal_inactive.png"
-theme.titlebar_floating_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/floating_focus_inactive.png"
-theme.titlebar_floating_button_normal_active = "/usr/share/awesome/themes/default/titlebar/floating_normal_active.png"
-theme.titlebar_floating_button_focus_active = "/usr/share/awesome/themes/default/titlebar/floating_focus_active.png"
-
-theme.titlebar_maximized_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/maximized_normal_inactive.png"
-theme.titlebar_maximized_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/maximized_focus_inactive.png"
-theme.titlebar_maximized_button_normal_active = "/usr/share/awesome/themes/default/titlebar/maximized_normal_active.png"
-theme.titlebar_maximized_button_focus_active = "/usr/share/awesome/themes/default/titlebar/maximized_focus_active.png"
-
--- You can use your own command to set your wallpaper
-theme.wallpaper_cmd = { "awsetbg /usr/share/awesome/themes/default/background.png" }
-
--- You can use your own layout icons like this:
-theme.layout_fairh = "/usr/share/awesome/themes/default/layouts/fairhw.png"
-theme.layout_fairv = "/usr/share/awesome/themes/default/layouts/fairvw.png"
-theme.layout_floating = "/usr/share/awesome/themes/default/layouts/floatingw.png"
-theme.layout_magnifier = "/usr/share/awesome/themes/default/layouts/magnifierw.png"
-theme.layout_max = "/usr/share/awesome/themes/default/layouts/maxw.png"
-theme.layout_fullscreen = "/usr/share/awesome/themes/default/layouts/fullscreenw.png"
-theme.layout_tilebottom = "/usr/share/awesome/themes/default/layouts/tilebottomw.png"
-theme.layout_tileleft = "/usr/share/awesome/themes/default/layouts/tileleftw.png"
-theme.layout_tile = "/usr/share/awesome/themes/default/layouts/tilew.png"
-theme.layout_tiletop = "/usr/share/awesome/themes/default/layouts/tiletopw.png"
-
-theme.awesome_icon = "/usr/share/awesome/icons/awesome16.png"
+theme.taglist_squares_sel    = "/usr/share/awesome/themes/default/taglist/squarefw.png"
+theme.taglist_squares_unsel  = "/usr/share/awesome/themes/default/taglist/squarew.png"
 
 return theme
--- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80