Skip to content

Commit

Permalink
Make duration configurable
Browse files Browse the repository at this point in the history
Adds the possibility to configure the time an image is shown, defaulting
to 10 seconds per image.
  • Loading branch information
cimm committed Nov 18, 2020
1 parent c2fbe8b commit d05c366
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
11 changes: 11 additions & 0 deletions snap/hooks/configure
Original file line number Diff line number Diff line change
@@ -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
18 changes: 14 additions & 4 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ]
Expand Down Expand Up @@ -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
4 changes: 4 additions & 0 deletions wrappers/imv.wrapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh -e

DURATION="$(snapctl get duration)"
exec "$SNAP/usr/bin/imv" -f -t "$DURATION" "$SNAP_COMMON/"

0 comments on commit d05c366

Please sign in to comment.