Inform users with custom dialogs

This is a stub, feel free to complete or improve it.

It is sometimes useful to include a custom dialog in your snap:

  • To display a snap obsoletion notice (when migrating snap to another namespace)
    %E5%9C%96%E7%89%87
  • To display snap-specific notices, including but not limited to security confinement interface warnings
    %E5%9C%96%E7%89%87

The following are some ways to implement these, according to the type of the application you’re snapping.

Gtk

Zenity

If you’re using gnome-platform content sharing snap, merge the following part definition to your snapcraft yaml:

parts:
  # Integrate custom dialogs in your snap - doc - snapcraft.io
  # https://forum.snapcraft.io/t/integrate-custom-dialogs-in-your-snap/10825
  zenity:
    plugin: nil
    stage-packages:
      - zenity
    prime:
      - usr/bin/zenity
      - usr/share/zenity/*

otherwise:

parts:
  # Integrate custom dialogs in your snap - doc - snapcraft.io
  # https://forum.snapcraft.io/t/integrate-custom-dialogs-in-your-snap/10825
  zenity:
    plugin: nil
    stage-packages:
      - zenity

next adding the following layout definition:

layout:
  # Fix resource relocation problem of zenity part
  /usr/share/zenity:
    symlink: $SNAP/usr/share/zenity

Now you should be able to call zenity after the effect of the desktop-launch launcher. Also check out The Zenity integration stage snap for an alternative.

YAD(Yet Another Dialog)

T.B.A.

Qt

Kdialog

T.B.A.

Qarma

Qarma is a dialog implementation which is a Qt clone of Zenity. Unlike Kdialog, Qarma does not depend on KDE libraries.

Screenshot of Qarma

To integrate Qarma merge the following part definition:

parts:
  qarma-integration:
    plugin: nil
    stage-snaps:
      - qarma/18
    stage:
      - usr/bin/qarma

Replace 18 to 16 for snaps targeting Ubuntu Core 16(coming soon), refer qarma --help for instructions on using Qarma.

Command-line application

Dialog

T.B.A.

Whiptail

T.B.A.