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 shield to tab row when elevated #11224

Merged
14 commits merged into from Sep 23, 2021
Merged

Add shield to tab row when elevated #11224

14 commits merged into from Sep 23, 2021

Conversation

zadjii-msft
Copy link
Member

Summary of the Pull Request

Adds a visible indicator that a Terminal window is elevated. This icon can be disabled with "showAdminShield" false in the global settings.

References

PR Checklist

Validation Steps Performed

image

image

@ghost ghost added Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal. labels Sep 14, 2021
Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! Idk how valid my concern is below, so I'll just approve.

@@ -32,6 +32,7 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you can undo changes to this file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ This. 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes plz

// GH#2455 - Make sure to try/catch calls to Application::Current,
// because that _won't_ be an instance of TerminalApp::App in the
// LocalTests
try
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this try-catch work with the magic static? If the try fails, is isElevated permanently stuck as false?

(Also, is this even a valid concern? Does Application::Current fail often?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does Application::Current fail often

literally only in the tests, because Application::Current isn't a TerminalApp::App in the tests. With the magic static, we catch the exception as it's getting initialized, return false, and then put false in the static member to store forever

Copy link
Contributor

@Rosefield Rosefield Sep 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now AppLogic just sets a member on itself already when it is created, but also the implementation of IsUserAdmin doesn't actually rely on any part of AppLogic's state. Would it make sense to then make a free function/static function IsElevated somewhere else that could just be used directly without multiple layers of caching and indirection? As an optimization that IsElevated function could store a static member, should you choose to.

If that free function exists somewhere sufficiently up the stack, it could also be used for ApplicationState :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW there's one of my many branches hanging around that does this. I think it's going to get looped in to #11222 when I bump that next (hopefully today, likely monday tho)

@carlos-zamora
Copy link
Member

Don't forget to update the docs/schema!

@zadjii-msft
Copy link
Member Author

Don't forget to update the docs/schema!

image

frick I did, just didn't push lol

@DHowett
Copy link
Member

DHowett commented Sep 16, 2021

I think this breaks max and min width in showTabsInTitlebar=false mode.

CanReorderTabs="True"
IsAddTabButtonVisible="false"
TabWidthMode="Equal">
<StackPanel Orientation="Horizontal">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

protip: ignore whitespace for this file

@zadjii-msft
Copy link
Member Author

I think this breaks max and min width in showTabsInTitlebar=false mode.

What the devil, this is broken even for unelevated, tabsInTitlebar windows:
image

@zadjii-msft
Copy link
Member Author

image

WEIRD WEIRD WEIRD

If you do it with a StackPanel, the StackPanel will overflow without a care in the world.

If you do it with a Grid though, then it will obey the MaxWidth. Weird.

@zadjii-msft zadjii-msft added the Needs-Second It's a PR that needs another sign-off label Sep 20, 2021
Copy link
Member

@lhecker lhecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Let me know if you want to leave it as it is and I'll approve it.

src/cascadia/TerminalApp/TabRowControl.xaml Outdated Show resolved Hide resolved
@@ -32,6 +32,7 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ This. 😄

src/cascadia/TerminalApp/TerminalPage.cpp Show resolved Hide resolved
Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to the comments, the spacing feels a bit cramped to me. cc @cinnamon-msft for design oversight, but in the meantime... I wonder if it should have equal padding on the four sides compared to the tab itself.

I know -- the TabView has its own padding, which means that we need to pad the UAC shield asymmetrically to make up for it

@@ -715,4 +715,7 @@
<data name="InfoBarDismissButton.Content" xml:space="preserve">
<value>Don't show again</value>
</data>
<data name="ElevationShield.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>This Terminal window is running as an Administrator</value>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wording here feels off... but I cannot figure out why.,

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • "This Terminal window is running with elevated permissions"?
  • "This Terminal window is running in High-IL"
  • "This Terminal window is running as Admin"
  • "This Terminal window is running elevated"
  • "This Terminal window has elevated permissions"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fond of this one.

Suggested change
<value>This Terminal window is running as an Administrator</value>
<value>This Terminal window is running as Admin</value>

src/cascadia/TerminalApp/TabRowControl.xaml Outdated Show resolved Hide resolved
@@ -32,6 +32,7 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes plz

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Sep 20, 2021
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Sep 20, 2021
@zadjii-msft
Copy link
Member Author

Came up with a better solution:
image

Totally forgot about TabView.TabStripHeader, which is exactly what it sounds like, and does exactly what we want.

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LES DO DIS

@@ -715,4 +715,7 @@
<data name="InfoBarDismissButton.Content" xml:space="preserve">
<value>Don't show again</value>
</data>
<data name="ElevationShield.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>This Terminal window is running as an Administrator</value>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fond of this one.

Suggested change
<value>This Terminal window is running as an Administrator</value>
<value>This Terminal window is running as Admin</value>

@DHowett
Copy link
Member

DHowett commented Sep 22, 2021

qq, should we make it less "bright"? right now it's the primary text color which is very bright on dark displays; we could tone it down a bit to maybe the SystemAltMediumColor?

@zadjii-msft
Copy link
Member Author

qq, should we make it less "bright"? right now it's the primary text color which is very bright on dark displays; we could tone it down a bit to maybe the SystemAltMediumColor?

ez

@miniksa
Copy link
Member

miniksa commented Sep 22, 2021

image

WEIRD WEIRD WEIRD

If you do it with a StackPanel, the StackPanel will overflow without a care in the world.

If you do it with a Grid though, then it will obey the MaxWidth. Weird.

#justxamlthings

@miniksa
Copy link
Member

miniksa commented Sep 22, 2021

In this one, the shield looks a few pixels too high:
image

In this one, the shield looks a few pixels too low:
image

I feel like it should be centered on the same vertical center line as the content of the tab...

@zadjii-msft zadjii-msft added the AutoMerge Marked for automatic merge by the bot when requirements are met label Sep 22, 2021
@ghost
Copy link

ghost commented Sep 22, 2021

Hello @zadjii-msft!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

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 (@msftbot) and give me an instruction to get started! Learn more here.

@DHowett
Copy link
Member

DHowett commented Sep 22, 2021

Do tend to agree about the spacing! fix it in post?

@DHowett DHowett removed the Needs-Second It's a PR that needs another sign-off label Sep 22, 2021
@ghost ghost merged commit 171e0a0 into main Sep 23, 2021
@ghost ghost deleted the dev/migrie/f/uac-shield branch September 23, 2021 17:44
@ghost
Copy link

ghost commented Oct 20, 2021

🎉Windows Terminal Preview v1.12.2922.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI Styling to Clearly Indicate Elevated (admin) Window
7 participants