hammerspoon icon indicating copy to clipboard operation
hammerspoon copied to clipboard

hs.execute window opens in background

Open hegga opened this issue 1 year ago • 1 comments

Hi!

First, thank you very much for an incredible piece of software!

I have a keybinding which opens the Alacritty terminal and executes a script, my problem is that often the Alacritty window opens in the background of for example the browser which has focus when I press the keybinding. Is there any way I can avoid this? This makes me having to Cmd+Tab to focus the Alacritty window.

The keybinding looks like this:

hs.hotkey.bind({ "cmd" }, "P", function()
  hs.execute("/Applications/Alacritty.app/Contents/MacOS/alacritty --command ~/bin/fuzzy_pass.sh")
end)

hegga avatar Jan 25 '24 12:01 hegga

Try adding the following after the execute statement:

hs.application.launchOrFocus("Alacritty")

dreness avatar Mar 31 '24 04:03 dreness