KatsuteDev / Background

The most advanced background image extension for VSCode
https://marketplace.visualstudio.com/items?itemName=katsute.code-background
GNU General Public License v2.0
70 stars 4 forks source link

ability to copy background #317

Closed polygonnedpotato closed 1 month ago

polygonnedpotato commented 2 months ago

Feature

In the command picker, there should be an option to copy the current background for either the window, editor, panel, or sidebar.

Like Background: Copy Image > Window

Optionally, potentially providing a hint as to what the file name is would be a nice touch.

Reason

Katsute commented 2 months ago

Unfortunately there isn't a way to add this feature; the backgrounds are running in a separate process than the extension thread, so there isn't a way to actually get the current background via the extension.

Katsute commented 2 months ago

If you want to copy or share settings you can open your user settings from the command pallette, the options for this extension will start with background.

polygonnedpotato commented 2 months ago

well, the picture url is exposed by style tags in the head section, so

/url\(".*"\)/gm.exec(document.head.getElementsByTagName('style')['KatsuteDev/Background-window-images'].outerText)[0].slice(5,-2)

returns a vscode-file encoded url, for example vscode-file://vscode-app/home/kitsune/Pictures/wall.jpg refers to /home/kitsune/Pictures/wall.jpg

i don't know how going about copying the image to the clipboard, but that's how to get the file url.

Katsute commented 2 months ago

VSCode extensions do not have access to the DOM, it is not possible to have a command in the extension run code on the HTML in the IDE.

polygonnedpotato commented 2 months ago

ah, i see

i think i will investigate into how vscode works and see if there might be a way around that

Katsute commented 2 months ago

There is not a way, the separation is intentional so extensions can't mess with the front end elements.

kdevbot[bot] commented 2 months ago

This issue has been marked as stale due to inactivity.

kdevbot[bot] commented 1 month ago

This issue has been closed due to inactivity.