[Nexus 10 Q&A, Help & Troubleshooting] 3DSammy:
NOTE: This script now works with both Android 4.2.2 and 4.3 (Aug 12th, 2013). Also as of Aug 11th SManager v2.8.3 has been updated to support Android 4.3

the_boo discover how to set/reset the Nexus 10 screen resolution from the command line. Attached is a script to toggle to a resolution setting of your choice. This worked well when connected to my Samsung PN58C8000 HDTV with screen set for 16:9. Playing videos with MX Player had no side bars at all on the HDTV. This setting is global and not app specific.

Although not required, use Script Manager-SManager(NoAds) and a SMWidgets desktop widget, as a shortcut to the script, set the widget to execute in the back ground. Running the script in the background is visually much nicer as a terminal console is not required or seen during execution.

Issues:

1) Sometimes the resolution can only be changed BEFORE the HDMI cable is attached.

2) Once the N10 froze with a blank screen at full brightness. Had to hard power cycle. Never had that happen before.

3) If for any reason the Nexus 10 is rebooted before the display is reset back to normal, the resolution will persist through the reboot. The script can still be used to toggle back or the reset command can be run in a terminal session "am display-size reset".

4) Root permissions are required so any terminal session must already be in root or you need to add a leading 'su root' before the rest of the command. Example:

> su root sh "/path to the script/hdmi_toggle.sh" "/sdcard/hdmi_toggle" 1920x1080 288

"hdmi_toggle.sh" script:

#!/system/bin/sh
#
# Script: hdmi_toggle.sh
#
# NOTE: This script requires root permissions!
#
# Purpose: Toggle the display resolution to reset or match a specific HDMI
# display target. Script dynamically detects the android version
# and adjusts the screen commands to match the ROM.
#
# This script requires two or three command line arguments:
# 1) The path on internal storage where the HDMI display toggle state
# is stored.
# 2) The display resolution. Additional resolutions are possible.
# HDTV: 1920x1080
# PC Monitor: 2560x1440
# 3) For Andorid 4.3+ only, add a density value to make the icons display properly
# HDTV: 1920x1080 with density 288 or smaller
# PC Monitor: 2560x1440 with density less than 288
# NOTE: 288 is the default value if no denisty argument is specified
#
#
# Example Android 4.2.x command usage:
# > sh "/path to the script/hdmi_toggle.sh" "/sdcard/hdmi_toggle" 1920x1080
#
# Example Android 4.3+ command usage:
# > sh "/path to the script/hdmi_toggle.sh" "/sdcard/hdmi_toggle" 1920x1080 288
#
# NOTE: The path to the HDMI toggle directory must already exist and have
# read/write permissions.
#
## The commands to be executed depend on which version of Android is
## installed.
version_43 () {
if [ "$CURRENT_STATE" == "ON" ]; then
# Reset display state
echo "Reset display"
wm size reset
wm density reset
echo "OFF" > "$TOGGLE_FILE"
else
# Set display state
echo "Set display resolution to $RESOLUTION and density $DENSITY"
wm size $RESOLUTION
wm density $DENSITY
echo "ON" > "$TOGGLE_FILE"
fi
}
#
version_42 () {
if [ "$CURRENT_STATE" == "ON" ]; then
# Reset display state
echo "Reset display"
am display-size reset
echo "OFF" > "$TOGGLE_FILE"
else
# Set display state
echo "Set display resolution to $RESOLUTION"
am display-size $RESOLUTION
echo "ON" > "$TOGGLE_FILE"
fi
}
#
TOGGLE_PATH=$1
TOGGLE_FILE="$1/hdmi_state.txt"
#
# NOTE: Resolution values are not validated.
RESOLUTION=$2
#
DENSITY=$3
# Set a default desnsity if there was none specified
if [ "$DENSITY" == "" ]; then
DENSITY="288"
fi
#
# Test that the toggle state path exists and has read/write permissions
if [ ! -d "$TOGGLE_PATH" ]; then
echo "The toggle directory '$TOGGLE_PATH' must exist."
exit 1
# Make sure the toggle path directory has read/write permissions
elif [ ! -r "$TOGGLE_PATH" ] || [ ! -w "$TOGGLE_PATH" ]; then
echo "The toggle directory '$TOGGLE_PATH' must have read/write permissions."
exit 1
fi
#
# Automatically set the toggle state to OFF if the toggle file does not exist
if [ ! -f "$TOGGLE_FILE" ]; then
echo "OFF" > "$TOGGLE_FILE"
fi
#
# Set the display to the specified resolution or reset
CURRENT_STATE=$(cat $TOGGLE_FILE)
#
echo "current_state ($CURRENT_STATE)"
#
# Detect the Android version
VERSION=$(getprop ro.build.version.release)
#
# Set or reset the screen resolution
if [ ${VERSION:0:3} = "4.3" ]; then
version_43
else
version_42
fi
#
exit 0

Here are the "before resolution change" and "after resolution change" Nexus 10 screen shots. The SManager widget is circled in red in the before picture. The widget toggle icon is really for the "Samsung Remote" app but using Desktop VisualizeR it can be set to any image file or icon.

Adding the script as a SManager desktop widget instructions