1
0
Fork 0
forked from ahurac/dotfiles
ahuarc-dotfiles/bin/vncsconnect

40 lines
638 B
Text
Raw Normal View History

2023-04-13 00:04:20 +02:00
#!/bin/bash
# Variables
declare -a ssh_args
2023-04-13 00:04:20 +02:00
# Sélectionner le viewer adapté à la session
if [ -n "$WAYLAND_DISPLAY" ]; then
vncviewer=wlvncc
else
vncviewer=vncviewer
separator=:
fi
2023-04-13 00:04:20 +02:00
# Arguments
while [ -n "$1" ]; do
case "$1" in
--)
shift
break
;;
*)
ssh_args+=("$1")
shift
;;
esac
done
2023-04-13 00:04:20 +02:00
# Initialiser les arguments du viewer
args=(localhost "${ssh_args[1]}")
if [ -n "$separator" ]; then
args=("${args[*]// /${separator}/}")
fi
2023-04-13 00:04:20 +02:00
# Exécution
set -e
ssh-fwd "${ssh_args[@]}" -- "$@"
exec "$vncviewer" \
"${args[@]}"
2023-04-13 00:04:20 +02:00