This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a quick example of how to use the CoreAudio API and the new Tapping | |
// API to create a tap on the default audio device. You need macOS 14.2 or | |
// later. | |
// Build command: | |
// clang -framework Foundation -framework CoreAudio main.m -o tapping | |
// License: You're welcome to do whatever you want with this code. If you do | |
// something cool please tell me though. I would love to hear about it! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
live_hotkey = hs.hotkey.bind({"cmd"}, "W", function() | |
local win = hs.window.focusedWindow() | |
if win:application():name() == "Live" then -- Check if window belongs to Live | |
if string.find(win:title(), "/") then -- Plugin windows in Live have "/" in the title. The main window does not. | |
win:close(); | |
end | |
else | |
live_hotkey:disable(); -- we have to disable the hotkey to send CMD-W through | |
hs.eventtap.event.newKeyEvent(hs.keycodes.map.cmd, true):post() | |
hs.eventtap.event.newKeyEvent("w", true):post() |