- Notifications
You must be signed in to change notification settings - Fork 27
Home
cycle4passion edited this page Oct 7, 2016 · 9 revisions
-- Trigger existing hyper key shortcuts k:bind({}, 'm', nil, function() hs.eventtap.keyStroke({"cmd","alt","shift","ctrl"}, 'm') end)Make sure to include the full path to the script/binary.
k:bind({}, 's', nil, function() hs.task.new('/usr/bin/say', nil, {'Hello, this is a test'}):start(); end)-- Launch or Focus an App launch = function(appname) hs.application.launchOrFocus(appname) k.triggered = true end k:bind({}, 'f', nil, function() launch('Finder') end)-- Trigger another keystroke k:bind({}, 'l', nil, function() hs.eventtap.keyStroke({'⌃'}, 'l'); k.triggered = true; end)launch = function(appname) hs.application.launchOrFocus(appname) k.triggered = true end -- Single keybinding for app launch singleapps = { {'q', 'MailMate'}, {'w', 'OmniFocus'}, {'e', 'Sublime Text'}, {'r', 'Google Chrome'} } for i, app in ipairs(singleapps) do k:bind({}, app[1], function() launch(app[2]); k:exit(); end) end-- Sequential keybindings, e.g. Hyper-a,f for Finder a = hs.hotkey.modal.new({}, "F16") apps = { {'d', 'Twitter'}, {'f', 'Finder'}, {'s', 'Skype'}, } for i, app in ipairs(apps) do a:bind({}, app[1], function() launch(app[2]); a:exit(); end) end pressedA = function() a:enter() end releasedA = function() end k:bind({}, 'a', nil, pressedA, releasedA)