#!/bin/sh photoframe_hide() { swaymsg 'workspace 1' } photoframe_show() { # Run on a separate workspace so Firefox can stay fullscreen, too swaymsg 'workspace 2' if [ -f /tmp/photoframe.pid ]; then # feh is already running return 0 fi if [ ! -f /tmp/photoframe-current ]; then cp /usr/share/feh/images/feh.png /tmp/photoframe-current fi feh -FZ --draw-exif --class photoframe /tmp/photoframe-current & # Wait for the feh window to actually appear ... swaymsg -t subscribe '["window"]' # Sometimes, Sway's `for_window ... fullscreen` doesn't work? swaymsg fullscreen echo $! > /tmp/photoframe.pid } photoframe_stream() { while :; do curl -NsS https://photos.pyrocufflink.blue/stream | while read url; do curl -fsL -o /tmp/photoframe-next "${url}" || continue mv /tmp/photoframe-next /tmp/photoframe-current done sleep 30 done } case $1 in show) photoframe_show ;; hide) photoframe_hide ;; stream) photoframe_stream ;; esac