diff options
author | ZachIR <zachir@librem.one> | 2025-07-26 13:01:51 -0500 |
---|---|---|
committer | ZachIR <zachir@librem.one> | 2025-07-26 13:01:51 -0500 |
commit | e7bd39aeda112e7c0dd0493fa3886149df2f2771 (patch) | |
tree | 284ecbfed3fb0c1216fefb28a02f1683f4f1c240 /scroll/scripts/swallow.lua | |
parent | 4f33e1fcdc425edec30791a8d54197284bed81ac (diff) | |
parent | b35c7ad4db8e604f109f4857a4ed5a1c236caf30 (diff) |
Merge branch 'master' into car
Diffstat (limited to 'scroll/scripts/swallow.lua')
-rw-r--r-- | scroll/scripts/swallow.lua | 32 |
1 files changed, 32 insertions, 0 deletions
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) + + |