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

Add setThumbnailClip API on Windows #6497

Merged
merged 3 commits into from
Jul 15, 2016
Merged

Add setThumbnailClip API on Windows #6497

merged 3 commits into from
Jul 15, 2016

Conversation

kevinsawicki
Copy link
Contributor

@kevinsawicki kevinsawicki commented Jul 14, 2016

This pull requests adds a setThumbnailClip(region) API to BrowserWindow instances on Windows that can be used to control which region of the window is used to generate the thumbnail image displayed in the taskbar when the window is hoverered over.

For the sample Electron app if you called it as:

require('electron').remote.getCurrentWindow().setThumbnailClip({x:0, y:0, width:500, height:100})

It would change the taskbar thumbnail from:

Default Set via setThumbnailClip
screen shot 2016-07-14 at 3 52 22 pm screen shot 2016-07-14 at 3 51 55 pm

This can be useful for media-related apps that want the thumbnail to be the specific content such as an image, video element, etc.

Closes #2623

@zcbenz
Copy link
Contributor

zcbenz commented Jul 15, 2016

👍

@zcbenz zcbenz merged commit d186a01 into master Jul 15, 2016
@zcbenz zcbenz deleted the windows-thumbnail branch July 15, 2016 01:18
@YurySolovyov
Copy link
Contributor

Is there a way to reset it afterwards?

@YurySolovyov
Copy link
Contributor

@kevinsawicki I'm not sure this really closes the issue, what if I want to provide my own image that is not related to currently displayed window without clipping ?
Seems like https://msdn.microsoft.com/en-us/library/windows/desktop/dd562049(v=vs.85).aspx provides more powerful way to provide your own image.

@MarshallOfSound
Copy link
Member

@kevinsawicki @YurySolovyov

To be honest when I saw that original issue this was the API I was imagining 😄

https://msdn.microsoft.com/en-us/library/dd389410(v=vs.85).aspx

Let's you set a custom BitMap to be the live preview. Not quite sure how this would fit into an electron API though 👍

@kevinsawicki
Copy link
Contributor Author

Is there a way to reset it afterwards?

You can reset it by passing in an empty area {x:0, y:0, width: 0, height: 0}

@kevinsawicki
Copy link
Contributor Author

@YurySolovyov @MarshallOfSound Yeah, setting a thumbnail image would be useful to have in addition to this API.

I created a new issue specifically for it at #6508 👍

@anaisbetts
Copy link
Contributor

Have you tried this API on a non-100% DPI display? I suspect you need to do some multiplication to convert 96DPI pixel units to HWND pixels

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

5 participants