Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ImageCommand #98

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dgalli1
Copy link

@dgalli1 dgalli1 commented Apr 22, 2022

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
Copy link
Author

dgalli1 commented Apr 22, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant