Skip to content

Commit

Permalink
Merge pull request #1 from cimm/configurable-duration
Browse files Browse the repository at this point in the history
Make duration configurable
  • Loading branch information
ogra1 authored Nov 18, 2020
2 parents 20c162c + 53ba91a commit 6cb12f9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
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
snapctl set duration="$DEFAULT_DURATION"
snapctl restart "$SNAP_NAME".imv
fi
11 changes: 10 additions & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ description: |
picture files to the directory, a slideshow will automatically
start on the Image Viewer screen.
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.
Imv has support for over 30 different image file formats including
- Photoshop PSD files
- Animated GIFS
Expand Down Expand Up @@ -37,7 +41,7 @@ architectures:

apps:
imv:
command: snap/command-chain/desktop-launch $SNAP/usr/bin/imv -f -t 10 -r $SNAP_DATA/
command: snap/command-chain/desktop-launch $SNAP/bin/imv.wrapper
daemon: simple
restart-condition: always
extensions: [ gnome-3-28 ]
Expand Down Expand Up @@ -123,3 +127,8 @@ parts:
source: watcher
stage-packages:
- inotify-tools
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" -r "$SNAP_DATA/"

0 comments on commit 6cb12f9

Please sign in to comment.