Skip to content

Instantly share code, notes, and snippets.

@mwild1
Created February 27, 2022 14:05
Show Gist options
  • Save mwild1/ef8d21f5ece265bb180fa657076eddf7 to your computer and use it in GitHub Desktop.
Save mwild1/ef8d21f5ece265bb180fa657076eddf7 to your computer and use it in GitHub Desktop.
-- Near the top of rc.lua:
local guieditor = "/usr/bin/gedit" -- if you haven't already defined something
do
local useful_props = {
"type", "name", "role", "class", "instance", "machine", "icon_name", "screen";
"skip_taskbar", "pid";
"startup_id", "window", "group_window", "leader_window";
}
function dump_props(c)
c = c or client.focus;
if not c then return "no client"; end
local props = {};
for _, prop in ipairs(useful_props) do
props[prop] = c[prop];
end
return gears.debug.dump_return(props);
end
function dump_mouseover_props()
local prop_string = dump_props(mouse.object_under_pointer());
local tmpfile = os.tmpname();
local f = io.open(tmpfile, "w+");
if f then
f:write(prop_string, "\n");
f:flush();
f:close();
awful.spawn({guieditor, tmpfile});
end
end
end
-- Example keybinding:
awful.key({ modkey, "Control" }, "p", dump_mouseover_props,
{description = "dump properties of client under cursor", group = "debug"}),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment