swallowed clients are removed from all tags

This commit is contained in:
Nooo37 2020-11-02 08:37:39 +01:00
parent 916cafd8d9
commit c374a5b513
2 changed files with 31 additions and 2 deletions

27
module/helpers.lua Normal file
View File

@ -0,0 +1,27 @@
local awful = require("awful")
local helpers = {}
-- Turn off passed client (remove current tag from window's tags)
helpers.turn_off = function(c)
local current_tag = awful.tag.selected(c.screen)
local ctags = {}
for k,tag in pairs(c:tags()) do
if tag ~= current_tag then table.insert(ctags, tag) end
end
c:tags(ctags)
end
-- Turn on passed client
helpers.turn_on = function(c)
local current_tag = awful.tag.selected(c.screen)
ctags = {current_tag}
for k,tag in pairs(c:tags()) do
if tag ~= current_tag then table.insert(ctags, tag) end
end
c:tags(ctags)
c:raise()
client.focus = c
end
return helpers

View File

@ -2,6 +2,8 @@ local awful = require("awful")
local gears = require("gears")
local beautiful = require("beautiful")
local helpers = require(tostring(...):match(".*bling.module") .. ".helpers")
-- It might actually swallow too much, that's why there is a filter option by classname
-- without the don't-swallow-list it would also swallow for example
-- file pickers or new firefox windows spawned by an already existing one
@ -56,12 +58,12 @@ local function manage_clientspawn(c)
if (tostring(parent_pid) == tostring(parent_client.pid)) and check_if_swallow(c) then
c:connect_signal("unmanage", function()
parent_client.minimized = false
helpers.turn_on(parent_client)
copy_size(parent_client, c)
end)
copy_size(c, parent_client)
parent_client.minimized = true
helpers.turn_off(parent_client)
end
end