173 lines
5.8 KiB
Lua
173 lines
5.8 KiB
Lua
local awful = require "awful"
|
|
local vars = require "misc.vars"
|
|
local wibox = require "wibox"
|
|
local obj = require "gears.object"
|
|
local debug = require "gears.debug"
|
|
local naughty = require "naughty"
|
|
local xresources = require "beautiful.xresources"
|
|
local dpi = xresources.apply_dpi
|
|
|
|
|
|
local ws = obj {
|
|
enable_properties = true,
|
|
enable_auto_signals = true
|
|
}
|
|
|
|
ws.selected = 1
|
|
ws.max = 0
|
|
|
|
local widget = awful.popup {
|
|
widget = {
|
|
{
|
|
widget = awful.widget.tasklist {
|
|
screen = screen[1],
|
|
filter = awful.widget.tasklist.filter.allscreen,
|
|
style = {
|
|
shape = vars.shape,
|
|
},
|
|
layout = {
|
|
forced_num_rows = 1,
|
|
layout = wibox.layout.grid.vertical,
|
|
spacing = vars.padding
|
|
},
|
|
widget_template = {
|
|
{
|
|
layout = wibox.layout.align.horizontal,
|
|
{
|
|
widget = wibox.container.place,
|
|
{
|
|
widget = wibox.container.margin,
|
|
margins = dpi(6),
|
|
{
|
|
id = "text_role",
|
|
widget = wibox.widget.textbox,
|
|
}
|
|
}
|
|
},
|
|
nil,
|
|
{
|
|
widget = wibox.container.place,
|
|
{
|
|
widget = wibox.container.margin,
|
|
margins = dpi(6),
|
|
{
|
|
id = "tag_role",
|
|
widget = wibox.widget.textbox,
|
|
}
|
|
}
|
|
}
|
|
},
|
|
forced_width = dpi(screen[1].geometry.width / 8),
|
|
bg = vars.colors.black,
|
|
border_width = vars.border_width,
|
|
border_color = vars.colors.black,
|
|
shape = vars.shape,
|
|
widget = wibox.container.background,
|
|
create_callback = function(self, client, i)
|
|
-- self:get_children_by_id("name_role")[1].text = client.name
|
|
self:get_children_by_id("tag_role")[1].text = client.first_tag.name
|
|
|
|
ws:connect_signal("property::selected", function(selected)
|
|
naughty.notification {
|
|
urgency = "critical",
|
|
message = tostring(selected) .. " | " .. tostring(i)
|
|
}
|
|
|
|
if selected == i then
|
|
self.border_color = vars.colors.yellow
|
|
else
|
|
self.border_color = vars.colors.black
|
|
end
|
|
end)
|
|
end
|
|
-- update_callback = function(self, _, i)
|
|
-- if ws.selected == i then
|
|
-- self.border_color = vars.colors.yellow
|
|
-- else
|
|
-- self.border_color = vars.colors.black
|
|
-- end
|
|
-- end
|
|
}
|
|
},
|
|
id = "tasklist"
|
|
},
|
|
widget = wibox.container.margin,
|
|
margins = vars.padding
|
|
},
|
|
border_color = vars.colors.bright.black,
|
|
border_width = vars.border_width,
|
|
ontop = true,
|
|
placement = awful.placement.centered,
|
|
bg = vars.colors.bg,
|
|
shape = vars.shape,
|
|
visible = false
|
|
}
|
|
|
|
ws.widget = widget
|
|
|
|
ws.max = ws.widget.widget.tasklist.count
|
|
|
|
|
|
|
|
-- ws.widget:connect_signal("property::count", function(self)
|
|
-- naughty.notification {
|
|
-- urgency = "critical",
|
|
-- message = tostring(ws.max)
|
|
-- }
|
|
-- ws.max = self.count
|
|
-- end)
|
|
|
|
awful.keygrabber {
|
|
keybindings = {
|
|
awful.key {
|
|
modifiers = { "Mod1" },
|
|
key = "Tab",
|
|
on_press = function()
|
|
-- naughty.notification {
|
|
-- urgency = "critical",
|
|
-- message = tostring(WS.widget)
|
|
-- }
|
|
naughty.notification {
|
|
urgency = "critical",
|
|
message = tostring(ws.selected)
|
|
}
|
|
-- local file = io.open("/home/delta/.cache/awesome/tasklist_dump.txt", "w+")
|
|
-- file:write(debug.dump_return(WS.widget, "tasklist"))
|
|
-- file:close()
|
|
-- ws.widget:emit_signal_recursive("widget::layout_changed")
|
|
-- WS.widget:emit_signal("widget::redraw_needed")
|
|
if ws.selected + 1 > ws.max then
|
|
ws.selected = 1
|
|
return
|
|
end
|
|
ws.selected = ws.selected + 1
|
|
end
|
|
},
|
|
awful.key {
|
|
modifiers = { "Mod1", "Shift" },
|
|
key = "Tab",
|
|
on_press = function()
|
|
ws.widget:emit_signal("widget::layout_changed")
|
|
if ws.selected - 1 == 0 then
|
|
ws.selected = ws.max
|
|
return
|
|
end
|
|
ws.selected = ws.selected - 1
|
|
end
|
|
},
|
|
},
|
|
stop_key = "Mod1",
|
|
stop_event = "release",
|
|
start_callback = function()
|
|
ws.widget.visible = true
|
|
naughty.notification {
|
|
urgency = "critical",
|
|
message = tostring(ws.max)
|
|
}
|
|
end,
|
|
stop_callback = function()
|
|
ws.widget.visible = false
|
|
end,
|
|
autostart = false
|
|
}
|