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

Method to obtain background image source/URL for non-static background sources #434

Open
MimikoM opened this issue Jan 5, 2024 · 1 comment

Comments

@MimikoM
Copy link

MimikoM commented Jan 5, 2024

What kind of feature request is this?

Feature improvements


Is your feature request related to a problem? Please describe.

Yes.

Background images from non-static source do not appear to have a method to obtain source image/URL.

In my case I have the background image set to a URL which automatically redirects to a random image each time nighttab is loaded (using this, specifically); I think this is also applicable to the built-in rotating image sources as well however. Regardless, the inability to access the source image prevents the user from having a way to save it, perform a reverse-image search on it (such as to find out who the artist is), etc. Sometimes I want to see more works from the artist of the current background image, but presently do not have a way to open that image or retain it in any way.


Describe the solution you'd like

A small button, icon, or other way of opening the current background image in a new window/tab. Copying the current background image's URL to the clipboard would also be acceptable.


Describe alternatives you've considered

Looked through page source and inspect element to try and see if the image source URL is accessible there, however I could not find any record of it. Can see HTTP GET request to the image URL that I provided in nighttab settings, but the response to this request is discarded by the browser immediately (response headers tab of inspector is completely blank) unless the inspector is already open on page load.

@metruzanca
Copy link
Contributor

metruzanca commented Mar 25, 2024

@MimikoM

Looked through page source and inspect element to try and see if the image source URL is accessible there, however I could not find any record of it. Can see HTTP GET request to the image URL that I provided in nighttab settings, but the response to this request is discarded by the browser immediately (response headers tab of inspector is completely blank) unless the inspector is already open on page load.

This is because the background is done via background image css property. You could extract it with getComputedStyle(document.documentElement).getPropertyValue('--theme-background-image') the only issue is that since the service you're using redirects to a new url, the browser internally follows the redirects and just never informs nighttab of them and just loads the image. Nighttab is as clueless as you are.

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

No branches or pull requests

2 participants