Big rewrite part 1
This commit is contained in:
@@ -3,19 +3,30 @@
|
||||
---------------------------------
|
||||
|
||||
-- Awesome Libs
|
||||
local awful = require("awful")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
local aplacement = require('awful.placement')
|
||||
local apopup = require('awful.popup')
|
||||
local beautiful = require('beautiful')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local gcolor = require('gears.color')
|
||||
local gshape = require('gears.shape')
|
||||
local gsurface = require('gears.surface')
|
||||
local gtable = require('gears.table')
|
||||
local wibox = require('wibox')
|
||||
local gobject = require('gears.object')
|
||||
local base = require('wibox.widget.base')
|
||||
local gtimer = require('gears.timer')
|
||||
local cairo = require('lgi').cairo
|
||||
local awidget = require('awful.widget')
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
client = client,
|
||||
mouse = mouse,
|
||||
}
|
||||
|
||||
local window_elements = require("src.modules.window_switcher.window_elements")()
|
||||
--local window_elements = require("src.modules.window_switcher.window_elements")()
|
||||
|
||||
return function(s)
|
||||
--[[ return function(s)
|
||||
|
||||
local window_switcher_list = wibox.widget {
|
||||
window_elements,
|
||||
@@ -33,9 +44,9 @@ return function(s)
|
||||
gears.shape.rounded_rect(cr, width, height, dpi(12))
|
||||
end,
|
||||
placement = awful.placement.centered,
|
||||
bg = Theme_config.window_switcher.bg,
|
||||
border_color = Theme_config.window_switcher.border_color,
|
||||
border_width = Theme_config.window_switcher.border_width
|
||||
bg = beautiful.colorscheme.bg,
|
||||
border_color = beautiful.colorscheme.border_color,
|
||||
border_width = dpi(2)
|
||||
}
|
||||
|
||||
window_switcher_container:setup {
|
||||
@@ -51,4 +62,94 @@ return function(s)
|
||||
end
|
||||
end
|
||||
)
|
||||
end ]]
|
||||
|
||||
local client_preview = {}
|
||||
|
||||
|
||||
function client_preview:toggle()
|
||||
self.visible = not self.visible
|
||||
end
|
||||
|
||||
return setmetatable(client_preview, {
|
||||
__call = function(...)
|
||||
local args = ...
|
||||
|
||||
local w = gobject {}
|
||||
|
||||
gtable.crush(w, client_preview, true)
|
||||
|
||||
--[[ local tl = awidget.tasklist {
|
||||
screen = 1,
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
filter = awidget.tasklist.filter.alltags,
|
||||
update_function = function(widget, _, _, _, clients)
|
||||
widget:reset()
|
||||
|
||||
for _, c in ipairs(clients) do
|
||||
local tw = wibox.widget {
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
widget = wibox.widget.imagebox,
|
||||
resize = true,
|
||||
id = c.instance,
|
||||
},
|
||||
widget = wibox.container.constraint,
|
||||
height = dpi(256),
|
||||
strategy = 'exact',
|
||||
},
|
||||
widget = wibox.container.place,
|
||||
},
|
||||
widget = wibox.container.margin,
|
||||
margins = dpi(20),
|
||||
},
|
||||
widget = wibox.container.background,
|
||||
bg = '#414141',
|
||||
id = c.pid,
|
||||
shape = gshape.rounded_rect,
|
||||
}
|
||||
|
||||
gtimer {
|
||||
timeout = 1 / 24,
|
||||
autostart = true,
|
||||
callback = function()
|
||||
local content = gsurface(c.content)
|
||||
local cr = cairo.Context(content)
|
||||
local x, y, w, h = cr:clip_extents()
|
||||
local img = cairo.ImageSurface.create(cairo.Format.ARGB32, w - x, h - y)
|
||||
cr = cairo.Context(img)
|
||||
cr:set_source_surface(content, 0, 0)
|
||||
cr.operator = cairo.Operator.SOURCE
|
||||
cr:paint()
|
||||
local cont = tw:get_children_by_id('icon_role')[1]
|
||||
if cont then
|
||||
cont.image = gsurface.load(img)
|
||||
return
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
widget:add(tw)
|
||||
end
|
||||
|
||||
return widget
|
||||
end,
|
||||
} ]]
|
||||
|
||||
w.popup = apopup {
|
||||
widget = {},
|
||||
ontop = true,
|
||||
visible = true,
|
||||
screen = args.screen,
|
||||
placement = aplacement.centered,
|
||||
bg = beautiful.colorscheme.bg,
|
||||
border_color = beautiful.colorscheme.border_color,
|
||||
border_width = dpi(2),
|
||||
}
|
||||
|
||||
|
||||
return w
|
||||
end,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user