Skip to content

Instantly share code, notes, and snippets.

@Nymphium
Created January 22, 2020 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nymphium/7ca42b6856a4139c7c693a838a8643a5 to your computer and use it in GitHub Desktop.
Save Nymphium/7ca42b6856a4139c7c693a838a8643a5 to your computer and use it in GitHub Desktop.
awful.key({ modkey }, 't', function()
local w = {}
for _, c in ipairs(filter_ddt(get_tag_clients())) do
local str = ('/tmp/%s.png'):format(tostring{}:match('0x([0-f]+)'))
gears.surface(c.content):write_to_png(str)
local font_orig = beautiful.font:match('^(.*) %d+$')
local font_size = 14
local font = ('%s %d'):format(font_orig, font_size)
local size_base = 45
local grid_width = size_base * 16
local grid_height = size_base * 9
local box = wibox.widget {
{
{
text = c.name,
font = font,
align = 'center',
opacity = 1,
forced_width = grid_width,
widget = wibox.widget.textbox,
},
fg = 'gray',
widget = wibox.container.background
},
{
image = str,
widget = wibox.widget.imagebox,
forced_height = grid_height,
forced_width = grid_width
},
client = c,
layout = wibox.layout.align.vertical,
widget = wibox.container.background,
}
table.insert(w, box)
end
w.layout = wibox.layout.grid
w.homogeneous = true
w.spacing = 10
if #w > 4 then
w.forced_num_cols = 4
end
local popup = awful.popup {
widget = {
w,
margins = 1,
widget = wibox.container.margin
},
placement = awful.placement.centered,
hide_on_right_click = true,
shape = gears.shape.rounded_rect,
opacity = 0.9,
ontop = true
}
for i = 1, #w do
w[i]:connect_signal("button::press", function()
client.focus = w[i].client
client.focus:raise()
popup.visible = false
end)
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment