diff --git a/hammerspoon/init.lua b/hammerspoon/init.lua new file mode 100644 index 0000000..0c34e7c --- /dev/null +++ b/hammerspoon/init.lua @@ -0,0 +1,11 @@ +hs.hotkey.bind({ "cmd" }, "\\", function() + hs.application.launchOrFocus("Terminal") + hs.timer.doAfter(0.1, function() + hs.osascript.applescript([[ + tell application "Terminal" + do script "tmux" in front window + do script "tmux-td" in front window + end tell + ]]) + end) +end) diff --git a/scripts/tmux-td-zsh b/scripts/tmux-td-zsh index a486818..8c0ed00 100755 --- a/scripts/tmux-td-zsh +++ b/scripts/tmux-td-zsh @@ -16,13 +16,14 @@ end tell if frontApp is "Terminal" then tell application "Terminal" activate - delay 0.1 + delay 0.3 tell application "System Events" keystroke "x" using control down -- Send Ctrl + x (tmux prefix) - delay 0.1 + delay 0.3 keystroke ":kill-session" + delay 0.3 key code 36 -- Press Enter to execute :detach - delay 0.2 + delay 0.3 keystroke "exit" key code 36 -- Press Enter to execute exit end tell