Last active
November 14, 2024 07:33
-
-
Save eltercero/f045fdd9fa56935fa543 to your computer and use it in GitHub Desktop.
Config file for hammerspoon
This file contains hidden or 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
local hotkey = require "hs.hotkey" | |
local application = require "hs.application" | |
-- HOTKEYS | |
local hyper = {"ctrl", "alt", "cmd"} | |
local app_opener = {"cmd", "ctrl"} | |
function toggle_app(app_name) | |
return function() | |
local app = hs.appfinder.appFromName(app_name) | |
if not app then | |
application.launchOrFocus(app_name) | |
end | |
current_app = application.frontmostApplication() | |
if current_app == app then | |
app:hide() | |
else | |
application.launchOrFocus(app_name) | |
end | |
end | |
end | |
-- SHORTCUTS | |
-- Focus or open apps | |
hotkey.bind( app_opener, "A", toggle_app("Safari") ) | |
hotkey.bind( app_opener, "F", toggle_app("Firefox") ) | |
hotkey.bind( app_opener, "S", toggle_app("Sublime Text") ) | |
hotkey.bind( app_opener, "I", toggle_app("iTerm") ) | |
hotkey.bind( app_opener, "L", toggle_app("Slack") ) | |
hotkey.bind( app_opener, "K", toggle_app("Slack") ) | |
-- Miro Window Management config | |
-- https://github.com/miromannino/miro-windows-manager | |
hs.loadSpoon("MiroWindowsManager") | |
hs.window.animationDuration = 0.3 | |
spoon.MiroWindowsManager:bindHotkeys({ | |
up = {hyper, "up"}, | |
right = {hyper, "right"}, | |
down = {hyper, "down"}, | |
left = {hyper, "left"}, | |
fullscreen = {hyper, "f"} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment