Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the RDP_SCALE value as scale-desktop, and then approximate scale-device #216

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ RDP_PASS="MyWindowsPassword"
#RDP_DOMAIN="MYDOMAIN"
#RDP_IP="192.168.123.111"
#RDP_SCALE=100
#RDP_DEVICE_SCALE=100 # can only be 100|140|180
#RDP_FLAGS=""
#MULTIMON="true"
#DEBUG="true"
Expand All @@ -113,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`
Expand Down
22 changes: 17 additions & 5 deletions bin/winapps
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,25 @@ 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"
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"
Expand Down Expand Up @@ -73,13 +85,13 @@ if [ "${MULTIMON}" = "true" ]; then
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
Expand All @@ -99,9 +111,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

Expand Down