From c374a5b5138b1815dc60c40214533be89ef7e706 Mon Sep 17 00:00:00 2001 From: Nooo37 Date: Mon, 2 Nov 2020 08:37:39 +0100 Subject: [PATCH] swallowed clients are removed from all tags --- module/helpers.lua | 27 +++++++++++++++++++++++++++ module/window_swallowing.lua | 6 ++++-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 module/helpers.lua diff --git a/module/helpers.lua b/module/helpers.lua new file mode 100644 index 0000000..b26d552 --- /dev/null +++ b/module/helpers.lua @@ -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 diff --git a/module/window_swallowing.lua b/module/window_swallowing.lua index 9c7c161..e9f0c4b 100644 --- a/module/window_swallowing.lua +++ b/module/window_swallowing.lua @@ -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