deckmaster icon indicating copy to clipboard operation
deckmaster copied to clipboard

Implement ImageCommand

Open dgalli1 opened this issue 3 years ago • 1 comments

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

dgalli1 avatar Apr 22 '22 12:04 dgalli1

Btw not really sure of path is the right tool here or if it should just get sent via stdout

dgalli1 avatar Apr 22 '22 16:04 dgalli1