blob: 5760886972891df034d302dd4cdae6701978df94 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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)
|