[tabbar] change PID to windowID + add for both directions of pick/focus (#55)

tabbed mouse picker through window id instead of pid and allow for reverse pick
This commit is contained in:
Denis Efremov 2021-05-10 00:10:11 +03:00 committed by GitHub
parent 4afefe6c38
commit 3c86c2ca98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 10 deletions

View File

@ -61,19 +61,28 @@ tabbed.add = function(c, tabobj)
tabbed.switch_to(tabobj, #tabobj.clients)
end
-- use xprop to select one client and make it tab in the currently focused tab
-- use xwininfo to select one client and make it tab in the currently focused tab
tabbed.pick = function()
if not client.focus then return end
if not client.focus.bling_tabbed then tabbed.init(client.focus) end
local tabobj = client.focus.bling_tabbed
-- this function uses xprop to grab a client pid which is then
-- compared to all other client process ids
if not client.focus then return end
-- this function uses xwininfo to grab a client window id which is then
-- compared to all other clients window ids
local xprop_cmd = [[ xprop _NET_WM_PID | cut -d' ' -f3 ]]
awful.spawn.easy_async_with_shell(xprop_cmd, function(output)
local xwininfo_cmd = [[ xwininfo | grep 'xwininfo: Window id:' | cut -d " " -f 4 ]]
awful.spawn.easy_async_with_shell(xwininfo_cmd, function(output)
for _, c in ipairs(client.get()) do
if tonumber(c.pid) == tonumber(output) then
tabbed.add(c, tabobj)
if tonumber(c.window) == tonumber(output) then
if not client.focus.bling_tabbed and not c.bling_tabbed then
tabbed.init(client.focus)
tabbed.add(c, client.focus.bling_tabbed)
end
if not client.focus.bling_tabbed and c.bling_tabbed then
tabbed.add(client.focus, c.bling_tabbed)
end
if client.focus.bling_tabbed and not c.bling_tabbed then
tabbed.add(c, client.focus.bling_tabbed)
end
-- TODO: Should also merge tabs when focus and picked
-- both are tab groups
end
end
end)