From 4c53b75a4c25177c905ae526c968d6fa9bbd6bf9 Mon Sep 17 00:00:00 2001 From: Yessiest Date: Thu, 16 Dec 2021 02:23:38 +0400 Subject: [PATCH] new widget stuff --- core/titlebar.lua | 20 +++++++++++++++++ widgets/window_debug.lua | 47 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 widgets/window_debug.lua diff --git a/core/titlebar.lua b/core/titlebar.lua index e1ec92c..882c423 100644 --- a/core/titlebar.lua +++ b/core/titlebar.lua @@ -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 diff --git a/widgets/window_debug.lua b/widgets/window_debug.lua new file mode 100644 index 0000000..3d7eb81 --- /dev/null +++ b/widgets/window_debug.lua @@ -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 + +