Skip to content

Instantly share code, notes, and snippets.

View directmusic's full-sized avatar
🗨️
idk

Joseph Lyncheski directmusic

🗨️
idk
View GitHub Profile
@directmusic
directmusic / core_audio_tap_example.m
Created May 10, 2024 20:55
An example how to use the new Core Audio Tap API in macOS 14.2.
// 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!
@directmusic
directmusic / ableton-cmd-w.lua
Created September 24, 2021 03:25
Ableton Live Hammerspoon - Close plugin window with CMD-W
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()