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

Set Image path from executable file (Image Module) #1978

Merged
merged 6 commits into from
Feb 9, 2023

Conversation

kpanuragh
Copy link
Contributor

I just made a small tweak in the image module to get the image path from an executable file. Here is a sample configuration.

 "image/album-art": {
	  "exec":"~/.config/waybar/custom/spotify/album_art.sh",
	  "size": 32,
	  "interval": 5,  
    },

If there is a path config exist, then it will load the image from the path config; otherwise, it will check for an exec configuration and execute the script, which should return a file path, and then it will load the image.
Here is a simple executable file

#!/bin/bash
album_art=$(playerctl -p spotify metadata mpris:artUrl)
if [[ -z $album_art ]] 
then
   # spotify is dead, we should die to.
   exit
fi
curl -s  "${album_art}" --output "/tmp/cover.jpeg"
echo "/tmp/cover.jpeg"

@kpanuragh kpanuragh changed the title Set Image path from executable file Set Image path from executable file (Image Module) Jan 25, 2023
@kpanuragh
Copy link
Contributor Author

@Alexays any update ?

src/modules/image.cpp Outdated Show resolved Hide resolved
@kpanuragh
Copy link
Contributor Author

@Alexays is it okey

@@ -27,6 +27,7 @@ class Image : public AModule {
std::string path_;
int size_;
int interval_;
util::command::res output_;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove that variable

@kpanuragh
Copy link
Contributor Author

@Alexays

@Alexays
Copy link
Owner

Alexays commented Feb 1, 2023

LGTM, can you update the man and the github wiki?
And i'll merge the PR :)

@kpanuragh
Copy link
Contributor Author

@Alexays updated man page and wiki

@kpanuragh
Copy link
Contributor Author

@Alexays any update

@Alexays Alexays merged commit 286a3c7 into Alexays:master Feb 9, 2023
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.

None yet

2 participants