Skip to content

Commit

Permalink
make file manager configurable via snap set picviewer-kiosk filemanag…
Browse files Browse the repository at this point in the history
…er=true/false"
  • Loading branch information
ogra1 committed Nov 21, 2020
1 parent c28e73f commit 9023591
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions snap/hooks/configure
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@

DEFAULT_DURATION=10

# set default for filemanager if it is empty
[ -n "$(snapctl get filemanager)" ] || snapctl set filemanager=true

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"
fi

snapctl restart "$SNAP_NAME".imv
snapctl restart "$SNAP_NAME".file-browser
7 changes: 6 additions & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ description: |
changed via "snap set picviewer-kiosk duration=30", the default
is 10 seconds per image.
By default the snap runs a http file manager to manage
pictures with a web browser on port 8080.
This can be disabled via "snap set picviewer-kiosk filemanager=false"
Imv has support for over 30 different image file formats including
- Photoshop PSD files
- Animated GIFS
Expand Down Expand Up @@ -51,7 +55,7 @@ apps:
- opengl
- wayland
file-browser:
command: bin/node $SNAP/index.js
command: bin/filemanager.wrapper
daemon: simple
plugs:
- network
Expand Down Expand Up @@ -132,3 +136,4 @@ parts:
plugin: dump
organize:
imv.wrapper: bin/imv.wrapper
filemanager.wrapper: bin/filemanager.wrapper
10 changes: 10 additions & 0 deletions wrappers/filemanager.wrapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh -e

# only run filemanager if option is not set to false
case "$(snapctl get filemanager)" in
[Ff][Aa][Ll][Ss][Ee])
exit 0
;;
esac

exec $SNAP/bin/node $SNAP/index.js

0 comments on commit 9023591

Please sign in to comment.