You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since 6a97635 there is a Lua API and lua command to provide scripting abilities to scroll.
Using the command lua you can run Lua scripts that access window manager properties, execute commands or add callbacks to window events.
You can assign scripts to keyboard bindings, or add them to your configuration for execution when the configuration loads.
I opened this issue for feedback, suggestions on how to improve the API, or cool scripts you created that are using the API. Once the API is mature, I will add it to scroll stable.
Feel welcome to share any ideas or missing APIs you'd like to have.
To read more about the API, man 5 scroll and search for the LUA section.
If the current focused window is a neovim instance, when called, this script resizes neovim's window height to 0.66667, and opens a kitty terminal under it with height 0.33333. When you close the neovim window, the terminal is also automatically closed.
This script is en example implementation of swallowing using the Lua API.
When you start mpv from a kitty terminal, the terminal window will be swallowed to the scratchpad. When you close the mpv window, the terminal will appear again.
The script could be added to ~/.config/scroll/config so it is always active
Set a callback on workspace_create (on_create_ws), so each time a workspace with name 9 gets created, it opens and resizes a kitty terminal.
The workspace_create callback sets a callback on view_map and then execs kitty. The view_map callback gets executed when a new application (kitty) is ready. It resizes the container for the application and then removes the view_map callback so it doesn't run again until reset by a new workspace 9 creation.
This script can be used as a workspace rule. Every time a workspace is created, you can do things.
You should get function auto-completion by simply adding local scroll = require("scroll") near the top of the file, something like:
localargs, state=...localscroll=require("scroll")
-- Now you can write scroll.work and press your auto-completion key binding to get a list of functions in the scroll module that begin with `work`.
You should get function auto-completion by simply adding local scroll = require("scroll") near the top of the file, something like:
local args, state = ...
local scroll = require("scroll")
-- Now you can write scroll.work and press your auto-completion key binding to get a list of functions in the scroll module that begin with work.
Yeah, this works, but how can I get completions for core api-functions? this only provides auto-completion for functions that are defined inside the file.
It's not that viable, if that would be too much work, though. It just would be a nice addition to have so we don't have to read the manpages to know about the api functions.
Activity
dawsers commentedon Jul 7, 2025
if you wanted to focus on every window that gets the urgent attribute, you could call this script from your config file:
If the current focused window is a neovim instance, when called, this script resizes neovim's window height to 0.66667, and opens a kitty terminal under it with height 0.33333. When you close the neovim window, the terminal is also automatically closed.
Select and move every tiling kitty terminal from the focused workspace to workspace number 2.
dawsers commentedon Jul 8, 2025
Another example navigating the containers of a workspace.
Toggle a master-type window layout using a key binding
dawsers commentedon Jul 8, 2025
This script is en example implementation of
swallowingusing the Lua API.When you start mpv from a kitty terminal, the terminal window will be swallowed to the scratchpad. When you close the mpv window, the terminal will appear again.
The script could be added to
~/.config/scroll/configso it is always activeswallow.luadawsers commentedon Jul 13, 2025
Callbacks
Set a callback on
workspace_create(on_create_ws), so each time a workspace with name9gets created, it opens and resizes a kitty terminal.The
workspace_createcallback sets a callback onview_mapand then execs kitty. Theview_mapcallback gets executed when a new application (kitty) is ready. It resizes the container for the application and then removes theview_mapcallback so it doesn't run again until reset by a new workspace 9 creation.This script can be used as a workspace rule. Every time a workspace is created, you can do things.
You can add this to your configuration:
dawsers commentedon Jul 16, 2025
Maximize Toggle
This script can be used to toggle the geometry of a window between its state and a fully maximized one
Add a key binding to your configuration, like for example:
And save this script to
$lua_scripts/maximize.luamaximize.luavoidstar-null commentedon Jul 17, 2025
Hi, is there a way to get lsp autocompletions, like we can get via setting the
vimglobal variable inside neovim in the lsp spec ?dawsers commentedon Jul 17, 2025
You should get function auto-completion by simply adding
local scroll = require("scroll")near the top of the file, something like:voidstar-null commentedon Jul 17, 2025
Yeah, this works, but how can I get completions for core api-functions? this only provides auto-completion for functions that are defined inside the file.
It's not that viable, if that would be too much work, though. It just would be a nice addition to have so we don't have to read the manpages to know about the api functions.
dawsers commentedon Jul 17, 2025
Yes, sorry, I don't know how to do that. I think you need to use LuaJIT and FFI to be able to have that functionality, but I am using regular Lua.