Shortcuts you invent, rules you write, gestures you own - all still just data
Claude-Session: https://claude.ai/code/session_01Ms2FbjQy31TVf3CEvQhGM8
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
-- ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
local prefs = require("prefs")
|
||||
local actions = require("actions")
|
||||
|
||||
hl.config({
|
||||
input = {
|
||||
@@ -141,4 +142,34 @@ hl.gesture({ fingers = 3, direction = "horizontal", action = "workspace" })
|
||||
hl.gesture({ fingers = 3, direction = "up", action = overview("open") })
|
||||
hl.gesture({ fingers = 3, direction = "down", action = overview("close") })
|
||||
|
||||
-- ── Four-finger gestures ────────────────────────────────────────────────────
|
||||
--
|
||||
-- The three above are the desktop's, fixed. These four are the user's: each
|
||||
-- holds a named action from settings.json, or {} for unassigned, and the
|
||||
-- vocabulary is exactly the one custom shortcuts use -- actions.lua resolves
|
||||
-- both, through the same whitelist tables, so a gesture can no more introduce
|
||||
-- a command than a keybind can.
|
||||
--
|
||||
-- Nothing is emitted for an unassigned direction. That matters more here than
|
||||
-- it looks: a registration is read at config time and there is no way to
|
||||
-- remove one afterwards, so emitting a no-op gesture for every direction would
|
||||
-- consume the four-finger swipes permanently, including for whatever the
|
||||
-- compositor might do with them later.
|
||||
--
|
||||
-- Four rather than three because three is spoken for, and because four fingers
|
||||
-- is the largest number of them a touchpad this size can tell apart.
|
||||
local custom_gestures = {
|
||||
{ pref = "gestureFourUp", direction = "up" },
|
||||
{ pref = "gestureFourDown", direction = "down" },
|
||||
{ pref = "gestureFourLeft", direction = "left" },
|
||||
{ pref = "gestureFourRight", direction = "right" },
|
||||
}
|
||||
|
||||
for _, gesture in ipairs(custom_gestures) do
|
||||
local action = actions.gesture(prefs.get(gesture.pref, {}))
|
||||
if action ~= nil then
|
||||
hl.gesture({ fingers = 4, direction = gesture.direction, action = action })
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user