From e6e45c0b0dff6002e44d5b700ee4059fe8b3636a Mon Sep 17 00:00:00 2001 From: Adil Date: Wed, 5 May 2021 17:45:52 +0100 Subject: [PATCH 1/5] Use the RDP_SCALE value as scale-desktop, and then approximated scale-device xfreerdp only supports a scale/scale-device of 100|140|180, but allows any scale-desktop, as shown in this man page: /scale:[100|140|180] Scaling factor of the display (default:100) /scale-desktop:percentage Scaling factor for desktop applications (value between 100 and 500) (default:100) /scale-device:100|140|180 Scaling factor for app store applications (default:100) --- bin/winapps | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/bin/winapps b/bin/winapps index 6cedf12..7f3c9ab 100755 --- a/bin/winapps +++ b/bin/winapps @@ -72,14 +72,23 @@ if [ "${MULTIMON}" = "true" ]; then MULTI_FLAG="multimon" fi +# scale-device (or scale) can only be 100|140|180 +if (( RDP_SCALE < 120 )); then + RDP_DEVICE_SCALE=100 +elif (( RDP_SCALE > 160)); then + RDP_DEVICE_SCALE=180 +else + RDP_DEVICE_SCALE=140 +fi + if [ "${1}" = "windows" ]; then - xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} /scale:${RDP_SCALE} /dynamic-resolution +clipboard +auto-reconnect +home-drive /wm-class:"Microsoft Windows" 1> /dev/null 2>&1 & + xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} /scale-device:${RDP_DEVICE_SCALE} /scale-desktop:${RDP_SCALE} /dynamic-resolution +clipboard +auto-reconnect +home-drive /wm-class:"Microsoft Windows" 1> /dev/null 2>&1 & elif [ "${1}" = "check" ]; then dprint "CHECK" - xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +clipboard +home-drive -wallpaper /scale:${RDP_SCALE} /dynamic-resolution /${MULTI_FLAG} /app:"explorer.exe" + xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +clipboard +home-drive -wallpaper /scale-device:${RDP_DEVICE_SCALE} /scale-desktop:${RDP_SCALE} /dynamic-resolution /${MULTI_FLAG} /app:"explorer.exe" elif [ "${1}" = "manual" ]; then dprint "MANUAL:${2}" - xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +home-drive +clipboard -wallpaper /scale:${RDP_SCALE} /dynamic-resolution /${MULTI_FLAG} /app:"${2}" 1> /dev/null 2>&1 & + xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +home-drive +clipboard -wallpaper /scale-device:${RDP_DEVICE_SCALE} /scale-desktop:${RDP_SCALE} /dynamic-resolution /${MULTI_FLAG} /app:"${2}" 1> /dev/null 2>&1 & elif [ "${1}" != "install" ]; then dprint "DIR:${DIR}" if [ -e "${DIR}/../apps/${1}/info" ]; then @@ -99,9 +108,9 @@ elif [ "${1}" != "install" ]; then dprint "HOME:${HOME}" FILE=$(echo "${2}" | sed 's|'"${HOME}"'|\\\\tsclient\\home|;s|/|\\|g;s|\\|\\\\|g') dprint "FILE:${FILE}" - xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +clipboard +home-drive -wallpaper /scale:${RDP_SCALE} /dynamic-resolution /${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:"${WIN_EXECUTABLE}" /app-icon:"${ICON}" /app-cmd:"\"${FILE}\"" 1> /dev/null 2>&1 & + xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +clipboard +home-drive -wallpaper /scale-device:${RDP_DEVICE_SCALE} /scale-desktop:${RDP_SCALE} /dynamic-resolution /${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:"${WIN_EXECUTABLE}" /app-icon:"${ICON}" /app-cmd:"\"${FILE}\"" 1> /dev/null 2>&1 & else - xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +clipboard +home-drive -wallpaper /scale:${RDP_SCALE} /dynamic-resolution /${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:"${WIN_EXECUTABLE}" /app-icon:"${ICON}" 1> /dev/null 2>&1 & + xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +clipboard +home-drive -wallpaper /scale-device:${RDP_DEVICE_SCALE} /scale-desktop:${RDP_SCALE}} /dynamic-resolution /${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:"${WIN_EXECUTABLE}" /app-icon:"${ICON}" 1> /dev/null 2>&1 & fi fi From aa778ad151fb10ec79aaec9357c2f47641091774 Mon Sep 17 00:00:00 2001 From: Adil Date: Sat, 8 May 2021 20:30:26 +0100 Subject: [PATCH 2/5] User can configure the RDP_DEVICE_SCALE in their winapps.conf --- README.md | 1 + bin/winapps | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index cdef984..8d65e88 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,7 @@ RDP_PASS="MyWindowsPassword" #RDP_DOMAIN="MYDOMAIN" #RDP_IP="192.168.123.111" #RDP_SCALE=100 +#RDP_SCALE=100 # can only be 100|140|180 #RDP_FLAGS="" #MULTIMON="true" #DEBUG="true" diff --git a/bin/winapps b/bin/winapps index 7f3c9ab..bbe5b90 100755 --- a/bin/winapps +++ b/bin/winapps @@ -13,6 +13,7 @@ if [ ! -d "${HOME}/.local/share/winapps" ]; then fi RDP_SCALE=100 +RDP_DEVICE_SCALE=0 if [ -f "${HOME}/.config/winapps/winapps.conf" ]; then . "${HOME}/.config/winapps/winapps.conf" @@ -20,6 +21,17 @@ else . "${HOME}/.winapps" fi +if (( RDP_DEVICE_SCALE < 100 )); then + # scale-device (or scale) can only be 100|140|180 + if (( RDP_SCALE < 120 )); then + RDP_DEVICE_SCALE=100 + elif (( RDP_SCALE > 160)); then + RDP_DEVICE_SCALE=180 + else + RDP_DEVICE_SCALE=140 + fi +fi + function dprint() { if [ "${DEBUG}" = "true" ]; then echo "[${RUN}] ${1}" >> "${HOME}/.local/share/winapps/winapps.log" @@ -72,15 +84,6 @@ if [ "${MULTIMON}" = "true" ]; then MULTI_FLAG="multimon" fi -# scale-device (or scale) can only be 100|140|180 -if (( RDP_SCALE < 120 )); then - RDP_DEVICE_SCALE=100 -elif (( RDP_SCALE > 160)); then - RDP_DEVICE_SCALE=180 -else - RDP_DEVICE_SCALE=140 -fi - if [ "${1}" = "windows" ]; then xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} /scale-device:${RDP_DEVICE_SCALE} /scale-desktop:${RDP_SCALE} /dynamic-resolution +clipboard +auto-reconnect +home-drive /wm-class:"Microsoft Windows" 1> /dev/null 2>&1 & elif [ "${1}" = "check" ]; then From c5708b4c3717ab75b640f4a25ad40d1f56947f60 Mon Sep 17 00:00:00 2001 From: Adil Date: Sat, 8 May 2021 20:43:55 +0100 Subject: [PATCH 3/5] Forgot to add RDP_DEVICE_SCALE to the README, oops! --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8d65e88..66489e3 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ RDP_PASS="MyWindowsPassword" #RDP_DOMAIN="MYDOMAIN" #RDP_IP="192.168.123.111" #RDP_SCALE=100 -#RDP_SCALE=100 # can only be 100|140|180 +#RDP_DEVICE_SCALE=100 # can only be 100|140|180 #RDP_FLAGS="" #MULTIMON="true" #DEBUG="true" From 9b4d5e6538e60e093167a7c2a799e58d1f24e4b8 Mon Sep 17 00:00:00 2001 From: Adil Date: Sun, 9 May 2021 16:00:30 +0100 Subject: [PATCH 4/5] Update README to say what RDP_DEVICE_SCALE is --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 66489e3..440306f 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ Options: - When using a pre-existing non-KVM RDP server, you can use the `RDP_IP` to specify it's location - If you are running a VM in KVM with NAT enabled, leave `RDP_IP` commented out and WinApps will auto-detect the right local IP - For domain users, you can uncomment and change `RDP_DOMAIN` -- On high-resolution (UHD) displays, you can set `RDP_SCALE` to the scale you would like [100|140|160|180] +- On high-resolution (UHD) displays, you can set `RDP_SCALE` to the scale you would like. `RDP_DEVICE_SCALE` is automatically set depending on your `RDP_SCALE`, but you can manually specify one of [100|140|180] if you wish. - To add flags to the FreeRDP call, such as `/audio-mode:1` to pass in a mic, use the `RDP_FLAGS` configuration option - For multi-monitor setups, you can try enabling `MULTIMON`, however if you get a black screen (FreeRDP bug) you will need to revert back - If you enable `DEBUG`, a log will be created on each application start in `~/.local/share/winapps/winapps.log` From eae6f329af1a5139dfdab26d26e3bb0943774217 Mon Sep 17 00:00:00 2001 From: Adil Hanney Date: Mon, 24 May 2021 21:19:09 +0100 Subject: [PATCH 5/5] Removed extra bracket --- bin/winapps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/winapps b/bin/winapps index bbe5b90..5cb0ff3 100755 --- a/bin/winapps +++ b/bin/winapps @@ -113,7 +113,7 @@ elif [ "${1}" != "install" ]; then dprint "FILE:${FILE}" xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +clipboard +home-drive -wallpaper /scale-device:${RDP_DEVICE_SCALE} /scale-desktop:${RDP_SCALE} /dynamic-resolution /${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:"${WIN_EXECUTABLE}" /app-icon:"${ICON}" /app-cmd:"\"${FILE}\"" 1> /dev/null 2>&1 & else - xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +clipboard +home-drive -wallpaper /scale-device:${RDP_DEVICE_SCALE} /scale-desktop:${RDP_SCALE}} /dynamic-resolution /${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:"${WIN_EXECUTABLE}" /app-icon:"${ICON}" 1> /dev/null 2>&1 & + xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +clipboard +home-drive -wallpaper /scale-device:${RDP_DEVICE_SCALE} /scale-desktop:${RDP_SCALE} /dynamic-resolution /${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:"${WIN_EXECUTABLE}" /app-icon:"${ICON}" 1> /dev/null 2>&1 & fi fi