Hammerspoon / hammerspoon

Staggeringly powerful macOS desktop automation with Lua

Home Page:http://www.hammerspoon.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there a solution to implement SpaceFN

zhangkunming opened this issue · comments

-- Enter Hyper Mode when Spacebar is pressed
pressedSpace = function()
  modal.triggered = false
  modal:enter()
end

releasedSpace = function()
  modal:exit()
  if not modal.triggered then
  	space:disable()
    hs.eventtap.keyStroke( {}, 'space' )
    space:enable()
  end
end

space = hs.hotkey.bind( {}, 'space', pressedSpace, releasedSpace )

-- Hyper binds
modal = hs.hotkey.modal.new( {}, 'f20' );
modal:bind( '', 'a', function() modal.triggered = true; os.execute("~/bin/app") end )
modal:bind( '', 'b', function() modal.triggered = true; hs.eventtap.keyStroke( { "ctrl", "alt", "cmd", "shift" }, 'b' ) end )

Don't forget to exclude some apps to increase hammerspoon speed. Here is my list, it must be at the start of init.lua

local SKIP_APPS={
		['com.bjango.istatmenus.status']=true,
		['com.codeweavers.CrossOver']=true,
		['com.blackmagic-design.DaVinciResolve']=true,
		['com.apple.BluetoothSettings']=true,
		['com.apple.WalletSettingsExtension']=true,
		['com.apple.inputmethod.EmojiFunctionRowItem']=true,
		['com.apple.security.Keychain-Circle-Notification']=true,
		['com.apple.PressAndHold']=true,
		['com.apple.inputmethod.EmojiFunctionRowItem']=true,
		['com.apple.quicklook.QuickLookUIService']=true,
		['com.apple.WebKit.WebContent']=true}