Invoke configure hook from other snap

I have the following use-case: My Raspberry Pi based gadget has no direct input methods attached and is running mir-kiosk in fullscreen. My snap provides a web GUI to manage the device, which should also allow to change the screen rotation (a.k.a. display layout in mir-kiosk speak). I use cloud.conf with ubuntu-image to write out the required layouts.

  1. mir-kiosk provides a configure hook to change the selected display layout. Is there any mechanism which would allow me to call mir-kiosk's configure hook from within my snap? I do realize the security implications, which is why I looked at the interfaces documentation – but there doesn’t seem to be a “allow configure hook calls from the connected snaps” interface :smile:
  2. Provided I come up with an interface-based solution to call a script that mirrors mir-kiosk's configure hook and it gets accepted by the mir-kiosk maintainers :pray: : Which would be preferable, D-Bus or a simple shell script through the content interface?

Ping @jdstrand @ogra @alan_g and thanks in advance :slight_smile:

1 Like

your snap sounds like a good candidate for asking for (and getting) the snapd-control interface, which would let you do that and more. But I’m not a reviewer :slight_smile:

snapd-control requires a brand store (unless that policy was recently changed) …

i think there are (IMHO very hackish) ways to run commands like snap set ... from cloud-init and i think @ondra has some experience with that …

regarding some kind of mir-control interface i think thats a matter of the mir team to decide on…

Control of the display configuration used to be available to authorized clients of the (now obsolete) mirclient API. That’s one of the features that has been temporarily “lost” in transition to Wayland.

I do agree that the current facilities leave something to be desired, but my preferred approach would be to use a Wayland extension that can be hooked into the Mir code that supported the mirclient API.

Between “D-Bus or a simple shell script through the content interface” I don’t see what would activate a shell script. I can imagine a daemon that responds to dbus calls by using snapctl set to change configuration options. That’s likely the simplest thing that could work.

1 Like

I am also in situation where my single app wants to rotate mir’s display,
instead of doing this manualy (from shell)
I think I could hardcode this in gadget or extra cloud configuration,
which method do you recommend for uc20 ?

BTW, Let me crosslink to this issue:

While the issue was actually never solved, Mir has the ability to read config files nowadays … through a gadget.yaml enty you could feed nested yaml into that to have it come up rotated with the display-config: option…


Yeah, that’s what I use in my gadget as well.

My original question (and maybe also @rzr) was on-demand rotation, so that a user can freely rotate the display later on if they chose to do so, without having to connect to the device via SSH (no local keyboard and disabled terminal).

@alan_g Is there any such extension available that could be used for this purpose?

None currently supported by Mir. (PRs welcome)


you could do it with a snap that has the snapd-control interface connected to allow you the REST API access to call the equivalent of:

snap set mir-kiosk display-layout=inverted

(like described in the masterclass doc i linked) which i believe applies the new config and restarts mir (which indeed requires the differnt configs you want to switch between to be set up in advance)…

and indeed snapd-control requires a brand store … but it is surely possible even today :slight_smile:

Ah yes, forgot to mention: We don’t have a brand store (yet) :slight_smile: If that’s the case, then seeding the config via gadget + snapd-control's possibilities would be the way to go. Unfortunately, prospective customers require functionality like display rotation before they buy into a contract, which we would require to pay for the brand store that enables it :upside_down_face: (not a complaint)

1 Like

This is why i explicitly mentioned it :wink:

That’s also probably not what is wanted here. That changes the static configuration for Mir and takes effect through a restart of the shell.

What I think is wanted is for the shell to invert the display dynamically (without a restart).

1 Like

yep, and i understood that this is indeed a poor workaround, but it will make “semi dynamic” rotation possible with todays code/tools

1 Like