Skip to content

Commit

Permalink
Update docs
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 d4f1566 commit e3768d5
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 0 deletions.
68 changes: 68 additions & 0 deletions docs/MiddleClickDragScroll.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Hammerspoon docs: MiddleClickDragScroll</title>
<style type="text/css">
a { text-decoration: none; }
a:hover { text-decoration: underline; }
th { background-color: #DDDDDD; vertical-align: top; padding: 3px; }
td { width: 100%; background-color: #EEEEEE; vertical-align: top; padding: 3px; }
table { width: 100% ; border: 1px solid #0; text-align: left; }
section > table table td { width: 0; }
</style>
<link rel="stylesheet" href="docs.css" type="text/css" media="screen" />
</head>
<body>
<header>
<h1><a href="./index.html">docs</a> &raquo; MiddleClickDragScroll</h1>
<p>Allows scrolling by holding down the middle mouse button and dragging it, the same as it works on Windows.
Especially useful to quickly scroll to the top or bottom of a page, if you don't have a Magic Mouse.</p>
<p>Note: Due to OS limitations, it always scrolls the window currently below the mouse, not the window below the position
where the dragging started, like it works on Windows. You therefore need to take some care to stay inside the window.</p>
<p>== Usage ==</p>
<div class="highlight"><pre><span></span><span class="kd">local</span> <span class="n">MiddleClickDragScroll</span> <span class="o">=</span> <span class="n">hs</span><span class="p">.</span><span class="n">loadSpoon</span><span class="p">(</span><span class="s2">&quot;MiddleClickDragScroll&quot;</span><span class="p">):</span><span class="n">start</span><span class="p">()</span>
</pre></div>
<p>You can temporarily stop the spoon by calling <code>MiddleClickDragScroll:stop()</code> and then restart it by calling <code>MiddleClickDragScroll:start()</code> again.</p>
<p>== Configuration ==</p>
<div class="highlight"><pre><span></span><span class="kd">local</span> <span class="n">MiddleClickDragScroll</span> <span class="o">=</span> <span class="n">hs</span><span class="p">.</span><span class="n">loadSpoon</span><span class="p">(</span><span class="s2">&quot;MiddleClickDragScroll&quot;</span><span class="p">):</span><span class="n">configure</span><span class="p">{</span>
<span class="n">excludedApps</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;Some App&quot;</span><span class="p">,</span> <span class="s2">&quot;Other app&quot;</span><span class="p">},</span> <span class="c1">-- Don&#39;t activate scrolling in apps with these names</span>
<span class="n">excludedWindows</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;^Some Window Title$&quot;</span><span class="p">},</span> <span class="c1">-- Don&#39;t activate scrolling in windows with these names (supports regex, for exact match, use &quot;^title$&quot;)</span>
<span class="n">excludedUrls</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;^https://geogebra.calculator$&quot;</span><span class="p">},</span> <span class="c1">-- Don&#39;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)</span>
<span class="n">indicatorSize</span> <span class="o">=</span> <span class="mi">25</span><span class="p">,</span> <span class="c1">-- Size of the scrolling indicator in pixels</span>
<span class="n">indicatorAttributes</span> <span class="o">=</span> <span class="c1">-- 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.</span>
<span class="p">{</span>
<span class="nb">type</span> <span class="o">=</span> <span class="s2">&quot;circle&quot;</span><span class="p">,</span>
<span class="n">fillColor</span> <span class="o">=</span> <span class="p">{</span> <span class="n">red</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">green</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">blue</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">alpha</span> <span class="o">=</span> <span class="mf">0.3</span> <span class="p">},</span>
<span class="n">strokeColor</span> <span class="o">=</span> <span class="p">{</span> <span class="n">red</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> <span class="n">green</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> <span class="n">blue</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> <span class="n">alpha</span> <span class="o">=</span> <span class="mf">0.5</span> <span class="p">},</span>
<span class="p">},</span>
<span class="n">startDistance</span> <span class="o">=</span> <span class="mi">15</span><span class="p">,</span> <span class="c1">-- Minimal distance to drag the mouse before scrolling is triggered.</span>
<span class="n">scrollMode</span> <span class="o">=</span> <span class="s2">&quot;pixel&quot;</span><span class="p">,</span> <span class="c1">-- Whether the scroll speed is in &quot;line&quot;s or &quot;pixel&quot;s. Scrolling by lines has smooting in some applications</span>
<span class="c1">-- and therefore works with reduced frequency but it offers much less precise control.</span>
<span class="n">scrollFrequency</span> <span class="o">=</span> <span class="mf">0.01</span><span class="p">,</span> <span class="c1">-- How often to trigger scrolling (in seconds)</span>
<span class="n">scrollAccelaration</span> <span class="o">=</span> <span class="mi">30</span><span class="p">,</span> <span class="c1">-- How fast scrolling accelerates based on the mouse distance from the initial location. Larger is faster.</span>
<span class="n">scrollSpeedFn</span> <span class="o">=</span> <span class="c1">-- How scrolling accelerates based on the mouse distance from the initial location.</span>
<span class="c1">-- The default is dist^2 / scrollAcceleration^2. You can pass a custom function that recieves `self` as the first argument</span>
<span class="c1">-- and the absolute distance as the second and returns the resulting speed (in pixels or lines, depending on the scrollMode setting).</span>
<span class="kr">function</span><span class="p">(</span><span class="n">self</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span>
<span class="kr">return</span> <span class="p">(</span><span class="n">x</span> <span class="o">^</span> <span class="mi">2</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="n">self</span><span class="p">.</span><span class="n">scrollAccelaration</span> <span class="o">^</span> <span class="mi">2</span><span class="p">)</span>
<span class="kr">end</span>
<span class="p">}:</span><span class="n">start</span><span class="p">()</span>
</pre></div>
<p>Unspecified keys are unchanged. You can call <code>configure</code> multiple times to dynamically change it but changing <code>indicatorAttributes</code> and <code>indicatorSize</code> only works when <code>MiddleClickDragScroll</code> is stopped.</p>
<p>Instead of <code>indicatorSize</code> and <code>indicatorAttributes</code>, you can also pass a custom canvas to <code>configure</code> or set it directly to have more control over the indicator style:</p>
<div class="highlight"><pre><span></span><span class="n">MiddleClickDragScroll</span><span class="p">.</span><span class="n">canvas</span> <span class="o">=</span> <span class="n">hs</span><span class="p">.</span><span class="n">canvas</span><span class="p">.</span><span class="n">new</span><span class="p">{</span> <span class="n">w</span> <span class="o">=</span> <span class="mi">25</span><span class="p">,</span> <span class="n">h</span> <span class="o">=</span> <span class="mi">25</span><span class="p">}:</span><span class="n">insertElement</span><span class="p">{</span>
<span class="nb">type</span> <span class="o">=</span> <span class="s2">&quot;circle&quot;</span><span class="p">,</span>
<span class="n">fillColor</span> <span class="o">=</span> <span class="p">{</span> <span class="n">red</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">green</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">blue</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">alpha</span> <span class="o">=</span> <span class="mf">0.3</span> <span class="p">},</span>
<span class="n">strokeColor</span> <span class="o">=</span> <span class="p">{</span> <span class="n">red</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> <span class="n">green</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> <span class="n">blue</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> <span class="n">alpha</span> <span class="o">=</span> <span class="mf">0.5</span> <span class="p">},</span>
<span class="p">}</span>
</pre></div>
<p>For more details, see: https://www.hammerspoon.org/docs/hs.canvas.html</p>
<p>Download: <a href="https://github.com/Hammerspoon/Spoons/raw/master/Spoons/MiddleClickDragScroll.spoon.zip">https://github.com/Hammerspoon/Spoons/raw/master/Spoons/MiddleClickDragScroll.spoon.zip</a></p>

</header>
<h3>API Overview</h3>
<ul>
</ul>
<h3>API Documentation</h3>
</body>
</html>
17 changes: 17 additions & 0 deletions docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -8602,6 +8602,23 @@
"submodules": [],
"type": "Module"
},
{
"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"
},
{
"Command": [],
"Constant": [],
Expand Down
5 changes: 5 additions & 0 deletions docs/docs_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -1618,6 +1618,11 @@
"name": "toggleMicMute",
"type": "Method"
},
{
"desc": "Allows scrolling by holding down the middle mouse button and dragging it, the same as it works on Windows.",
"name": "MiddleClickDragScroll",
"type": "Module"
},
{
"desc": "With this script you will be able to move the window in halves and in corners using your keyboard and mainly using arrows. You would also be able to resize them by thirds, quarters, or halves.",
"name": "MiroWindowsManager",
Expand Down
5 changes: 5 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@ <h3>API documentation</h3>
<tr>
<th><a href="MicMute.html">MicMute</a></th>
<td><p>Microphone Mute Toggle and status indicator</p>
</td>
</tr>
<tr>
<th><a href="MiddleClickDragScroll.html">MiddleClickDragScroll</a></th>
<td><p>Allows scrolling by holding down the middle mouse button and dragging it, the same as it works on Windows.</p>
</td>
</tr>
<tr>
Expand Down
Loading

0 comments on commit e3768d5

Please sign in to comment.