Display Configuration for mir-kiosk

Continuing the work on display configuration I described last week this is how I envisage it working for mir-kiosk. This functionality is on Mir “master” and available with the mir-kiosk “edge” channel. Note that this functionality has not been released yet (and may change before release).

When started mir-kiosk looks for a file: /var/snap/mir-kiosk/common/miral-kiosk.display this is expected to describe the required display layout.

The format of the file is like this:

layouts:
# keys here are layout labels (used for atomically switching between them)
# when enabling displays, surfaces should be matched in reverse recency order

  default:                         # the default layout

    cards:
    # a list of cards (currently matched by card-id)

    - card-id: 0
      VGA-1:
        # This output supports the following modes: 1920x1080@60.0, 1680x1050@60.0,
        # 1280x1024@75.0, 1280x1024@60.0, 1440x900@59.9, 1280x960@60.0, 1280x800@59.8,
        # 1152x864@75.0, 1280x720@60.0, 1024x768@75.0, 1024x768@70.1, 1024x768@60.0,
        # 832x624@74.5, 800x600@75.0, 800x600@72.2, 800x600@60.3, 800x600@56.2,
        # 640x480@75.0, 640x480@66.7, 640x480@59.9, 720x400@70.1
        #
        # Uncomment the following to enforce the selected configuration.
        # Or amend as desired.
        #
        # state: enabled	# {enabled, disabled}, defaults to enabled
        # mode: 1920x1080@60.0	# Defaults to preferred mode
        # position: [0, 0]	# Defaults to [0, 0]
        # orientation: normal	# {normal, left, right, inverted}, defaults to normal

      HDMI-A-1:
        # This output supports the following modes: 1920x1080@60.0, 1680x1050@59.9,
        # 1280x1024@75.0, 1280x1024@60.0, 1440x900@59.9, 1280x960@60.0, 1280x800@59.9,
        # 1152x864@75.0, 1280x720@60.0, 1024x768@75.0, 1024x768@70.1, 1024x768@60.0,
        # 832x624@74.5, 800x600@75.0, 800x600@72.2, 800x600@60.3, 800x600@56.2,
        # 640x480@75.0, 640x480@66.7, 640x480@59.9, 720x400@70.1
        #
        # Uncomment the following to enforce the selected configuration.
        # Or amend as desired.
        #
        # state: enabled	# {enabled, disabled}, defaults to enabled
        # mode: 1920x1080@60.0	# Defaults to preferred mode
        # position: [0, 0]	# Defaults to [0, 0]
        # orientation: normal	# {normal, left, right, inverted}, defaults to normal

      DisplayPort-1:
        # (disconnected)

      HDMI-A-2:
        # (disconnected)

      DisplayPort-2:
        # (disconnected)

If the file doesn’t exist already, mir-kiosk will create a template file that reflects the current hardware. When you look at the template display configuration file, you’ll see that all the options are commented out (as in the above example). Just activate and change the ones that you need (you’ll need sudo to update to this file).

Alternative layouts in miral-kiosk.display

The sharp eyed amongst you will have spotted that the example mentions “default: # the default layout”. Yes, it is possible to have multiple layouts specified in /var/snap/mir-kiosk/common/miral-kiosk.display.

You could, for example have this:

layouts:
  inverted:

    cards:
    - card-id: 0
      VGA-1:
        orientation: inverted

      HDMI-A-1:
        orientation: inverted

      DisplayPort-1:
        # (disconnected)

      HDMI-A-2:
        # (disconnected)

      DisplayPort-2:
        # (disconnected)

  default:                         # the default layout

    cards:
    # a list of cards (currently matched by card-id)

    - card-id: 0
      VGA-1:
        # ...

      HDMI-A-1:
        # ...

      DisplayPort-1:
        # (disconnected)

      HDMI-A-2:
        # (disconnected)

      DisplayPort-2:
        # (disconnected)

You can then select a layout like this:

sudo snap set mir-kiosk display-layout=inverted

Hello Alan,

I messing around with these settings and they are awesome! I use mir-kiosk together with chromium-mir-kiosk.

My issue is that when I set mir-kiosk to left or right I can’t get the chromium-mir-kiosk app to fill the screen. It renders as if it were a landscape format but turn 90 degrees so only about half of the image is visible.

Can you give me your thoughts on this?

Cheers!

I’ve only seen this with the chromium-mir-kiosk snap, so I think the problem is in the way that I3 fullscreens the window. I don’t know enough about that to suggest a fix.

A feature that is not mentioned in this post is the ability to supply the display configuration to mir-kiosk via a configuration key:

snap set mir-kiosk display-config=...

This is probably only useful for automated deployment and putting the whole display configuration file into a string is left as “an exercise for the reader”.