Moblin Applets: Screen Resolution

Snapshot

Overview

The screen resolution applet is designed to allow the user to change the resolution or rotation of the display. At this time there are only two resolutions supported by moblin: 1024x600 and 800x480. Even if the display hardware supports other resolutions they will not be made available in the dialog because MID is expected to have a widescreen form factor with only these two resolutions optimized. The display can also be inverted (i.e. rotated 180 degrees) or normal.

Files Needed

  • /usr/lib/moblin-applets/libhcpcommon.so
    • all control panel applets need this
  • /usr/lib/hildon-control-panel/screen-resolution.so
    • The applet library
  • /usr/share/applications/hildon-control-panel/screen-resolution.desktop
  • /usr/bin/moblin-settings-daemon
    • Automatically reads the gconf settings and sets the resolution and rotation on GUI startup
  • /usr/share/gconf/schemas/desktop_moblin_screen.schemas
    • Default settings for the resolutions key (what resolutions are supported)

Applet Design



The GUI is a simple dialog which has two interactive combo boxes and close and apply buttons. The screen resolution/rotation is read and changed via the XrandR functions, specifically XRRConfigCurrentConfiguration. The new settings are applied and a timeout is used which will revert the settings back if the user doesn't confirm the changes. This is to prevent unusable settings from becoming permanent.

Gconf Settings

There are three keys used by the screen resolution applet:

/desktop/moblin/screen/resolutions = "1024x600,800x480"
/desktop/moblin/screen/default/0/resolution = "1024x600"
/desktop/moblin/screen/default/0/rotation = "normal"

The first, resolutions, is a string which contains a comma separated list of resolutions that the applet should filter for. By default this is set to "1024x600,800x480". But other resolutions can be added by editting the key via gconftool-2 or gconf-editor, or more formally with the moblin-applets schema file desktop_moblin_screen.schemas. If this key is blank the applet will not filter at all and will list all resolutions supported by the hardware.

The second and third keys are the default resolutions for display 0. This is a remnant of the desktop environment where settings could be made for multiple displays and for specific users rather than the global default. However in moblin, there is only one display with a single user, thus default/0 will likely always be the only key in there. The resolutions key has the current resolutions in it as widthxheight and the rotation can be normal, left, right, or inverted. The GUI only allows normal and inverted, but by setting this key you can override it.

Tips and Tricks

How can I bypass the filter and use all the resolutions the system supports?

Open a terminal session on the device as user "ume" with one of the following methods:

  • Shortcut key: shift-ctrl-t (default buttons applet setting)
  • Click the shortcut at: Accessories->Terminal
  • ssh to the device over the network: ssh -l ume devicename_or_ip
Now run this in the terminal window:
gconftool-2 --type "string" --set "/desktop/moblin/screen/resolutions" ""

Now close the terminal and relaunch the screen resolution applet and it should display all the resolutions the system supports.

I accidentally set an unusable resolution and can't use the GUI, how can I restore?

You can change the gconf keys which store the resolution and rotation, then reboot the system system so that they take effect. This can be useful if you've accidentally set the resolution to something unusable where you can't launch the applets anymore.

Open a terminal session on the device as user "ume" with one of the following methods:

  • Shortcut key: shift-ctrl-t (it may not be completely visible but you can still type into it)
  • ssh to the device over the network: ssh -l ume devicename_or_ip
Now run this in the terminal window:
gconftool-2 --type "string" --set "/desktop/moblin/screen/default/0/resolution" "1024x600"
gconftool-2 --type "string" --set "/desktop/moblin/screen/default/0/rotation" "normal"

Now reboot the system and the GUI should come back up with the normal settings. The /desktop/moblin/screen/resolutions filter was added precisely for preventing this situation, because display hardware can sometimes support settings that the device can't handle.

Code Reuse

This applet is based on gnome-control-center's Display applet.