better cross-platform td & hammerspoon config td poopup

This commit is contained in:
Kacper Marzecki 2025-03-19 23:00:31 +01:00
parent cb31bc1848
commit 8db95ade26
3 changed files with 35 additions and 2 deletions

View File

@ -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)

View File

@ -2,7 +2,7 @@
# Check if Zsh is available
if command -v zsh >/dev/null 2>&1; then
zsh scripts/tmux-td-zsh
zsh ~/git/configs/scripts/tmux-td-zsh
else
bash scripts/tmux-td-bash
bash ~/git/configs/scripts/tmux-td-bash
fi

View File

@ -8,6 +8,28 @@ fi
if [[ "$(tmux display-message -p -F "#{session_name}")" == "td-cli" ]]; then
tmux detach-client
tmux display-popup -C
osascript <<EOF
tell application "System Events"
set frontApp to name of first application process whose frontmost is true
end tell
if frontApp is "Terminal" then
tell application "Terminal"
activate
delay 0.1
tell application "System Events"
keystroke "x" using control down -- Send Ctrl + x (tmux prefix)
delay 0.1
keystroke ":kill-session"
key code 36 -- Press Enter to execute :detach
delay 0.2
keystroke "exit"
key code 36 -- Press Enter to execute exit
end tell
end tell
end if
EOF
osascript -e 'tell application "Terminal" to quit'
else
tmux display-popup -d -C -E -w90% -h90% 'tmux attach-session -x -f wait-exit -t td-cli'
fi