Propagate configured RDP port to app launches

Signed-off-by: nindanaoto <matsuoka.kotaro@gmail.com>
This commit is contained in:
nindanaoto
2026-05-10 15:59:53 +09:00
parent bc8b785676
commit 03cf7f6fbd
5 changed files with 25 additions and 12 deletions
+10 -3
View File
@@ -418,6 +418,13 @@ RDP_DOMAIN=""
# - 'libvirt': '' (BLANK)
RDP_IP="127.0.0.1"
# [RDP PORT]
# NOTES:
# - For Docker and Podman, this is the host port mapped to Windows port 3389.
# - If you changed the host-side RDP port in compose.yaml, set this to match.
# DEFAULT VALUE: '3389'
RDP_PORT="3389"
# [VM NAME]
# NOTES:
# - Only applicable when using 'libvirt'
@@ -576,13 +583,13 @@ HIDEF="on"
1. Test establishing an RDP session by running the following command, replacing the `/u:`, `/p:`, and `/v:` values with the correct values specified in `~/.config/winapps/winapps.conf`.
```bash
xfreerdp3 /u:"MyWindowsUser" /p:"MyWindowsPassword" /v:127.0.0.1 /cert:tofu
xfreerdp3 /u:"MyWindowsUser" /p:"MyWindowsPassword" /v:127.0.0.1:3389 /cert:tofu
# Or, if you are using Podman
podman unshare --rootless-netns xfreerdp3 /u:"MyWindowsUser" /p:"MyWindowsPassword" /v:127.0.0.1 /cert:tofu
podman unshare --rootless-netns xfreerdp3 /u:"MyWindowsUser" /p:"MyWindowsPassword" /v:127.0.0.1:3389 /cert:tofu
# Or, if you installed FreeRDP using Flatpak
flatpak run --command=xfreerdp com.freerdp.FreeRDP /u:"MyWindowsUser" /p:"MyWindowsPassword" /v:127.0.0.1 /cert:tofu
flatpak run --command=xfreerdp com.freerdp.FreeRDP /u:"MyWindowsUser" /p:"MyWindowsPassword" /v:127.0.0.1:3389 /cert:tofu
```
- Please note that the correct `FreeRDP` command may vary depending on your system (e.g. `xfreerdp`, `xfreerdp3`, etc.).
+7 -5
View File
@@ -32,7 +32,7 @@ readonly SLEEP_MARKER="${APPDATA_PATH}/sleep_marker"
# OTHER
readonly CONTAINER_NAME="WinApps" # FOR 'docker' AND 'podman' ONLY
readonly RDP_PORT=3389
RDP_PORT=3389
readonly DOCKER_IP="127.0.0.1"
# shellcheck disable=SC2155 # Silence warnings regarding masking return values through simultaneous declaration and assignment.
readonly RUNID="${RANDOM}"
@@ -371,6 +371,8 @@ function waLoadConfig() {
waThrowExit $EC_MISSING_CONFIG
fi
RDP_PORT="${RDP_PORT:-3389}"
# Update $RDP_SCALE.
waFixScale
# Update when $REMOVABLE_MEDIA is null
@@ -787,7 +789,7 @@ function waRunCommand() {
+dynamic-resolution \
/wm-class:"Microsoft Windows" \
/t:"Windows RDP Session [$RDP_IP]" \
/v:"$RDP_IP" &>/dev/null &
/v:"$RDP_IP":"$RDP_PORT" &>/dev/null &
# Capture the process ID.
FREERDP_PID=$!
@@ -803,7 +805,7 @@ function waRunCommand() {
/scale:"$RDP_SCALE" \
+auto-reconnect \
/app:program:"$2",hidef:"$HIDEF" \
/v:"$RDP_IP" &>/dev/null &
/v:"$RDP_IP":"$RDP_PORT" &>/dev/null &
# Capture the process ID.
FREERDP_PID=$!
@@ -838,7 +840,7 @@ function waRunCommand() {
+auto-reconnect \
/wm-class:"$FULL_NAME" \
/app:program:"$WIN_EXECUTABLE",hidef:"$HIDEF",icon:"$ICON",name:"$FULL_NAME" \
/v:"$RDP_IP" &>/dev/null &
/v:"$RDP_IP":"$RDP_PORT" &>/dev/null &
# Capture the process ID.
FREERDP_PID=$!
@@ -862,7 +864,7 @@ function waRunCommand() {
/drive:media,"$REMOVABLE_MEDIA" \
/wm-class:"$FULL_NAME" \
/app:program:"$WIN_EXECUTABLE",hidef:"$HIDEF",icon:"$ICON",name:"$FULL_NAME",cmd:\""$FILE_PATH"\" \
/v:"$RDP_IP" &>/dev/null &
/v:"$RDP_IP":"$RDP_PORT" &>/dev/null &
# Capture the process ID.
FREERDP_PID=$!
+2
View File
@@ -53,6 +53,7 @@ docker compose --file ~/.config/winapps/compose.yaml down
# Remove the existing FreeRDP certificate (if required).
# Note: A new certificate will be created when connecting via RDP for the first time.
# If you configured a custom RDP_PORT, replace 3389 with that port.
rm ~/.config/freerdp/server/127.0.0.1_3389.pem
# Re-create the container with the updated configuration.
@@ -105,6 +106,7 @@ podman-compose --file ~/.config/winapps/compose.yaml down
# Remove the existing FreeRDP certificate (if required).
# Note: A new certificate will be created when connecting via RDP for the first time.
# If you configured a custom RDP_PORT, replace 3389 with that port.
rm ~/.config/freerdp/server/127.0.0.1_3389.pem
# Re-create the container with the updated configuration.
+1 -1
View File
@@ -21,7 +21,7 @@ index 3a871c8..71a8fa0 100755
+readonly INQUIRER_PATH="@out@/src/install/inquirer.sh" # UNIX path to the 'inquirer' script, which is used to produce selection menus.
# REMOTE DESKTOP CONFIGURATION
readonly RDP_PORT=3389 # Port used for RDP on Windows.
RDP_PORT=3389 # Port used for RDP on Windows.
@@ -157,13 +157,6 @@ function waGetSourceCode() {
echo -e "${WARNING_TEXT}[WARNING]${CLEAR_TEXT} You might want to remove your old installation on '${SCRIPT_DIR_PATH}'."
fi
+5 -3
View File
@@ -73,7 +73,7 @@ readonly CONFIG_PATH="${HOME}/.config/winapps/winapps.conf" # UNIX path to the W
readonly INQUIRER_PATH="./install/inquirer.sh" # UNIX path to the 'inquirer' script, which is used to produce selection menus.
# REMOTE DESKTOP CONFIGURATION
readonly RDP_PORT=3389 # Port used for RDP on Windows.
RDP_PORT=3389 # Port used for RDP on Windows.
readonly DOCKER_IP="127.0.0.1" # Localhost.
### GLOBAL VARIABLES ###
@@ -562,6 +562,8 @@ function waLoadConfig() {
# shellcheck source=/dev/null # Exclude this file from being checked by ShellCheck.
source "$CONFIG_PATH"
RDP_PORT="${RDP_PORT:-3389}"
# Send password on the command line if a command to retrieve the password from is not given
# Otherwise, set FREERDP_ASKPASS which freerdp will read the stdout of to use as the password
RDP_PASSWORD_ARG="/p:$RDP_PASS"
@@ -1132,7 +1134,7 @@ function waCheckRDPAccess() {
+auto-reconnect \
+home-drive \
/app:program:"C:\Windows\System32\cmd.exe",cmd:"/C type NUL > $TEST_PATH_WIN && tsdiscon" \
/v:"$RDP_IP" &>"$FREERDP_LOG" &
/v:"$RDP_IP":"$RDP_PORT" &>"$FREERDP_LOG" &
# Store the FreeRDP process ID.
FREERDP_PROC=$!
@@ -1265,7 +1267,7 @@ function waFindInstalled() {
+auto-reconnect \
+home-drive \
/app:program:"C:\Windows\System32\cmd.exe",cmd:"/C "$BATCH_SCRIPT_PATH_WIN"" \
/v:"$RDP_IP" &>"$FREERDP_LOG" &
/v:"$RDP_IP":"$RDP_PORT" &>"$FREERDP_LOG" &
# Store the FreeRDP process ID.
FREERDP_PROC=$!