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