diff --git a/assets/icons.lua b/assets/icons.lua index 68906ca..47bc1b2 100755 --- a/assets/icons.lua +++ b/assets/icons.lua @@ -7,6 +7,7 @@ return { submenu = conf_dir .. "assets/icons/submenu.svg", arch = conf_dir .. "assets/icons/arch.svg", nix = conf_dir .. "assets/icons/nix.svg", + nix_grey = conf_dir .. "assets/icons/nix-grey.svg", music = { grey = { diff --git a/assets/icons/nix-grey.svg b/assets/icons/nix-grey.svg new file mode 100644 index 0000000..df99d40 --- /dev/null +++ b/assets/icons/nix-grey.svg @@ -0,0 +1,113 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/config-template.lua b/config-template.lua index a61279c..6c57ace 100755 --- a/config-template.lua +++ b/config-template.lua @@ -15,6 +15,7 @@ config.keymap_popup = { enabled = true } config.core = { wallpaper = "/home/assets/wallpapers/Themed/Stellaris/Gigapixel/City.png", + default_clienticon = "nix_grey" -- -- Dynamic: a table of files and times -- {file = "path", start_time = {hour, minute}} diff --git a/core/tasklist.lua b/core/tasklist.lua index 4950243..ebc8735 100755 --- a/core/tasklist.lua +++ b/core/tasklist.lua @@ -64,7 +64,10 @@ tasklist.make = function(screen) fill_vertical = true, { id = "clienticon", - widget = awful.widget.clienticon, + -- Don't use awesomewm's stock clienticon. + -- using a raw imagebox lets us handle nil icons... + -- also, see th call to awesome.preferred_icon_size in rc.lua. + widget = wibox.widget.imagebox, }, }, margins = beautiful.dpi(3), @@ -79,8 +82,24 @@ tasklist.make = function(screen) -- The create callback is only called once, when the task indicator -- is created. create_callback = function(self, c, index, objects) + -- Set indicator icon - self:get_children_by_id("clienticon")[1].client = c + if c.icon == nil then + self:get_children_by_id("clienticon")[1].image = beautiful.icons[config.core.default_clienticon] + else + self:get_children_by_id("clienticon")[1].image = c.icon + end + self:get_children_by_id("clienticon")[1]:emit_signal("widget::redraw_needed") + + + -- Update top color + if c == client.focus then + self:get_children_by_id("top_tab")[1].bg = "#2DA0DA" + elseif c.minimized then + self:get_children_by_id("top_tab")[1].bg = beautiful.color.bar.hover_bg --beautiful.color.transparent + else + self:get_children_by_id("top_tab")[1].bg = "#2DA0DA77" + end -- Change background when mouse is over widget self:connect_signal("mouse::enter", function(result) @@ -106,7 +125,13 @@ tasklist.make = function(screen) update_callback = function(self, c, index, objects) -- Update indicator icon - self:get_children_by_id("clienticon")[1].client = c + if c.icon == nil then + self:get_children_by_id("clienticon")[1].image = beautiful.icons[config.core.default_clienticon] + else + self:get_children_by_id("clienticon")[1].image = c.icon + end + self:get_children_by_id("clienticon")[1]:emit_signal("widget::redraw_needed") + -- Update top color if c == client.focus then diff --git a/rc.lua b/rc.lua index 6d935fa..81dc5c9 100755 --- a/rc.lua +++ b/rc.lua @@ -20,7 +20,6 @@ end - -- A "relative require" hack. Does the same thing as `require`, -- But takes a relative path. -- Called with req_rel(..., "module") @@ -42,6 +41,13 @@ local keys = require("core.keybinds") local buttons = {} +-- Preferred client icon size, in pixels. +-- Set this to bar height, since that's the largest icon we'll ever draw. +-- This fixes the icon size given by client.icon. Client.icon give the smallest size by default. +awesome.set_preferred_icon_size(beautiful.dpi(config.core.bar_height)) + + + -- Bind first 5 shortcuts to Mod + #. local i = 0 for k, v in pairs(config.core.bar_shortcuts) do