Display current tab's icon as the taskbar icon #9096

Closed
opened 2026-01-31 01:45:53 +00:00 by claunia · 7 comments
Owner

Originally created by @dstaley on GitHub (Jun 18, 2020).

image

Description of the new feature/enhancement

I'd love to have the ability to select a custom Terminal icon from a limited set of icons packaged with the application by Microsoft. Particularly, I'd love the ability to use this icon from @cinnamon-msft.

Proposed technical implementation details (optional)

This isn't asking for completely arbitrary icons; the scope would be limited to a set of included icons. I also believe that means it's not in scope of #4000.

As for a potential solution, I'm not sure which of the Windows APIs Terminal has access to. If Win32 APIs can be called, I think WM_SETICON could be a good place to start.

Originally created by @dstaley on GitHub (Jun 18, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> ![image](https://user-images.githubusercontent.com/88163/84973728-a111a700-b0d6-11ea-86b6-2f3021ba075c.png) # Description of the new feature/enhancement I'd love to have the ability to select a custom Terminal icon from a limited set of icons packaged with the application by Microsoft. Particularly, I'd love the ability to use [this icon](https://twitter.com/cinnamon_msft/status/1273374458061807616) from @cinnamon-msft. # Proposed technical implementation details (optional) This isn't asking for completely arbitrary icons; the scope would be limited to a set of included icons. I also believe that means it's not in scope of #4000. As for a potential solution, I'm not sure which of the Windows APIs Terminal has access to. If Win32 APIs can be called, I think [WM_SETICON](https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-seticon) could be a good place to start.
Author
Owner

@WSLUser commented on GitHub (Jun 18, 2020):

Let's keep Windows Terminal from being political. You could technically change your icon yourself by replacing the existing icon with the one of your choice. However I can see a feature request for this in general (you can already set an icon inside Terminal in settings.json as a background, this would just be near duplicate code that changes the main icon instead.)

I would still rather see this particular feature request as an extension.

@WSLUser commented on GitHub (Jun 18, 2020): Let's keep Windows Terminal from being political. You could technically change your icon yourself by replacing the existing icon with the one of your choice. However I can see a feature request for this in general (you can already set an icon inside Terminal in settings.json as a background, this would just be near duplicate code that changes the main icon instead.) I would still rather see this particular feature request as an extension.
Author
Owner

@zadjii-msft commented on GitHub (Jun 18, 2020):

I'm gonna keep this discussion strictly technical.

There's no way I'm aware of to dynamically change the tile in the Start Menu. I'm pretty sure that's something that the platform hasn't provided any sort of API for, so that's out of the question.

The next idea would be setting the icon in the taskbar. #1871 covers some of that discussion, but that's mostly just "show the profile's icon as a badge on the taskbar". I'm not really sure if it's possible to generically replace the entire icon for an application at runtime, and if we could, I'd bet that it would revert to the default when the app was closed. Since #1871 seems specific to using the icon as a badge, I'm gonna convert this issue into "use the profile icon as the taskbar icon". I don't know if WM_SETICON would work, or how we'd convert a image into an HICON, but that's probably the hardest bit of work.

Then of course, as the least visible solution, you can already set the icon for the tab itself. Since that's already a possible solution, I'm not gonna discuss that too much more.

@zadjii-msft commented on GitHub (Jun 18, 2020): I'm gonna keep this discussion _strictly_ technical. There's no way I'm aware of to dynamically change the tile in the Start Menu. I'm pretty sure that's something that the platform hasn't provided any sort of API for, so that's out of the question. The next idea would be setting the icon in the taskbar. #1871 covers _some_ of that discussion, but that's mostly just "show the profile's icon as a badge on the taskbar". I'm not really sure if it's possible to generically replace the entire icon for an application at runtime, and if we could, I'd bet that it would revert to the default when the app was closed. Since #1871 seems specific to using the icon as a _badge_, I'm gonna convert this issue into "use the profile icon _as the taskbar icon_". I don't know if `WM_SETICON` would work, or how we'd convert a image into an HICON, but that's probably the hardest bit of work. Then of course, as the _least_ visible solution, you can already set the icon for the tab itself. Since that's already a possible solution, I'm not gonna discuss that too much more.
Author
Owner

@dstaley commented on GitHub (Jun 18, 2020):

I'm not really sure if it's possible to generically replace the entire icon for an application at runtime, and if we could, I'd bet that it would revert to the default when the app was closed.

I'm totally fine with that solution! It makes sense that a user-choice would only be reflected at runtime.

Since #1871 seems specific to using the icon as a badge, I'm gonna convert this issue into "use the profile icon as the taskbar icon".

My only worry here is if we default to using the profile icon in all instances, you could find yourself in a situation where you're running both Command Prompt and Windows Terminal at the same time, and they both have the same taskbar icon (since the profile icon for Command Prompt is the Command Prompt icon). I think it would make the most sense to support specifically declaring a taskbar icon for a profile, with the ability to set that property at a global level as well. That way, you can opt-in to having the taskbar icon change, and have a way to say "I don't care which profile is running, just use this icon".

I don't know if WM_SETICON would work, or how we'd convert a image into an HICON, but that's probably the hardest bit of work.

The original intent of the request was to have icons embedded as ICO resources, not arbitrary images, so I believe you could just use LoadIcon with the identifier from the resource definition file. The idea was to only support Microsoft-provided images. If we can find a solution that works with arbitrary images, that's awesome, but if that proves to be difficult I'd rather have just included icons than not have the functionality at all.

@dstaley commented on GitHub (Jun 18, 2020): > I'm not really sure if it's possible to generically replace the entire icon for an application at runtime, and if we could, I'd bet that it would revert to the default when the app was closed. I'm totally fine with that solution! It makes sense that a user-choice would only be reflected at runtime. > Since #1871 seems specific to using the icon as a _badge_, I'm gonna convert this issue into "use the profile icon _as the taskbar icon_". My only worry here is if we default to using the profile icon in all instances, you could find yourself in a situation where you're running both Command Prompt and Windows Terminal at the same time, and they both have the same taskbar icon (since the profile icon for Command Prompt is the Command Prompt icon). I think it would make the most sense to support specifically declaring a taskbar icon for a profile, with the ability to set that property at a global level as well. That way, you can opt-in to having the taskbar icon change, and have a way to say "I don't care which profile is running, just use this icon". > I don't know if `WM_SETICON` would work, or how we'd convert a image into an HICON, but that's probably the hardest bit of work. The original intent of the request was to have icons embedded as ICO resources, not arbitrary images, so I believe you could just use `LoadIcon` with the identifier from the resource definition file. The idea was to only support Microsoft-provided images. If we can find a solution that works with arbitrary images, that's awesome, but if that proves to be difficult I'd rather have just included icons than not have the functionality at all.
Author
Owner

@electronic-dk commented on GitHub (Jun 19, 2020):

@dstaley regarding your second concern about the same taskbar icon for different profiles and the terminal: the proposal there is to have it as a small overlay over the default terminal icon not to replace it entirely, so that you wouldn't confuse it with the actual prompt if it's running alongside the terminal, so I don't really think this should be an issue.

@electronic-dk commented on GitHub (Jun 19, 2020): @dstaley regarding your second concern about the same taskbar icon for different profiles and the terminal: the proposal there is to have it as a small overlay over the default terminal icon not to replace it entirely, so that you wouldn't confuse it with the actual prompt if it's running alongside the terminal, so I don't really think this should be an issue.
Author
Owner

@dstaley commented on GitHub (Jun 19, 2020):

@electronic-dk #1871 covers the badge use case, this issue is for replacing the entire icon.

@dstaley commented on GitHub (Jun 19, 2020): @electronic-dk #1871 covers the badge use case, this issue is for replacing the entire icon.
Author
Owner

@zadjii-msft commented on GitHub (Apr 28, 2023):

xlink: https://github.com/microsoft/terminal/issues/4768#issuecomment-1527800607 has the most comprehensive summary of the problem space

@zadjii-msft commented on GitHub (Apr 28, 2023): xlink: https://github.com/microsoft/terminal/issues/4768#issuecomment-1527800607 has the most comprehensive summary of the problem space
Author
Owner

@zadjii-msft commented on GitHub (Aug 17, 2023):

Talked this over with some taskbar folks. Looks like this is going to be largely impossible. The Taskbar really doesn't expect an app to be changing its icon at runtime. There are technically tricks we could play (by doing Aumid/RelaunchIcon trickery), but that would essentially cause the Taskbar to think the Terminal was a different app each time. Our window would get moved to the end of the taskbar order. Pinning to the taskbar would also be weird. I'm sure there are more edge cases here that they didn't just rattle off the top of their head too.

On the bright side, #1871 looks very possible, so that might have to be the solution in this space.

@zadjii-msft commented on GitHub (Aug 17, 2023): Talked this over with some taskbar folks. Looks like this is going to be largely impossible. The Taskbar _really_ doesn't expect an app to be changing its icon at runtime. There are technically tricks we could play (by doing Aumid/RelaunchIcon trickery), but that would essentially cause the Taskbar to think the Terminal was a different app each time. Our window would get moved to the end of the taskbar order. Pinning to the taskbar would also be weird. I'm sure there are more edge cases here that they didn't just rattle off the top of their head too. On the bright side, #1871 looks very possible, so that might have to be _the_ solution in this space.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#9096