new widget stuff

This commit is contained in:
Yessiest 2021-12-16 02:23:38 +04:00
parent 3c0a76e63f
commit 4c53b75a4c
2 changed files with 67 additions and 0 deletions

View File

@ -71,6 +71,26 @@ return function(c)
},
{ "Toggle on tag",
toggle_screentags
},
{ "Set as background",
function()
if G_BackgroundClient then
awful.titlebar.show(G_BackgroundClient)
G_BackgroundClient.below = false
G_BackgroundClient.sticky = false
end
awful.titlebar.hide(c)
c.below = true
c.sticky = true
G_BackgroundClient = c
end
},
{ "Debug info",
{
before = {
require("widgets.window_debug")(c),
},
}
}
},
vertical = true

47
widgets/window_debug.lua Normal file
View File

@ -0,0 +1,47 @@
wibox = require("wibox")
local infotab = {"window","name","skip_taskbar","type","class","instance","pid","role","machine","icon_name","icon","icon_sizes","screen","hidden","minimized","size_hints_honor","border_width","border_color","urgent","content","opacity","ontop","above","below","fullscreen","maximized","maximized_horizontal","maximized_vertical","transient_for","group_window","leader_window","size_hints","motif_wm_hints","sticky","modal","focusable","shape_bounding","shape_clip","shape_input","client_shape_bounding","client_shape_clip","startup_id","valid","first_tag","marked","is_fixed","immobilized","floating","x","y","width","height","dockable","requests_no_titlebar","shape"}
local function ellipsize(t)
if t:len() < 80 then
return t
else
return t:sub(1,80).."$"
end
end
local function generate_text(c)
local markup = ""
for k,v in pairs(infotab) do
markup = markup..tostring(v)..": "..ellipsize(tostring(c[v])).."\n"
end
return markup
end
return function(c)
local widget = {
{
widget = wibox.widget.textbox,
markup = "",
id = "text"
},
layout = wibox.container.scroll.vertical,
step_function = wibox.container.scroll.step_functions
.linear_back_and_forth,
max_size = 300,
speed = 100
}
widget[1].markup = generate_text(c)
widget = wibox.widget(widget)
widget:pause()
widget:connect_signal("button::press",function(self,lx,ly,button)
if button == 1 then
widget:get_children_by_id("text")[1].markup = generate_text(c)
end
end)
widget:connect_signal("mouse::enter",function()
widget:pause()
end)
widget:connect_signal("mouse::leave",function()
widget:continue()
end)
return widget
end