diff --git a/snap/hooks/configure b/snap/hooks/configure new file mode 100755 index 0000000..c695e4e --- /dev/null +++ b/snap/hooks/configure @@ -0,0 +1,11 @@ +#!/bin/sh -e + +DEFAULT_DURATION=10 + +duration="$(snapctl get duration)" + +if ! expr "$duration" : '^[0-9]*$' > /dev/null; then + echo "\"$duration\" is not a valid duration, reveting to $DEFAULT_DURATION seconds" >&2 + duration="$DEFAULT_DURATION" + snapctl set duration="$duration" +fi diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 66a7008..322c837 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -5,9 +5,11 @@ description: | Image viewer for mir-kiosk based on imv Put Pictures into /var/snap/picviewer-kiosk/common/, - restart the snap with "snap restart picviewer-kiosk" and the - Pictures will run as a slideshow at a 10 second rotation - frequency. + restart the snap with "snap restart picviewer-kiosk". + + Pictures will run as a slideshow. The time per picture can be + changed via "snap set picviewer-kiosk duration=30", the default + is 10 seconds per image. Support for over 30 different image file formats including - Photoshop PSD files @@ -27,7 +29,7 @@ confinement: strict apps: picviewer-kiosk: - command: snap/command-chain/desktop-launch $SNAP/usr/bin/imv -b checks -f -t 10 $SNAP_COMMON/ + command: snap/command-chain/desktop-launch $SNAP/bin/imv.wrapper daemon: simple restart-condition: always extensions: [ gnome-3-28 ] @@ -69,3 +71,11 @@ parts: - libopenjp2-7 - libraw16 - libwebpmux3 + organize: + imv.wrapper: bin/imv.wrapper + + wrappers: + source: wrappers/ + plugin: dump + organize: + imv.wrapper: bin/imv.wrapper diff --git a/wrappers/imv.wrapper b/wrappers/imv.wrapper new file mode 100755 index 0000000..973d1e4 --- /dev/null +++ b/wrappers/imv.wrapper @@ -0,0 +1,4 @@ +#!/bin/sh -e + +DURATION="$(snapctl get duration)" +exec "$SNAP/usr/bin/imv" -f -t "$DURATION" "$SNAP_COMMON/"