diff --git a/awesomerc.lua.in b/awesomerc.lua.in index 312352313..d922a6a9e 100644 --- a/awesomerc.lua.in +++ b/awesomerc.lua.in @@ -52,6 +52,9 @@ fg_focus = "#ffffff" border_focus = bg_focus border_marked = "#91231C" +bg_urgent = "#ff0000" +fg_urgent = "#ffffff" + -- Define if we want to use titlebar on all applications use_titlebar = false @@ -87,14 +90,14 @@ mytaglist:mouse_add(mouse({}, 3, function (object, tag) tag.selected = not tag.s mytaglist:mouse_add(mouse({ modkey }, 3, function (object, tag) awful.client.toggletag(tag) end)) mytaglist:mouse_add(mouse({ }, 4, awful.tag.viewnext)) mytaglist:mouse_add(mouse({ }, 5, awful.tag.viewprev)) -function mytaglist.label(t) return awful.widget.taglist.label.all(t, bg_focus, fg_focus) end +function mytaglist.label(t) return awful.widget.taglist.label.all(t, bg_focus, fg_focus, bg_urgent, fg_urgent) end -- Create a tasklist widget mytasklist = widget({ type = "tasklist", name = "mytasklist" }) mytasklist:mouse_add(mouse({ }, 1, function (object, c) c:focus_set(); c:raise() end)) mytasklist:mouse_add(mouse({ }, 4, function () awful.client.focusbyidx(1) end)) mytasklist:mouse_add(mouse({ }, 5, function () awful.client.focusbyidx(-1) end)) -function mytasklist.label(c, screen) return awful.widget.tasklist.label.currenttags(c, screen, bg_focus, fg_focus) end +function mytasklist.label(c, screen) return awful.widget.tasklist.label.currenttags(c, screen, bg_focus, fg_focus, bg_urgent, fg_urgent) end -- Create a textbox widget mytextbox = widget({ type = "textbox", name = "mytextbox", align = "right" }) diff --git a/lib/awful.lua.in b/lib/awful.lua.in index 220990f5d..f28e01064 100644 --- a/lib/awful.lua.in +++ b/lib/awful.lua.in @@ -921,35 +921,48 @@ end -- @param t The tag. -- @param bg_focus The background color for selected tag. -- @param fg_focus The foreground color for selected tag. +-- @param bg_urgent The background color for urgent tags. +-- @param fg_urgent The foreground color for urgent tags. -- @return A string to print. -function P.widget.taglist.label.all(t, bg_focus, fg_focus) - local text = "" +function P.widget.taglist.label.all(t, bg_focus, fg_focus, bg_urgent, fg_urgent) + local text local background = "" local sel = client.focus_get() + local bg_color = nil + local fg_color = nil + local has_color = t.selected if sel and sel:istagged(t) then + bg_color = bg_focus + fg_color = fg_focus background = "resize=\"true\" image=\"@AWESOME_ICON_PATH@/taglist/squarefw.png\"" - else - for k, c in pairs(client.get()) do - if c:istagged(t) then + end + for k, c in pairs(client.get()) do + if c:istagged(t) then + if not (sel and sel:istagged(t)) then background = "resize=\"true\" image=\"@AWESOME_ICON_PATH@/taglist/squarew.png\"" - break + end + if c.urgent and bg_urgent and fg_urgent then + bg_color = bg_urgent + fg_color = fg_urgent end end end - if t.selected then - text = " "..P.escape(t.name).." " + if bg_color and fg_color then + text = " "..P.escape(t.name).." " else text = " "..P.escape(t.name).." " end return text end -local function widget_tasklist_label_common(c, bg_focus, fg_focus) +local function widget_tasklist_label_common(c, bg_focus, fg_focus, bg_urgent, fg_urgent) local text = "" if c.floating then text = "" end - if client.focus_get() == c then + if c.urgent and bg_urgent and fg_urgent then + text = text .. " "..P.escape(c.name).." " + elseif client.focus_get() == c then text = text .. " "..P.escape(c.name).." " else text = text .. " "..P.escape(c.name).." " @@ -965,9 +978,11 @@ end -- @param screen The screen we are drawing on. -- @param bg_focus The background color for focused client. -- @param fg_focus The foreground color for focused client. +-- @param bg_urgent The background color for urgent clients. +-- @param fg_urgent The foreground color for urgent clients. -- @return A string to pring. -function P.widget.tasklist.label.allscreen(c, screen, bg_focus, fg_focus) - return widget_tasklist_label_common(c, bg_focus, fg_focus) +function P.widget.tasklist.label.allscreen(c, screen, bg_focus, fg_focus, bg_urgent, fg_urgent) + return widget_tasklist_label_common(c, bg_focus, fg_focus, bg_urgent, fg_urgent) end --- Return labels for a tasklist widget with clients from all tags. @@ -978,11 +993,13 @@ end -- @param screen The screen we are drawing on. -- @param bg_focus The background color for focused client. -- @param fg_focus The foreground color for focused client. +-- @param bg_urgent The background color for urgent clients. +-- @param fg_urgent The foreground color for urgent clients. -- @return A string to pring. -function P.widget.tasklist.label.alltags(c, screen, bg_focus, fg_focus) +function P.widget.tasklist.label.alltags(c, screen, bg_focus, fg_focus, bg_urgent, fg_urgent) -- Only print client on the same screen as this widget if c.screen ~= screen then return end - return widget_tasklist_label_common(c, bg_focus, fg_focus) + return widget_tasklist_label_common(c, bg_focus, fg_focus, bg_urgent, fg_urgent) end --- Return labels for a tasklist widget with clients from currently selected tags. @@ -993,13 +1010,15 @@ end -- @param screen The screen we are drawing on. -- @param bg_focus The background color for focused client. -- @param fg_focus The foreground color for focused client. +-- @param bg_urgent The background color for urgent clients. +-- @param fg_urgent The foreground color for urgent clients. -- @return A string to pring. -function P.widget.tasklist.label.currenttags(c, screen, bg_focus, fg_focus) +function P.widget.tasklist.label.currenttags(c, screen, bg_focus, fg_focus, bg_urgent, fg_urgent) -- Only print client on the same screen as this widget if c.screen ~= screen then return end for k, t in pairs(tag.get(screen)) do if t.selected and c:istagged(t) then - return widget_tasklist_label_common(c, bg_focus, fg_focus) + return widget_tasklist_label_common(c, bg_focus, fg_focus, bg_urgent, fg_urgent) end end end