derf / feh

a fast and light image viewer
https://feh.finalrewind.org
Other
1.56k stars 160 forks source link

Time and Text Display for feh as a Digital Picture Frame #626

Open cortesi7b8 opened 3 years ago

cortesi7b8 commented 3 years ago

I have been using feh on a raspberry pi as a digital picture frame for about 3 years now and it works great. I modified my local version of feh (2.18) to add two new features to make it more useful to me in this role.

Display Current Time in the Lower Left

I have added two command line options for this time feature: --draw-time --time-font

It displays the current local time in the lower left corner of the slide show. The time is updated only when the slide show changes a slide. I have mine set to change the image every minute. So the displayed time is correct to the nearest minute. One obvious downside to this is that if the image change time is set to significantly more than a minute, then the displayed time would lag the actual time by whatever that image change time is.

This feature also enables one to specify the font for the time so the user can change the size of the displayed font (easier to read from across the room).

Display the contents of a Text File in the Upper Left (Wx or similar display)

This feature adds the following command line option: --draw-external-file "/home/pi/fehmotd.txt"

Every time the image changes in the slide show, feh reads the contents of the text file passed as the argument to the --draw-external-file option. It writes the contents of the text file in the default font in the upper left of the image.

On my setup I have other processes running that periodically update this text file with the current weather and my home's solar panel production numbers. But it could be used for a variety of information that one might want to overlay on a digital picture frame.

Request for Feedback

I'm working on updating this feature from my old 2.18 version of the source code of to the current 3.7.x version. I'd like to create branch for this feature and submit it for consideration by the community for inclusion.

Looking forward to the community's thoughts and feedback.

Roger

derf commented 3 years ago

I'm glad that feh works well for you. It looks like most of your use cases can be solved without patching the current feh version.

Instead of --draw-time, you can also use --info "date +%%H:%%M". It's not possible to change the info font separately though, so for different font sizes in a feh window we'd need to add an --info-font option.

Similarly, --draw-external-file file.txt is pretty mach the same as --info "cat file.txt". The only difference is where feh places the text.

So I don't see a benefit in adding those features as-is. feh has a pretty long list of supported options already. However, giving users more control about where feh places its various text overlays and which fonts it uses for them may be a useful addition.

cortesi7b8 commented 3 years ago

oh the --info tag. That IS better and more general. Love it.

So maybe we add an --info-font option?

To get an info overlay in a second spot (upper left) maybe an --info2 (or --info-ul) with its associated font option?

Or an --info-position option? But that seems harder to have two simultaneous (and different) overlays.

avlec commented 3 years ago

An option like --info-geom which takes an X geometry might be a good addition. (e.g., --info-geom +40+40) And from what I have read in the source feh uses opt.font which is set by the --font option.