05-03-26
Launch Apps with Key Chords
This Lua script for Rebind hardware input allows you to launch applications using key chords. Configure a modifier key and bind up to three applications to number keys for quick access. The script use
rebindlua scriptapp launcherkey chordhardware inputscriptsystem.exec
Question
App launcher on key chord
Rebind AI
App Launcher on Key Chord
luau
-- rebind: min_sdk=0.1.0
-- rebind: name=App Launcher
local cfg = UI.Schema({
modifier = UI.Keybind("LAlt", { label = "Modifier Key" }),
app1_key = UI.Keybind("1", { label = "App 1 Key", group = "Bindings" }),
app1_path = UI.Text("notepad.exe", { label = "App 1 Path", group = "Bindings" }),
app2_key = UI.Keybind("2", { label = "App 2 Key", group = "Bindings" }),
app2_path = UI.Text("calc.exe", { label = "App 2 Path", group = "Bindings" }),
app3_key = UI.Keybind("3", { label = "App 3 Key", group = "Bindings" }),
app3_path = UI.Text("explorer.exe", { label = "App 3 Path", group = "Bindings" }),
})
local function launchApp(path)
if path and path ~= "" then
System.Exec("start " .. path)
UI.Notify("Launching: " .. path, "info")
else
UI.Notify("No path configured", "warning")
end
end
function OnDown(key)
if not Input.IsDown(cfg.modifier) then
return true
end
if key == cfg.app1_key then
launchApp(cfg.app1_path)
return false
elseif key == cfg.app2_key then
launchApp(cfg.app2_path)
return false
elseif key == cfg.app3_key then
launchApp(cfg.app3_path)
return false
end
return true
endHow it works
This script launches applications by pressing a modifier key (default Alt) + a number key (1, 2, or 3).
Key features:
- Configurable modifier: Set any key as the modifier (default LAlt)
- Three app slots: Each slot has a key binding and an executable path
- Paths can be relative or absolute:
notepad.exe,C:\path\to\app.exe,explorer C:\Users - Feedback: Shows a notification when launching
Usage:
- In the UI, configure the modifier key and up to three applications
- Hold the modifier and press 1, 2, or 3 to launch the corresponding app
- The original keys are blocked (not passed to the PC)
Tips:
- Use full paths for executables not in the system PATH:
C:\Program Files\App\app.exe - For folders: use
explorer C:\pathto open in File Explorer - For URLs: use
start https://example.com(opens default browser) - Add more app slots by copying the pattern and modifying the names
Learn more
- System.Exec — run shell commands
- UI Schema — create settings panels
- Input.IsDown — check physical key state
- OnDown Hook — respond to key presses