# Use unsupported display resolutions with Samsung DeX > [!note] > The options below are known to work on Android 14 / Samsung One UI 6. [Samsung DeX](https://www.samsung.com/us/apps/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](https://galaxystore.samsung.com/detail/com.samsung.android.goodlock), that unlocks a number of customizations for Samsung's version of Android. The [MultiStar](https://galaxystore.samsung.com/detail/com.samsung.android.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 x 1400 resolution used by the [Lenovo ThinkVision M14d](https://www.lenovo.com/us/en/p/accessories-and-software/monitors/office/63aauar6us)). The Android Debugging Bridge (adb) utility can be used in *many* of these cases. ### Initial setup 1. Install [F-Droid](https://f-droid.org). 2. Install [Termux](https://f-droid.org/en/packages/com.termux/). 3. Install adb: `pkg install android-tools` 4. Enable wireless debugging by turning on **Developer options > Wireless debugging**. 5. 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!) 6. Pair adb in Termux with the phone: `adb pair localhost:$PAIRING_PORT`. ### Setting a custom resolution 1. 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". 2. Connect adb: `adb connect localhost:$DEBUGGING_PORT` 3. Use adb to set the resolution of your external display: `adb shell wm size 2240x1400 -d 2` 4. Disconnect adb: `adb disconnect` 5. 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 1. Turn on **Developer options > Quick settings developer tiles > Wireless debugging**. This will enable you to quickly turn wireless debugging on and off. 2. Install Termux, `android-tools`, and then pair (your local) adb with your (local) device using the steps described above in "Initial setup". 3. Grant Termux permission to read the Android system logs: `adb shell pm grant com.termux android.permission.READ_LOGS` 4. Reboot your device. #### Switcher script > [!note] > Adapted from [Set max resolution for external displays](https://taskernet.com/shares/?user=AS35m8leEITiG8ZaeErHEf3Th8J%2B1tZDZGTqWSk3ywlZ6o66qQY36y%2FzpquyCVhbqHx5nFvm1A%3D%3D&id=Project%3ASet+max+resolution+for+external+display) [Tasker](https://tasker.joaoapps.com) task. ```bash #!/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!