From 879583a1b699319cef541ab7e9d5a1cd1ef81239 Mon Sep 17 00:00:00 2001 From: "Simen A. W. Olsen" Date: Mon, 19 Feb 2024 11:04:48 +0100 Subject: more lua, hammerspoon and aliases improvements --- .hammerspoon/hyper.lua | 26 +++++++++++++++----------- .hammerspoon/init.lua | 3 +++ 2 files changed, 18 insertions(+), 11 deletions(-) (limited to '.hammerspoon') diff --git a/.hammerspoon/hyper.lua b/.hammerspoon/hyper.lua index 2124bca..4cca4db 100644 --- a/.hammerspoon/hyper.lua +++ b/.hammerspoon/hyper.lua @@ -1,23 +1,27 @@ local hyper = hs.hotkey.modal.new({}, nil) hyper.pressed = function() - hyper:enter() + hyper:enter() end hyper.released = function() - hyper:exit() + hyper:exit() end --- Bind the Hyper key to the hammerspoon modal -hs.hotkey.bind({}, "F13", hyper.pressed, hyper.released) +-- Hyper mode needs to be bound to a key. Here we are binding +-- it to F17, because this is yet another key that's unused. +-- Why not F18? We will use key-events from F18 to turn hyper +-- mode on and off. Using F17 as both the modal and source of key +-- events will result in a very jittery Hyper mode. +hs.hotkey.bind({}, "F18", hyper.pressed, hyper.released) hyper.bindApp = function(mods, key, app) - local fn = function() - hs.application.launchOrFocus(app) - end - if type(app) == "function" then - fn = app - end - hyper:bind(mods, key, fn) + local fn = function() + hs.application.launchOrFocus(app) + end + if type(app) == "function" then + fn = app + end + hyper:bind(mods, key, fn) end return hyper diff --git a/.hammerspoon/init.lua b/.hammerspoon/init.lua index b8b7e84..f4ee5d1 100644 --- a/.hammerspoon/init.lua +++ b/.hammerspoon/init.lua @@ -5,3 +5,6 @@ hyper.bindApp({}, "w", "Warp") hyper.bindApp({}, "s", "Slack") hyper.bindApp({}, "1", "1Password") hyper.bindApp({}, "r", "Rize") +hyper.bindApp({}, "d", "Obsidian") +hyper.bindApp({}, "c", "Google Chrome") +hyper.bindApp({}, "t", "Notification Center") -- cgit v1.2.3