mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-07-23 20:34:46 +02:00
icons: move icon lookup in a seperate module
This commit is contained in:
parent
52090d90ea
commit
335b80262d
8 changed files with 104 additions and 26 deletions
|
@ -1,5 +1,7 @@
|
|||
-- Keyboard configuration with kbdd
|
||||
|
||||
local icons = loadrc("icons", "vbe/icons")
|
||||
|
||||
-- Global configuration
|
||||
if config.hostname == "guybrush" then
|
||||
os.execute("setxkbmap us,fr '' compose:rctrl ctrl:nocaps")
|
||||
|
@ -38,7 +40,8 @@ dbus.add_signal("ru.gentoo.kbdd",
|
|||
nid = naughty.notify({ title = "Keyboard layout changed",
|
||||
text = "New layout is <i>" .. layout .. "</i>",
|
||||
replaces_id = nid,
|
||||
icon = "/usr/share/icons/gnome/32x32/devices/keyboard.png",
|
||||
icon = icons.lookup({ name = "keyboard",
|
||||
type = "devices" }),
|
||||
screen = client.focus.screen }).id
|
||||
end)
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
local icons = loadrc("icons", "vbe/icons")
|
||||
|
||||
-- Signal function to execute when a new client appears.
|
||||
client.add_signal("manage",
|
||||
function (c, startup)
|
||||
|
@ -9,6 +11,15 @@ client.add_signal("manage",
|
|||
client.focus = c
|
||||
end
|
||||
end)
|
||||
|
||||
-- Setup icon if none exists
|
||||
if not c.icon then
|
||||
local icon = icons.lookup({ name = { c.class, c.instance },
|
||||
type = "apps" })
|
||||
if icon then
|
||||
c.icon = image(icon)
|
||||
end
|
||||
end
|
||||
|
||||
if not startup then
|
||||
-- Put windows in a smart way, only if they does not set an initial position.
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
-- Widgets
|
||||
|
||||
require("vicious")
|
||||
local icons = loadrc("icons", "vbe/icons")
|
||||
|
||||
-- Separator
|
||||
local separator = widget({ type = "textbox" })
|
||||
|
@ -38,8 +39,8 @@ if config.hostname == "guybrush" then
|
|||
text = "Battery level is currently " ..
|
||||
current .. "%.\n" .. args[3] ..
|
||||
" left before running out of power.",
|
||||
icon = "/usr/share/icons/gnome/32x32" ..
|
||||
"/status/battery-caution.png",
|
||||
icon = icons.lookup({name = "battery-caution",
|
||||
type = "status"}),
|
||||
replaces_id = batwidget.lastid }).id
|
||||
batwidget.lastwarn = current
|
||||
end
|
||||
|
@ -174,27 +175,11 @@ for s = 1, screen.count() do
|
|||
fn = awful.widget.tasklist.label.alltags
|
||||
end
|
||||
local title, color, _, icon = fn(c, s)
|
||||
-- Try to search for an alternative icon if none is available
|
||||
for _, name in pairs({c.class, c.instance}) do
|
||||
if not icon and title and name then
|
||||
for _, n in pairs({name, name:lower()}) do
|
||||
icon = awful.util.geticonpath(name,
|
||||
nil,
|
||||
{"/usr/share/fvwm-crystal/fvwm/icons/Default/16x16/apps/",
|
||||
"/usr/share/fvwm-crystal/fvwm/icons/Default/22x22/apps/",
|
||||
"/usr/share/icons/hicolor/16x16/apps/"})
|
||||
if icon then
|
||||
-- This is our new icon. And we set it for the client to not search again
|
||||
icon = image(icon)
|
||||
c.icon = icon
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Use our icon and don't set the status image.
|
||||
if screen.count() > 1 then
|
||||
-- title, color and icon
|
||||
return title, color, nil, icon
|
||||
elseif icon then
|
||||
-- just color and icon
|
||||
return "", color, nil, icon
|
||||
end
|
||||
end, tasklist.buttons)
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
-- Lockscreen
|
||||
|
||||
local icons = loadrc("icons", "vbe/icons")
|
||||
|
||||
xrun("xautolock",
|
||||
"xautolock -notify 10 -notifier " ..
|
||||
" 'notify-send Lock\\ screen -i /usr/share/icons/gnome/32x32/actions/system-lock-screen.png -t 10000 " ..
|
||||
" 'notify-send Lock\\ screen -i " ..
|
||||
icons.lookup({name = "system-lock-screen", type = "actions" }) ..
|
||||
" -t 10000 " ..
|
||||
" Lock\\ screen\\ will\\ be\\ started\\ in\\ 10\\ seconds...' " ..
|
||||
" -time 3 -locker " ..
|
||||
" 'i3lock -n -i " .. awful.util.getdir("cache") .. "/current-wallpaper.png'")
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
-- Menu with xrandr choices
|
||||
|
||||
local icons = loadrc("icons", "vbe/icons")
|
||||
|
||||
-- Get active outputs
|
||||
local function outputs()
|
||||
local outputs = {}
|
||||
|
@ -76,7 +78,7 @@ local function menu()
|
|||
|
||||
menu[#menu + 1] = { label,
|
||||
cmd,
|
||||
"/usr/share/icons/gnome/32x32/devices/display.png" }
|
||||
icons.lookup({ name = "display", type = "devices" }) }
|
||||
end
|
||||
|
||||
return menu
|
||||
|
@ -103,7 +105,7 @@ local function xrandr()
|
|||
local next = state.iterator()
|
||||
local label, action, icon
|
||||
if not next then
|
||||
label, icon = "Keep the current configuration", "/usr/share/icons/gnome/32x32/devices/display.png"
|
||||
label, icon = "Keep the current configuration", icons.lookup({ name = "display", type = "devices" })
|
||||
state.iterator = nil
|
||||
else
|
||||
label, action, icon = unpack(next)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue