From a1942d97614983a947972195f748097da8185ba3 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Wed, 20 Aug 2014 15:21:35 -0700 Subject: [PATCH] Add more sophisticated synergy stopping commands. --- dotfiles/lib/shellrc/functions.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dotfiles/lib/shellrc/functions.sh b/dotfiles/lib/shellrc/functions.sh index c3aa8616..96e55031 100644 --- a/dotfiles/lib/shellrc/functions.sh +++ b/dotfiles/lib/shellrc/functions.sh @@ -228,10 +228,23 @@ function make_me_synergy() { synergyc $new_host_name } -function clear_synergy() { +function stop_synergy_at() { + pgrep synergys | xargs kill + ssh $1 "source ~/.zshrc && clear_my_synergy" +} + +function clear_all_synergy() { pgrep synergy | xargs kill } +function clear_my_synergy() { + clear_synergy_for_ip "$(echo $SSH_CONNECTION | get_cols 1)" +} + +function clear_synergy_for_ip() { + ps aux | grep -e synergyc | grep $1 | get_cols 2 | xargs kill +} + function activate_synergy_for() { synergys --config ~/synergy.conf && ssh $1 "source ~/.zshrc && make_me_synergy" }