summaryrefslogtreecommitdiff
path: root/scroll/scripts
diff options
context:
space:
mode:
authorzsmith <zsmith@newhopechurch.tv>2025-08-11 09:26:05 -0500
committerzsmith <zsmith@newhopechurch.tv>2025-08-11 09:26:05 -0500
commit15e94d2694f8e84b0fa4454200c1c5bd0c449089 (patch)
treed25464c3943ecf7e608f7121c8912ec8aeaad39f /scroll/scripts
parent1fc7faa161550f0b43fcfa5b31f58035ddcbd2bc (diff)
Remove everything not Mac compatible
Diffstat (limited to 'scroll/scripts')
-rw-r--r--scroll/scripts/maximize.lua42
-rw-r--r--scroll/scripts/maximize_when_only.lua38
-rw-r--r--scroll/scripts/scratchpad.lua66
-rw-r--r--scroll/scripts/swallow.lua32
4 files changed, 0 insertions, 178 deletions
diff --git a/scroll/scripts/maximize.lua b/scroll/scripts/maximize.lua
deleted file mode 100644
index f0df156..0000000
--- a/scroll/scripts/maximize.lua
+++ /dev/null
@@ -1,42 +0,0 @@
-local args, state = ...
-
--- Set up views table
-local views = scroll.state_get_value(state, "views")
-if views == nil then
- scroll.state_set_value(state, "views", {})
- views = scroll.state_get_value(state, "views")
-end
-
-local function find_view(view)
- for _, v in ipairs(views) do
- if v["object"] == view then
- return v
- end
- end
- return nil
-end
-
-if args[1] == 'toggle' then
- local focused_view = scroll.focused_view()
- local view = find_view(focused_view)
- if view == nil then
- view = {
- object = focused_view,
- maximized = false,
- wf = 0,
- hf = 0
- }
- table.insert(views, view)
- end
- view["maximized"] = not view["maximized"]
- if view["maximized"] then
- local container = scroll.view_get_container(focused_view)
- view["wf"] = scroll.container_get_width_fraction(container)
- view["hf"] = scroll.container_get_height_fraction(container)
- scroll.command(nil, "set_size h 1.0")
- scroll.command(nil, "set_size v 1.0")
- else
- scroll.command(nil, "set_size h " .. view["wf"])
- scroll.command(nil, "set_size v " .. view["hf"])
- end
-end
diff --git a/scroll/scripts/maximize_when_only.lua b/scroll/scripts/maximize_when_only.lua
deleted file mode 100644
index a047180..0000000
--- a/scroll/scripts/maximize_when_only.lua
+++ /dev/null
@@ -1,38 +0,0 @@
-local args, state = ...
-
-local maximized_containers = scroll.state_get_value(state, "maximized_containers") or {}
-
-local debug_notify = function(msg)
- scroll.command(nil, "exec notify-send " .. msg)
-end
-
-local maximize_container = function(container, workspace)
- local wf = scroll.container_get_width_fraction(container)
- local hf = scroll.container_get_height_fraction(container)
- maximized_containers[workspace] = { container = container, wf = wf, hf = hf, workspace = workspace }
- scroll.state_set_value(state, "maximized_containers", maximized_containers)
- scroll.command(container, "set_size h 1.0")
- scroll.command(container, "set_size v 1.0")
-end
-
-local maximize_when_only = function()
- local focused_workspace = scroll.focused_workspace()
- local containers = scroll.workspace_get_tiling(focused_workspace)
- local focused_container = scroll.focused_container()
- local maximized_container = maximized_containers[focused_workspace]
- if #containers == 1 then
- if not maximized_container or (maximized_container and maximized_container.container ~= focused_container) then
- -- debug_notify("Maximizing")
- maximize_container(focused_container, focused_workspace)
- end
- elseif #containers > 1 and maximized_container then
- -- debug_notify("Shrinking")
- scroll.command(maximized_container.container, "set_size h " .. maximized_container.wf)
- scroll.command(maximized_container.container, "set_size v " .. maximized_container.hf)
- maximized_containers[focused_workspace] = nil
- scroll.state_set_value(state, "maximized_containers", maximized_containers)
- end
- scroll.command(focused_container, "nop")
-end
-
-scroll.add_callback("view_focus", maximize_when_only, nil)
diff --git a/scroll/scripts/scratchpad.lua b/scroll/scripts/scratchpad.lua
deleted file mode 100644
index 0afaa97..0000000
--- a/scroll/scripts/scratchpad.lua
+++ /dev/null
@@ -1,66 +0,0 @@
-local args, _ = ...
-local id = ""
-local terminal = false
-local command = nil
-
-for i, arg in ipairs(args) do
- if i <= 1 then
- id = arg
- if #args == 1 then
- command = arg
- end
- elseif i == 2 then
- if (arg == "kitty") then
- terminal = true
- else
- command = arg
- end
- elseif (terminal == true) then
- command = arg
- break
- end
-end
-
-command = command or "kitty"
-
-local function exists(id)
- local is_in_scratchpad = false
- local cons = scroll.scratchpad_get_containers()
- for _, con in ipairs(cons) do
- local views = scroll.container_get_views(con)
- for _, view in ipairs(views) do
- local app_id = scroll.view_get_app_id(view)
- if (app_id == id) then
- is_in_scratchpad = true
- end
- end
- end
- return is_in_scratchpad
-end
-
-local function is_focused(id)
- local view = scroll.focused_view()
- local app_id = scroll.view_get_app_id(view)
- return app_id == id
-end
-
-local function spawn(term, comm)
- if (term) then
- if (comm) then
- scroll.command(nil, "exec kitty --class " .. id .. " -e " .. comm)
- else
- scroll.command(nil, "exec kitty --class " .. id)
- end
- else
- scroll.command(nil, "exec " .. comm)
- end
-end
-
-if (not exists(id)) then
- spawn(terminal, command)
-end
-if (is_focused(id)) then
- scroll.command(nil, "scratchpad show")
-else
- scroll.command(nil, "[app_id=\"" .. id .. "\"] scratchpad show")
-end
diff --git a/scroll/scripts/swallow.lua b/scroll/scripts/swallow.lua
deleted file mode 100644
index 5760886..0000000
--- a/scroll/scripts/swallow.lua
+++ /dev/null
@@ -1,32 +0,0 @@
-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)
-
-