summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachIR <zachir@librem.one>2025-07-26 13:00:36 -0500
committerZachIR <zachir@librem.one>2025-07-26 13:00:36 -0500
commit208a0ff78229e85a4a6ae448aac3c54686ca0585 (patch)
tree315e7371868b447d691b5df25540e125624be1c2
parentdc3897a61769a24cecb4f1ab8385c0cf6d21e4d4 (diff)
Add bare bones of window swallowing to scroll
-rw-r--r--scroll/config3
-rw-r--r--scroll/scripts/swallow.lua32
2 files changed, 35 insertions, 0 deletions
diff --git a/scroll/config b/scroll/config
index cb19b70..3c8b0c3 100644
--- a/scroll/config
+++ b/scroll/config
@@ -496,6 +496,9 @@ bindgesture swipe:4:left workspace prev
bindgesture swipe:4:up scale_workspace overview
+# Enable window swallowing (of mpv specifically)
+lua $home/.config/scroll/scripts/swallow.lua
+
#
# Workspace rules:
#
diff --git a/scroll/scripts/swallow.lua b/scroll/scripts/swallow.lua
new file mode 100644
index 0000000..5760886
--- /dev/null
+++ b/scroll/scripts/swallow.lua
@@ -0,0 +1,32 @@
+local function candidate(view)
+ local app_id = scroll.view_get_app_id(view)
+ if app_id == "mpv" then
+ local pview = scroll.view_get_parent_view(view)
+ if pview ~= nil and pview ~= view then
+ local papp_id = scroll.view_get_app_id(pview)
+ if papp_id == "kitty" then
+ return scroll.view_get_container(pview)
+ end
+ end
+ end
+ return nil
+end
+
+local function on_create(view, _)
+ local parent = candidate(view)
+ if parent ~= nil then
+ scroll.command(parent, "move scratchpad")
+ end
+end
+
+local function on_destroy(view, _)
+ local parent = candidate(view)
+ if parent ~= nil then
+ scroll.command(nil, "scratchpad show; floating toggle")
+ end
+end
+
+scroll.add_callback("view_map", on_create, nil)
+scroll.add_callback("view_unmap", on_destroy, nil)
+
+