Note
The options below are known to work on Android 14 / Samsung One UI 6.
Samsung DeX (the desktop mode available on higher-end Samsun Android smartphones) can be used with a limited number of (fairly standard) resolutions out-of-the-box. It is possible to use DeX with other resolutions however.
Good Lock
Samsung provides a application, Good Lock, that unlocks a number of customizations for Samsung’s version of Android. The MultiStar plugin can be used to enable additional display resolutions under DeX by turning on I ❤️ Samsun DeX → High resolutions for external displays.
ADB
The resolutions unlocked by Good Lock will work on the vast majority of modern display. However, occasionally you may want to use a monitor with an “oddball” resolution (like the 2240 × 1400 resolution used by the Lenovo ThinkVision M14d). The Android Debugging Bridge (adb) utility can be used in many of these cases.
Initial setup
- Install F-Droid.
- Install Termux.
- Install adb:
pkg install android-tools
- Enable wireless debugging by turning on Developer options → Wireless debugging.
- Select “Pair device with pairing code”. Note down the pairing code and port displayed in the resulting pop-up. (Note that this port is different than the debugging port!)
- Pair adb in Termux with the phone:
adb pair localhost:$PAIRING_PORT
.
Setting a custom resolution
- Enable wireless debugging (if it’s not already enabled from the previous section) by turning on Developer options → Wireless debugging. Note down the port displayed under “IP address & Port”.
- Connect adb:
adb connect localhost:$DEBUGGING_PORT
- Use adb to set the resolution of your external display:
adb shell wm size 2240x1400 -d 2
- Disconnect adb:
adb disconnect
- Disabled wireless debugging.
Tip
In general, the Android phone itself will use display 0. To determine the number of the external display, you can output the current resolution of a display using
adb shell wm size -d #
, where#
is 0, 1, 2, …
Warning
The display resolution set with
adb shell wm size
will stick until either a new display resolution is set using adb,adb shell wm size reset -d2
(or whatever the correct display number) is run, or until a new resolution is manually chosen in the Settings app under Samsun DeX → Display resolution.
Automatic resolution switcher script
The script below should (perhaps with minor modifications) automatically set DeX’s resolution to the optimal one for your external monitor.
Prerequisites
- Turn on Developer options → Quick settings developer tiles → Wireless debugging. This will enable you to quickly turn wireless debugging on and off.
- Install Termux,
android-tools
, and then pair (your local) adb with your (local) device using the steps described above in “Initial setup”. - Grant Termux permission to read the Android system logs:
adb shell pm grant com.termux android.permission.READ_LOGS
- Reboot your device.
Switcher script
Note
Adapted from Set max resolution for external displays Tasker task.
#!/usr/bin/env bash
DISPLAY_NAME="HDMI Screen"
DISPLAY_NUMBER=2
# Exit on error
set -e
# Get local adb port
PORT=$(logcat -d | grep 'adbwifi' | tail -n 1 | sed 's/.* //')
# Locally connect to the wireless debugging port
adb connect localhost:$PORT
# Get the connected display's highest resolution
DISPLAY_RESOLUTION="$(adb shell dumpsys display | grep -m 1 "$DISPLAY_NAME" | awk -F' |=' '/width/ && /height/ {for(i=1;i<=NF;i++) if($i=="width") print $(i+1) "x" $(i+3)}' | tr -d ',' | sort -nr -k1,1 -k2,2 | head -n 1)"
# Set the resolution for DeX
adb shell wm size $DISPLAY_RESOLUTION -d $DISPLAY_NUMBER
# Disconnect adb
adb disconnect
# Notify the user
MESSAGE="$DISPLAY_NAME ($DISPLAY_NUMBER) set to $DISPLAY_RESOLUTION"
if [[ $(which termux-notification | wc -l) -gt 0 ]]; then
termux-notification --icon monitor --title "Samsung DeX" --content "$MESSAGE"
fi
echo "$MESSAGE"
Note
This will (often) generate a popup asking you to confirm log access when run.
Important
There is unfortunately no way to enable local adb in non-rooted devices without a WiFi connection.
Warning
On-screen text will sometimes look terrible after switching resolutions for some combinations of cables/monitors, even when the same device/cable/monitor works fine on a different combination!