Conversation
| // TODO: Other useful options may include: | ||
| // - Summon All | ||
| // - Summon MRU or Monarch | ||
| // - Though that's technically already available with a left click | ||
| // but may be a reasonable request to also put it explicitly in the | ||
| // context menu | ||
| // - Quit All |
There was a problem hiding this comment.
Don't forget to tag up this bare TODO
This should be a requirement. So many applications provide this option that it should be considered a defacto standard (like Xterm). (I also personally like seeing all my tray icons. If I don't want to see one, I'll close the application instead, usually from left clicking on the icon, if it's supported, which it usually is.) |
Yep, there's already a whole spec with a section devoted to this idea. |
wait uh, I don't think we need this. Win+down will minimize a window |
zadjii-msft
left a comment
There was a problem hiding this comment.
blocking for discussion on the minimizeToTray action and the #if TIL_FEATURE thing
| <value>Command Palette</value> | ||
| </data> | ||
| <data name="AppName" xml:space="preserve"> | ||
| <value>Windows Terminal</value> |
There was a problem hiding this comment.
wait uh, if you're gonna pull it from the CascadiaPackage resources, do we need this string still?
Ah crap I didn't even know about this shortcut 😅 |
Hmm. Interesting. Okay, I'm convinced. I kinda think it should be a separate PR, but it's already here so ¯\_(ツ)_/¯ |
zadjii-msft
left a comment
There was a problem hiding this comment.
Okay most of these are just notes to self as I read the code. Mostly just indicators of where I might have been confused as I was following the logic.
I think at this point I'm mostly blocking on the "add a try/catch here" one.
I don't know how I feel about the minimize to tray action, but I don't feel like blocking that element of it.
This is ∞% better without all the ifdefs, thanks for that
| const ActionEventArgs& args) | ||
| { | ||
| #if TIL_FEATURE_TRAYICON_ENABLED | ||
| if (_settings.GlobalSettings().MinimizeToTray() || _settings.GlobalSettings().AlwaysShowTrayIcon()) |
There was a problem hiding this comment.
Wait so if they don't have either of these features on, then this will do nothing. I thought the point of this action was to allow minimizing a window to the tray even when neither setting is on?
There was a problem hiding this comment.
right okay so this action only works when there is a tray icon. Right, cause otherwise the window would just disappear into the void. And we're not doing any sort of per-window tracking of "this window wanted to be able to minimize to the tray, so we must have a tray icon".
IDK I still feel weird about this action and almost wish it was a separate PR to review/discuss
There was a problem hiding this comment.
Yup, pretty much I don't want to let the user do be able to minimize if there won't be a tray icon. The idea was to be able to minimize when minimizeToTray = false, alwaysShowTrayIcon = true.
The per-window tracking would definitely be useful especially for big sweeping actions like "summon all" - I'll add it to the list.
I'll also split this off into its own PR and we could discuss some more there - makes the PR smaller too 😉
| // work properly. | ||
| nid.uVersion = NOTIFYICON_VERSION_4; | ||
| Shell_NotifyIcon(NIM_SETVERSION, &nid); | ||
| void AppHost::_ShowTrayIconRequested() |
There was a problem hiding this comment.
Don't we need to make sure to hop onto the BG thread at the top of this (and _HideTrayIconRequested)? Usually the COM x-proc calls end up throwing exceptions/gracefully doing nothing when called on the main thread.
Is this really never called on the main thread?
-
_IsQuakeWindowChanged- pretty sure that can be on the main thread... unsure tho -
_windowManager.ShowTrayIconRequestedokay this one's on the bg thread
There was a problem hiding this comment.
Hmm I've never observed it doing weird stuff, I'll throw it on a resume_background in the beginning of the functions just to be safe.
src/cascadia/Remoting/Monarch.cpp
Outdated
| { | ||
| SummonWindowBehavior args{}; | ||
| args.ToggleVisibility(false); | ||
| peasant.Summon(args); |
There was a problem hiding this comment.
wrap this boy up in a try/catch
There was a problem hiding this comment.
I'm actually doing the _forAllPeasantsIgnoringTheDead thing for this little snippet, that has error handling in it so I should be good right?
| // - <none> | ||
| void TrayIcon::DestroyTrayIcon() | ||
| { | ||
| Shell_NotifyIcon(NIM_DELETE, &_trayIconData); |
There was a problem hiding this comment.
Should we also do a
_trayIconData.reset();here, like we used to?
There was a problem hiding this comment.
I was intending for this function to be more of a RemoveIconFromTray instead of a "destroy" (I'll rename). I wanted the actual "destruction" of the tray icon to be when AppHost sets its _trayIcon ptr to null, and if it ever wanted to get a new tray icon, it should instantiate a new one.
There was a problem hiding this comment.
Okeydokey, good enough for me
|
Hello @leonMSFT! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
carlos-zamora
left a comment
There was a problem hiding this comment.
- I think we should be using
if constexpr (Feature_XXX::IsEnabled())when possible - the
gsl::narrowvsgsl::narrow_castthing is a bit concerning, so I just want to double check that - the one copyright header that's missing
| { | ||
| Shell_NotifyIcon(NIM_DELETE, &_trayIconData.value()); | ||
| _trayIconData.reset(); | ||
| _windowManager.RequestHideTrayIcon(); |
There was a problem hiding this comment.
btw there's no guarantee that this destructs 😄
There was a problem hiding this comment.
argh I used the wrong one here it should be AppHost::_HideTrayIconRequested
There was a problem hiding this comment.
just kidding that's not the right one either
| _setupGlobalHotkeys(); | ||
|
|
||
| // The monarch is just going to be THE listener for inbound connections. | ||
| _listenForInboundConnections(); |
There was a problem hiding this comment.
this doesn't break the defapp server?
There was a problem hiding this comment.
oh shit good catch
Some followups to #10368: - Accidentally reverted a defapp change where the Monarch should not by default register itself as a handoff server. - Destroy the tray icon if we're a monarch otherwise if we're a quake window we request the monarch to hide the icon.
A brief summary of the behavior of the tray icon:
Settings Changes
Two new global settings are introduced:
alwaysShowTrayIconandminimizeToTray. Here's a chart explaining the behavior with the two settings.alwaysShowTrayIcon:truealwaysShowTrayIcon:falseminimizeToTray:trueminimizeToTray:falseCloses #5727
References
Spec for Minimize to Tray
Docs PR - MicrosoftDocs/terminal#352
#10448 - My list of TODOs