Core Concepts

Keybinds

Register and manage keybindings with modifier combos, multiple modes, and auto-persistence

Cross-unlocker keybinding system with modifier combos, three modes, auto-persistence, and GUI integration.

Registering in Code

-- Simple press
synq.keybinds.register("toggleRotation", "F5", function()
  synq.enabled = not synq.enabled
end)

-- Hold with interval
synq.keybinds.register("burstMode", "CTRL-F6", function()
  -- fires repeatedly while held
end, { mode = "hold", interval = 0.5 })

-- Toggle
synq.keybinds.register("aoePause", "SHIFT-F7", function(state)
  aoeEnabled = state
end, { mode = "toggle" })

-- Timed press (active for 1s after keypress)
synq.keybinds.register("trapKey", "F8", function()
  hunter.lastTrapKey = synq.time
end, { mode = "press", time = 1 })

Registering via GUI

keybindsTab:Keybind({
  name     = "Toggle Rotation",
  binding  = "hunter_toggleRotation",
  default  = "F5",
  mode     = "press",
  callback = function() synq.enabled = not synq.enabled end,
})

-- With macro integration (auto-queues synq.MacrosQueued["trap safe"])
keybindsTab:Keybind({
  name    = "Trap Safe",
  binding = "hunter_trapSafe",
  default = "F8",
  mode    = "press",
  time    = 1,
  macro   = "trap safe",
  callback = function() hunter.lastTrapKey = synq.time end,
})

Reading State in Rotation Code

Check keybind and macro state directly in your rotation logic:

if synq.BindPressed["hunter_trapSafe"] then ... end
if synq.MacrosQueued["trap safe"] then ... end

Management API

synq.keybinds.setKey(name, keyData)       -- Update key, auto-persist, evict conflicts
synq.keybinds.clearKey(name)              -- Unbind
synq.keybinds.getBinding(name)            -- Get binding or nil
synq.keybinds.getAll()                    -- All bindings
synq.keybinds.setEnabled(name, bool)      -- Enable/disable
synq.keybinds.unregister(name)            -- Remove entirely

Key Capture

Capture the next key press for dynamic rebinding:

synq.keybinds.captureNext(function(keyData, keyName)
  if keyData then print("Pressed: " .. keyName) end
end, { allowModifiers = false })

Utilities

synq.keybinds.isKeyDown(wowKey)
synq.keybinds.isComboDown(keyData)
synq.keybinds.normalizeKey("CTRL-F5")   -- -> {key="F5", mod="CTRL"}
synq.keybinds.getKeyName(keyData)        -- -> "CTRL+F5"

Key Format

Keys: F1-F24, A-Z, 0-9, NUMPAD0-NUMPAD9, arrows, INSERT/DELETE/HOME/END/PAGEUP/PAGEDOWN, ESCAPE/SPACE/ENTER/BACKSPACE/TAB, symbols, MBUTTON/BUTTON4/BUTTON5.

Modifiers: CTRL, ALT, SHIFT. Format: "CTRL-F5" or {key="F5", mod="CTRL"}.

Bindings auto-save via synq.NewConfig("synq_keybinds"). Duplicate combos are auto-evicted.


Next: Check out the SYNQ UI documentation to learn about building configuration interfaces for your routines.