fallback icon
This commit is contained in:
parent
0afab7248e
commit
ad9e63ce9c
13
README.md
13
README.md
|
@ -8,13 +8,12 @@ icon_customizer for awesomewm
|
|||
Features:
|
||||
------------
|
||||
- Define your own icons for applications
|
||||
- Set custom icons for terminal applications by using regular expressions
|
||||
- Set custom icons for terminal applications based on client title
|
||||
|
||||
Prerequisite:
|
||||
------------
|
||||
You need to configure your shell and terminal to support dynamic titles.
|
||||
Verify your setup by typing `sleep 5` in your terminal. If the title (`WM_NAME`) of the terminal changes while sleep is running, you are good to go.
|
||||
Otherwise your shell is most likely not configured to show dynamic titles.
|
||||
Dynamic terminal icons (as shown on gif) require you to have a shell-terminal-stack that supports dynamic titles (the title of the client (`WM_NAME`) changes based on the running app or pwd).
|
||||
Not every terminal or shell supports dynamic titles or is configured correctly out of the box.
|
||||
|
||||
Minimal configurations are provided for `bash` and `zsh`:
|
||||
|
||||
|
@ -30,7 +29,7 @@ Installation:
|
|||
Clone the repo and import the module:
|
||||
|
||||
1. `git clone https://github.com/intrntbrn/icon_customizer ~/.config/awesome/icon_customizer`
|
||||
1. `echo "require('icon_customizer'){}" >> ~/.config/awesome/rc.lua`
|
||||
1. `echo "require('icon_customizer'){ delay = 0.2 }" >> ~/.config/awesome/rc.lua`
|
||||
|
||||
Example Configuration:
|
||||
------------
|
||||
|
@ -58,13 +57,15 @@ theme.ic_dynamic_icons = {
|
|||
["- rtv"] = icon_dir .. "reddit.png"
|
||||
}
|
||||
|
||||
theme.ic_fallback_icon = icon_dir .. "default_icon.png"
|
||||
|
||||
```
|
||||
|
||||
Get application class names or titles by using `xprop`.
|
||||
|
||||
Limitations:
|
||||
------------
|
||||
It is not possible to set custom icons for applications that are constantly updating the icon themselves (e.g. `Gimp`).
|
||||
Applications can still overwrite your custom icon.
|
||||
|
||||
Related Work:
|
||||
------------
|
||||
|
|
11
init.lua
11
init.lua
|
@ -73,6 +73,7 @@ local function setup(config)
|
|||
dynamic_icons = cfg.dynamic_icons or theme.ic_dynamic_icons or {}
|
||||
dynamic_classes = cfg.dynamic_classes or theme.ic_dynamic_classes or {}
|
||||
delay = cfg.delay or 0.5
|
||||
local fallback_icon = cfg.fallback_icon or theme.ic_fallback_icon or nil
|
||||
|
||||
if type(icons) ~= 'table' then
|
||||
icons = {}
|
||||
|
@ -90,8 +91,12 @@ local function setup(config)
|
|||
client.connect_signal("manage", function(c)
|
||||
-- set icon based on c.class
|
||||
awful.spawn.easy_async_with_shell("sleep " .. delay, function()
|
||||
if c and c.valid and icons[c.class] then
|
||||
set_icon(c, icons[c.class])
|
||||
if c and c.valid then
|
||||
if icons[c.class] then
|
||||
set_icon(c, icons[c.class])
|
||||
elseif not c.icon and fallback_icon then
|
||||
set_icon(c, fallback_icon)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
@ -126,5 +131,5 @@ return setmetatable(module, {
|
|||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue