2016-08-11 11:07:24 -06:00
|
|
|
SYNERGY_CONF="$HOME/.synergy.conf"
|
2015-01-03 21:55:50 -07:00
|
|
|
|
2016-08-15 12:53:29 -06:00
|
|
|
synergy_start_client_at() {
|
2016-10-18 21:51:14 -06:00
|
|
|
ssh "$1" '[[ -z "$(pgrep synergyc)" ]] && synergyc '"$(localip)"
|
2016-08-15 12:53:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
synergy_start_server_here() {
|
|
|
|
test -z "$(pgrep synergys)" && synergys --config "$SYNERGY_CONF"
|
|
|
|
}
|
|
|
|
|
|
|
|
synergy_init_with_client() {
|
|
|
|
synergy_start_server_here
|
|
|
|
synergy_start_client_at "$1"
|
|
|
|
}
|
|
|
|
|
|
|
|
synergy_use_ssh_connection_as_server() {
|
|
|
|
local new_host_name
|
|
|
|
new_host_name="$(echo "$SSH_CONNECTION" | get_cols 1)"
|
2014-08-25 20:10:05 -06:00
|
|
|
OPTIND=1
|
2014-08-21 13:43:55 -06:00
|
|
|
while getopts "h:" OPTCHAR; do
|
|
|
|
case $OPTCHAR in
|
|
|
|
h)
|
|
|
|
new_host_name="$OPTARG";
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2016-08-15 12:53:29 -06:00
|
|
|
test -z "$(synergy_pids_for_ip "$new_host_name")" && synergyc "$new_host_name"
|
2014-08-21 13:43:55 -06:00
|
|
|
}
|
|
|
|
|
2016-08-15 12:53:29 -06:00
|
|
|
synergy_stop_at() {
|
2014-08-23 18:00:27 -06:00
|
|
|
pgrep synergys | xargs kill -9
|
2016-08-16 12:19:10 -06:00
|
|
|
ssh "$1" "synergy_kill_all_local"
|
2014-08-21 13:43:55 -06:00
|
|
|
}
|
|
|
|
|
2016-08-15 12:53:29 -06:00
|
|
|
synergy_kill_all_local() {
|
2014-08-23 18:00:27 -06:00
|
|
|
pgrep synergy | xargs kill -9
|
2014-08-21 13:43:55 -06:00
|
|
|
}
|
|
|
|
|
2016-08-15 12:53:29 -06:00
|
|
|
synergy_clear_ssh_synergy() {
|
|
|
|
synergy_clear_for_ip "$(echo "$SSH_CONNECTION" | get_cols 1)"
|
2014-08-21 13:43:55 -06:00
|
|
|
}
|
|
|
|
|
2016-08-15 12:53:29 -06:00
|
|
|
synergy_clear_for_ip() {
|
|
|
|
synergy_pids_for_ip "$1" | xargs kill -9
|
2014-08-21 13:43:55 -06:00
|
|
|
}
|
|
|
|
|
2016-08-15 12:53:29 -06:00
|
|
|
synergy_pids_for_ip() {
|
|
|
|
pgrep synergyc | grep "$1" | get_cols 2
|
2014-08-21 13:43:55 -06:00
|
|
|
}
|