I'm coming from using Linux or Windows.
For example, I'm trying to allow myself to use cmd+c or ctrl+c to copy text in macOS. This is the Hammerspoon script I have, but it doesn't seem to be working:
-- Create an event tap for keyDown and keyUp events
controlToCommandTap = hs.eventtap.new(
{hs.eventtap.event.types.keyDown, hs.eventtap.event.types.keyUp},
function(evt)
-- Get the frontmost application
local frontmostApp = hs.application.frontmostApplication()
-- If Terminal is frontmost, do not modify the event
if frontmostApp and frontmostApp:name() == "Terminal" then
return false
end
local flags = evt:getFlags()
-- If the event includes the Control key, transform it into a Command key press
if flags.ctrl then
flags.ctrl = nil -- remove ctrl flag
flags.cmd = true -- add cmd flag
evt:setFlags(flags)
-- Suppress the original event and return the modified one
return true, {evt}
end
return false
end
)