[root tip] [Utility Script] FreeRDP script template

A couple of months ago I ran into issues with the krdc app and got so frustrated I created a script template to handle my connections thus limiting my dependency to freerdp.

The template handles if session is wayland or x11

#!/usr/bin/env bash
#
# Script template to open FreeRDP connection
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <https://www.gnu.org/licenses/>.
#
# root.nix.dk
# - 2022-11-23 : moved width and height to variables section

# https://github.com/FreeRDP/FreeRDP/wiki/CommandLineInterface

REMOTE=""
USERNAME=""
PASSWORD=""
NETWORK="lan"         # connection type
PORT="3389"           # rdp default
SHARE="media"
SHAREPATH="/home/$USER"
# to list available keyboards run 'xfreerdp /kbd-list'
KEYBOARD="0x00000406" # danish keyboard layout
WIDTH=1920
HEIGHT=1080

if [[ ${XDG_SESSION_TYPE} = "wayland" ]]; then
        /usr/bin/wlfreerdp /bpp:24 /audio-mode:2 /sound:sys:alsa /rfx /cert-ignore +clipboard -decorations /parent-window:31 \ 
        /w:${WIDTH} /h:${HEIGHT} \
        /kbd:${KEYBOARD} \
        /network:${NETWORK} \
        /drive:${SHARE},${SHAREPATH} \
        /u:${USERNAME} /port:${PORT} /v:${REMOTE} /p:${PASSWORD} &
else
        /usr/bin/xfreerdp /bpp:24 /audio-mode:2 /sound:sys:alsa /rfx /cert-ignore +clipboard \
        /w:${WIDTH} /h:${HEIGHT} \
        /kbd:${KEYBOARD} \
        /network:${NETWORK} \
        /drive:{SHARE},${SHAREPATH} \
        /u:${USERNAME} /port:${PORT} /v:${REMOTE} /p:${PASSWORD} &
fi

Source: FreeRDP script template | root.nix.dk