Edited `tabbed.pick`
Replaced `io.popen` with `awful.spawn.easy_async_with_shell` to avoid freezing.
This commit is contained in:
parent
cd4a8928b2
commit
f62ad60388
|
@ -12,7 +12,7 @@ of a function.
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local beautiful = require("beautiful")
|
local beautiful = require("beautiful")
|
||||||
|
local naughty = require("naughty")
|
||||||
local helpers = require(tostring(...):match(".*bling.module") .. ".helpers")
|
local helpers = require(tostring(...):match(".*bling.module") .. ".helpers")
|
||||||
|
|
||||||
local bar_style = beautiful.tabbar_style or "default"
|
local bar_style = beautiful.tabbar_style or "default"
|
||||||
|
@ -76,14 +76,15 @@ tabbed.pick = function()
|
||||||
local tabobj = client.focus.bling_tabbed
|
local tabobj = client.focus.bling_tabbed
|
||||||
-- this function uses xprop to grab a client pid which is then
|
-- this function uses xprop to grab a client pid which is then
|
||||||
-- compared to all other client process ids
|
-- compared to all other client process ids
|
||||||
-- io.popen is normally discouraged. Works fine for now
|
|
||||||
local handle = io.popen("xprop _NET_WM_PID | cut -d' ' -f3")
|
local xprop_cmd = [[ xprop _NET_WM_PID | cut -d' ' -f3 ]]
|
||||||
local output = handle:read("*a")
|
awful.spawn.easy_async_with_shell(xprop_cmd, function(output)
|
||||||
handle:close()
|
|
||||||
-- search the client that was picked
|
|
||||||
for _, c in ipairs(client.get()) do
|
for _, c in ipairs(client.get()) do
|
||||||
if tonumber(c.pid) == tonumber(output) then tabbed.add(c, tabobj) end
|
if tonumber(c.pid) == tonumber(output) then
|
||||||
|
tabbed.add(c, tabobj)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- update everything about one tab object
|
-- update everything about one tab object
|
||||||
|
|
Loading…
Reference in New Issue