Created
September 5, 2020 14:38
-
-
Save deanishe/abf973c0a41a431c84fb16b402514546 to your computer and use it in GitHub Desktop.
Alfred plugin to run terminal commands in Alacritty
This file contains 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
on alacritty_win() | |
set _running to (application "Alacritty" is running) | |
tell application "Alacritty" to activate | |
tell application "System Events" | |
repeat while (name of first application process whose frontmost is true) is not "alacritty" | |
delay 0.05 | |
end repeat | |
set _alacritty to first application process whose frontmost is true | |
-- If Alacritty was running, create a new window to run command | |
if _running then | |
tell _alacritty to set _target to (count windows) + 1 | |
keystroke "n" using {command down} | |
else | |
set _target to 1 | |
end if | |
-- Wait for wanted window count | |
tell _alacritty | |
repeat while (count windows) < _target | |
delay 0.05 | |
end repeat | |
end tell | |
end tell | |
end alacritty_win | |
on alfred_script(q) | |
my alacritty_win() | |
tell application "System Events" | |
keystroke q | |
key code 36 | |
end tell | |
end alfred_script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment