diff options
author | Aylur <[email protected]> | 2024-09-28 18:50:20 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-09-28 18:50:20 +0200 |
commit | 9e63fe3819b19555c39c56a9d098c0ee35fbaf3d (patch) | |
tree | 87bc401b0dd86a9b132aff57e9ccc9e79579f82e /core | |
parent | d9cdac25f78f4c9aaf0b12461a0d737dc392e746 (diff) | |
parent | 7b4ae28bf0cdf1b5f2b5cf058577f8a81d641c42 (diff) |
Merge pull request #25 from Aylur/fix/astalify-remove-children
core: fix astalified container not removing children
Diffstat (limited to 'core')
-rw-r--r-- | core/gjs/src/astalify.ts | 6 | ||||
-rw-r--r-- | core/lua/astal/widget.lua | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/core/gjs/src/astalify.ts b/core/gjs/src/astalify.ts index bfe6623..d1c8df5 100644 --- a/core/gjs/src/astalify.ts +++ b/core/gjs/src/astalify.ts @@ -19,6 +19,12 @@ function setChildren(parent: Gtk.Widget, children: Gtk.Widget[]) { if (ch) parent.remove(ch) } + else if (parent instanceof Gtk.container && + !(parent instanceof Astal.Box || + parent instanceof Astal.Stack)) { + for(const ch of parent.get_children()) + parent.remove(ch) + } // TODO: add more container types if (parent instanceof Astal.Box) { diff --git a/core/lua/astal/widget.lua b/core/lua/astal/widget.lua index 1f5b07b..f525f4e 100644 --- a/core/lua/astal/widget.lua +++ b/core/lua/astal/widget.lua @@ -60,6 +60,12 @@ local function set_children(parent, children) if rm ~= nil then parent:remove(rm) end + elseif Gtk.Container:is_type_of(parent) and + !(Astal.Box:is_type_of(parent) or + Astal.Stack:is_type_of(parent)) then + for _, ch in ipairs(parent:get_children()) do + parent:remove(ch) + end end -- TODO: add more container types |