deckmaster
deckmaster copied to clipboard
Implement ImageCommand
This is my attempt of implementing a Command which doesn't return a String but an Image.
First time coding go, so this is most likely not how you're supposed to do this, and it will probably need some changes.
How it works is by getting a path to image from a command, it will then render this image.
Configuration is basically the same as with the Command
[[keys]]
index = 13
[keys.widget]
id = "imageCommand"
[keys.widget.config]
command = "/home/damian/deck/image-updated.bash"
[keys.action]
exec = "/usr/sbin/youtube-music"
Just my example script with which I tested this feature:
#!/bin/bash
IMAGEURL=$(playerctl metadata -p youtube-music mpris:artUrl 2< /dev/null)
if [[ $(< /tmp/artUrl.txt) != "$IMAGEURL" ]]; then
wget "${IMAGEURL}" -O /tmp/musicimage -q
# save IMAGEURL to /tmp/artUrl.txt
echo "${IMAGEURL}" > /tmp/artUrl.txt
fi
echo /tmp/musicimage
Btw not really sure of path is the right tool here or if it should just get sent via stdout