Skip to content

Commit

Permalink
Generate docs for MiddleClickDragScroll
Browse files Browse the repository at this point in the history
  • Loading branch information
Spoons GitHub Bot authored and Spoons GitHub Bot committed Aug 7, 2024
1 parent 8394835 commit 2be0bb5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Source/MiddleClickDragScroll.spoon/docs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[
{
"Command": [],
"Constant": [],
"Constructor": [],
"Deprecated": [],
"Field": [],
"Function": [],
"Method": [],
"Variable": [],
"desc": "Allows scrolling by holding down the middle mouse button and dragging it, the same as it works on Windows.",
"doc": "Allows scrolling by holding down the middle mouse button and dragging it, the same as it works on Windows.\nEspecially useful to quickly scroll to the top or bottom of a page, if you don't have a Magic Mouse.\n\nNote: Due to OS limitations, it always scrolls the window currently below the mouse, not the window below the position\nwhere the dragging started, like it works on Windows. You therefore need to take some care to stay inside the window.\n\n== Usage ==\n\n```lua\nlocal MiddleClickDragScroll = hs.loadSpoon(\"MiddleClickDragScroll\"):start()\n```\n\nYou can temporarily stop the spoon by calling `MiddleClickDragScroll:stop()` and then restart it by calling `MiddleClickDragScroll:start()` again.\n\n== Configuration ==\n\n```lua\nlocal MiddleClickDragScroll = hs.loadSpoon(\"MiddleClickDragScroll\"):configure{\n excludedApps = {\"Some App\", \"Other app\"}, -- Don't activate scrolling in apps with these names\n excludedWindows = {\"^Some Window Title$\"}, -- Don't activate scrolling in windows with these names (supports regex, for exact match, use \"^title$\")\n excludedUrls = {\"^https://geogebra.calculator$\"}, -- Don't activate scrolling when the active window is on these URLs (supports regex, only works in Chrome and Safari, asks for extra permissions on first trigger)\n indicatorSize = 25, -- Size of the scrolling indicator in pixels\n indicatorAttributes = -- Attributes of the scrolling indicator. Takes any specified on https://www.hammerspoon.org/docs/hs.canvas.html#attributes. Alternatively, you can pass a custom canvas, see the explenation below.\n {\n type = \"circle\",\n fillColor = { red = 0, green = 0, blue = 0, alpha = 0.3 },\n strokeColor = { red = 1, green = 1, blue = 1, alpha = 0.5 },\n },\n startDistance = 15, -- Minimal distance to drag the mouse before scrolling is triggered.\n scrollMode = \"pixel\", -- Whether the scroll speed is in \"line\"s or \"pixel\"s. Scrolling by lines has smooting in some applications\n -- and therefore works with reduced frequency but it offers much less precise control.\n scrollFrequency = 0.01, -- How often to trigger scrolling (in seconds)\n scrollAccelaration = 30, -- How fast scrolling accelerates based on the mouse distance from the initial location. Larger is faster.\n scrollSpeedFn = -- How scrolling accelerates based on the mouse distance from the initial location.\n -- The default is dist^2 / scrollAcceleration^2. You can pass a custom function that recieves `self` as the first argument\n -- and the absolute distance as the second and returns the resulting speed (in pixels or lines, depending on the scrollMode setting).\n function(self, x)\n return (x ^ 2) / (self.scrollAccelaration ^ 2)\n end\n}:start()\n```\n\nUnspecified keys are unchanged. You can call `configure` multiple times to dynamically change it but changing `indicatorAttributes` and `indicatorSize` only works when `MiddleClickDragScroll` is stopped.\n\nInstead of `indicatorSize` and `indicatorAttributes`, you can also pass a custom canvas to `configure` or set it directly to have more control over the indicator style:\n\n```lua\n MiddleClickDragScroll.canvas = hs.canvas.new{ w = 25, h = 25}:insertElement{\n type = \"circle\",\n fillColor = { red = 0, green = 0, blue = 0, alpha = 0.3 },\n strokeColor = { red = 1, green = 1, blue = 1, alpha = 0.5 },\n }\n```\n\nFor more details, see: https://www.hammerspoon.org/docs/hs.canvas.html\n\nDownload: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/MiddleClickDragScroll.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/MiddleClickDragScroll.spoon.zip)",
"items": [],
"name": "MiddleClickDragScroll",
"stripped_doc": "Especially useful to quickly scroll to the top or bottom of a page, if you don't have a Magic Mouse.\n\nNote: Due to OS limitations, it always scrolls the window currently below the mouse, not the window below the position\nwhere the dragging started, like it works on Windows. You therefore need to take some care to stay inside the window.\n\n== Usage ==\n\n```lua\nlocal MiddleClickDragScroll = hs.loadSpoon(\"MiddleClickDragScroll\"):start()\n```\n\nYou can temporarily stop the spoon by calling `MiddleClickDragScroll:stop()` and then restart it by calling `MiddleClickDragScroll:start()` again.\n\n== Configuration ==\n\n```lua\nlocal MiddleClickDragScroll = hs.loadSpoon(\"MiddleClickDragScroll\"):configure{\n excludedApps = {\"Some App\", \"Other app\"}, -- Don't activate scrolling in apps with these names\n excludedWindows = {\"^Some Window Title$\"}, -- Don't activate scrolling in windows with these names (supports regex, for exact match, use \"^title$\")\n excludedUrls = {\"^https://geogebra.calculator$\"}, -- Don't activate scrolling when the active window is on these URLs (supports regex, only works in Chrome and Safari, asks for extra permissions on first trigger)\n indicatorSize = 25, -- Size of the scrolling indicator in pixels\n indicatorAttributes = -- Attributes of the scrolling indicator. Takes any specified on https://www.hammerspoon.org/docs/hs.canvas.html#attributes. Alternatively, you can pass a custom canvas, see the explenation below.\n {\n type = \"circle\",\n fillColor = { red = 0, green = 0, blue = 0, alpha = 0.3 },\n strokeColor = { red = 1, green = 1, blue = 1, alpha = 0.5 },\n },\n startDistance = 15, -- Minimal distance to drag the mouse before scrolling is triggered.\n scrollMode = \"pixel\", -- Whether the scroll speed is in \"line\"s or \"pixel\"s. Scrolling by lines has smooting in some applications\n -- and therefore works with reduced frequency but it offers much less precise control.\n scrollFrequency = 0.01, -- How often to trigger scrolling (in seconds)\n scrollAccelaration = 30, -- How fast scrolling accelerates based on the mouse distance from the initial location. Larger is faster.\n scrollSpeedFn = -- How scrolling accelerates based on the mouse distance from the initial location.\n -- The default is dist^2 / scrollAcceleration^2. You can pass a custom function that recieves `self` as the first argument\n -- and the absolute distance as the second and returns the resulting speed (in pixels or lines, depending on the scrollMode setting).\n function(self, x)\n return (x ^ 2) / (self.scrollAccelaration ^ 2)\n end\n}:start()\n```\n\nUnspecified keys are unchanged. You can call `configure` multiple times to dynamically change it but changing `indicatorAttributes` and `indicatorSize` only works when `MiddleClickDragScroll` is stopped.\n\nInstead of `indicatorSize` and `indicatorAttributes`, you can also pass a custom canvas to `configure` or set it directly to have more control over the indicator style:\n\n```lua\n MiddleClickDragScroll.canvas = hs.canvas.new{ w = 25, h = 25}:insertElement{\n type = \"circle\",\n fillColor = { red = 0, green = 0, blue = 0, alpha = 0.3 },\n strokeColor = { red = 1, green = 1, blue = 1, alpha = 0.5 },\n }\n```\n\nFor more details, see: https://www.hammerspoon.org/docs/hs.canvas.html\n\nDownload: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/MiddleClickDragScroll.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/MiddleClickDragScroll.spoon.zip)",
"submodules": [],
"type": "Module"
}
]

0 comments on commit 2be0bb5

Please sign in to comment.