better cross-platform td & hammerspoon config td poopup
This commit is contained in:
parent
cb31bc1848
commit
8db95ade26
11
scripts/hammerspoon_config
Normal file
11
scripts/hammerspoon_config
Normal 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)
|
||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Check if Zsh is available
|
# Check if Zsh is available
|
||||||
if command -v zsh >/dev/null 2>&1; then
|
if command -v zsh >/dev/null 2>&1; then
|
||||||
zsh scripts/tmux-td-zsh
|
zsh ~/git/configs/scripts/tmux-td-zsh
|
||||||
else
|
else
|
||||||
bash scripts/tmux-td-bash
|
bash ~/git/configs/scripts/tmux-td-bash
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -8,6 +8,28 @@ fi
|
|||||||
if [[ "$(tmux display-message -p -F "#{session_name}")" == "td-cli" ]]; then
|
if [[ "$(tmux display-message -p -F "#{session_name}")" == "td-cli" ]]; then
|
||||||
tmux detach-client
|
tmux detach-client
|
||||||
tmux display-popup -C
|
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
|
else
|
||||||
tmux display-popup -d -C -E -w90% -h90% 'tmux attach-session -x -f wait-exit -t td-cli'
|
tmux display-popup -d -C -E -w90% -h90% 'tmux attach-session -x -f wait-exit -t td-cli'
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user