#!/bin/bash
#
# Usage: startremmina.sh <password>
#
# Version 1.0  1.6.2024
#
# folgende Option ggf. auskommentieren und anpassen
# $deskoption="--desktop 0"

/usr/bin/remmina -c $HOME/.maussk.remmina &
sleep 1
winid=$(xdotool $deskoption search --name 'Verbindung zu')
if [ -z "$winid" ]; then
  sleep 1
  winid=$(xdotool $deskoption search --name 'Client-')
fi
if [ -z "$winid" ]; then
  sleep 1
  winid=$(xdotool $deskoption search --name 'Client-')
fi
/usr/bin/xdotool windowactivate --sync $winid type $1
/usr/bin/xdotool windowactivate --sync $winid key Return

exit 0
