Skip to content

Launch elevated Terminal profile without a keyboard #14517

Closed

Description

Description of the new feature/enhancement

Today, there is no way to launch an elevated Terminal profile end-to-end without the need to use a keyboard.

Even without a physical keyboard, the user flow is still the same with a on-screen keyboard:

  1. Launch Terminal
  2. Ctrl + Click the profile you want to open

This Feature Request proposes a way for a user to open an elevated Terminal profile without the need to use a keyboard.
This is a very common Accessibility scenario.
The user should be able to launch an elevated Terminal profile with just a touch screen and / or mouse.

For more details see: https://twitter.com/SBarizien/status/1599769771666391042

Activity

  1. ghost added
    Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
    on Dec 8, 2022
  2. ghost added
    Needs-Tag-FixDoesn't match tag requirements
    on Dec 8, 2022
  3. changed the title [-]Open elevated Terminal profile without a keyboard[/-] [+]Launch elevated Terminal profile without a keyboard[/+] on Dec 8, 2022
  4. zadjii-msft commented on Dec 9, 2022

    @zadjii-msft
    Member

    Were there any suggestions for how to do that?

    The only thing I could think of was some default nested actions for opening a new elevated profile in the Command Palette. Trick here is the wording - we don't want to open a new window always, but we'll need to if the terminal isn't already elevated.

    Maybe just "Open Elevated > {profiles}"?

  5. 237dmitry commented on Dec 9, 2022

    @237dmitry

    As a workaround you can elevate current profile or execute command in elevated state with gsudo via UAC confirmation.

  6. DHowett commented on Dec 9, 2022

    @DHowett
    Member

    Mike Griese (@zadjii-msft) I thought of this, which is everyone's favorite UI:

    image

    It's a right-click menu item with a right-click menu. It also works with touch (touch-hold-release!)

  7. DHowett commented on Dec 9, 2022

    @DHowett
    Member

    If we did that, we could also put the splits in it...!

  8. zadjii-msft commented on Dec 9, 2022

    @zadjii-msft
    Member

    can we add right click context menus to menu flyouts?

  9. DHowett commented on Dec 9, 2022

    @DHowett
    Member

    I gave it a shot in XAML Studio!

    image

            <Rectangle Width="100" Height="100" Fill="Yellow">
                <Rectangle.ContextFlyout>
                    <MenuFlyout>
                        <MenuFlyoutItem Text="First" />
                        <MenuFlyoutItem Text="Second">
                            <MenuFlyoutItem.ContextFlyout>
                                <MenuFlyout>
                                    <MenuFlyoutItem Text="Well I'll Be..." />
                                </MenuFlyout>
                            </MenuFlyoutItem.ContextFlyout>
                        </MenuFlyoutItem>
                    </MenuFlyout>
                </Rectangle.ContextFlyout>
            </Rectangle>
  10. zadjii-msft commented on Dec 9, 2022

    @zadjii-msft
    Member

    Damn, yea let's do that. ez.

  11. added
    Issue-TaskIt's a feature request, but it doesn't really need a major design.
    good first issueThis is a fix that might be easier for someone to do as a first contribution
    and removed
    Issue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.
    on Dec 9, 2022
  12. 10 remaining items

  13. michalnpl commented on Apr 21, 2023

    @michalnpl
    Contributor

    Sure Mike Griese (@zadjii-msft) here is the branch

    Don't forget to regenerate resources (added items to .resw).

    Interestingly Shift+F10 (shortcut to invoke context menu) opens the context menu in the right place while right-clicking on the item opens it completely misaligned.

  14. zadjii-msft commented on May 17, 2023

    @zadjii-msft
    Member

    michalnpl Sorry this got lost in my list of open tabs 😅

    I'm betting that it's something with

            runAsAdminContextMenu.ShowAt(profileMenuItem);

    Like, I'd hope that works. But I'd bet that XAML islands does something weird with flyouts like that. I know there were issues with DPI scaling of mouse events in XAML islands before, so I wouldn't be surprised here.

    This might be a crazy idea, but I bet you could just manually ask XAML to show the flyout at the cursor position. Something like:

    void TermControl::_showContextMenuAt(const til::point& controlRelativePos)
    {
    Controls::Primitives::FlyoutShowOptions myOption{};
    myOption.ShowMode(Controls::Primitives::FlyoutShowMode::Standard);
    myOption.Placement(Controls::Primitives::FlyoutPlacementMode::TopEdgeAlignedLeft);
    myOption.Position(controlRelativePos.to_winrt_point());
    // The "Select command" and "Select output" buttons should only be
    // visible if shell integration is actually turned on.
    const auto shouldShowSelectCommand{ _core.ShouldShowSelectCommand() };
    const auto shouldShowSelectOutput{ _core.ShouldShowSelectOutput() };
    SelectCommandButton().Visibility(shouldShowSelectCommand ? Visibility::Visible : Visibility::Collapsed);
    SelectOutputButton().Visibility(shouldShowSelectOutput ? Visibility::Visible : Visibility::Collapsed);
    SelectCommandWithSelectionButton().Visibility(shouldShowSelectCommand ? Visibility::Visible : Visibility::Collapsed);
    SelectOutputWithSelectionButton().Visibility(shouldShowSelectOutput ? Visibility::Visible : Visibility::Collapsed);
    (_core.HasSelection() ? SelectionContextMenu() :
    ContextMenu())
    .ShowAt(*this, myOption);

    but instead of a "control-relative position", use CoreWindow::GetForCurrentThread().PointerPosition(). That's my thought at least.

  15. michalnpl commented on May 25, 2023

    @michalnpl
    Contributor

    Mike Griese (@zadjii-msft) No worries. I thought about it but abandoned the idea because it seems like this should be handled correctly by XAML, and I am also afraid I'll miss some edge cases, or it will not be future-proof if I handle it manually. The proposed code seems to be doing the correct thing but the framework is acting unexpectedly. Perhaps there is a way to have the XAML team look at this?

  16. jamespack commented on Jul 8, 2023

    @jamespack
    Contributor

    I may take a stab at this if nobody is working it.

  17. jamespack commented on Jul 8, 2023

    @jamespack
    Contributor
    image image

    Which alignment do we want? I can show screenshots of all of them if you'd want to see them all

  18. jamespack commented on Jul 8, 2023

    @jamespack
    Contributor

    I kinda like this one.

    image
  19. jamespack commented on Jul 8, 2023

    @jamespack
    Contributor

    Do we have a preference on which Icon we use for the LUA shield?
    image

  20. jamespack commented on Jul 8, 2023

    @jamespack
    Contributor

    Or this guy?

    image
  21. moved this from Walkthrough in issue to Done in Terminal Walkthroughson Jul 20, 2023
  22. added a commit that references this issue on Sep 22, 2023
    037b362
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-UserInterfaceIssues pertaining to the user interface of the Console or TerminalHelp WantedWe encourage anyone to jump in on these.In-PRThis issue has a related PRIssue-TaskIt's a feature request, but it doesn't really need a major design.Needs-Tag-FixDoesn't match tag requirementsProduct-TerminalThe new Windows Terminal.good first issueThis is a fix that might be easier for someone to do as a first contribution

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions