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

Open Windows context menu using Shift+RClick #353

Open
1 task done
kwyntes opened this issue Mar 20, 2023 · 2 comments
Open
1 task done

Open Windows context menu using Shift+RClick #353

kwyntes opened this issue Mar 20, 2023 · 2 comments
Labels
enhancement Enhancement to existing functionality p:2 Priority 2

Comments

@kwyntes
Copy link

kwyntes commented Mar 20, 2023

Preflight Checklist

Problem Description

It's already tedious enough not being able to use just the keyboard to perform actions, and having to click through two menus just to edit a script file (since simply opening it will execute it) is even worse.

Right now to access the Windows context menu, for example to "Edit with Notepad++", one has to first right click on the search results, then click show more options, then click the desired option.

Proposed Solution

Shift+right click (or a different shortcut if shift+right click would cause issues for whatever reason) would skip the context menu implemented by this app and go straight into the Windows context menu.

Alternatives Considered

Another solution I thought of is to implement the option to add custom shortcuts to trigger custom actions, which would eliminate the need for context menus entirely. I figured this would be a lot more complicated to implement however, so I propose this simple solution instead.

Additional Information

No response

@srwi srwi added the enhancement Enhancement to existing functionality label Mar 21, 2023
@kwyntes
Copy link
Author

kwyntes commented Mar 23, 2023

Looking at the code it seems like this feature could be added by simply adding these two lines in EverythingToolbar/Controls/SearchResultsView.xaml.cs:

        private void OnContextMenuOpened(object sender, RoutedEventArgs e)
        {
+           if (Keyboard.Modifiers == ModifierKeys.Shift) {
+               return SelectedItem?.ShowWindowsContextMenu();
+           }
+
            ContextMenu cm = sender as ContextMenu;
            MenuItem mi = cm.Items[2] as MenuItem;

            string[] extensions = { ".exe", ".bat", ".cmd" };
            bool isExecutable = (bool)SelectedItem?.IsFile && extensions.Any(ext => SelectedItem.FullPathAndFileName.EndsWith(ext));

            if (isExecutable)
                mi.Visibility = Visibility.Visible;
            else
                mi.Visibility = Visibility.Collapsed;
        }

I don't know how to setup the development environment to test this out myself, but since it is such a simple change I'm fairly confident that this would work.

@srwi
Copy link
Owner

srwi commented Mar 23, 2023

Thank you for your effort!

Interestingly SelectedItem does not get updated when holding down the Shift or Control modifiers, so it will open the system context menu for the wrong search result. Using Alt causes the context menu to close right after opening. I think using Shift would be the correct way to do it though.

Currently I'm a little busy, but I'll look into it eventually. In the meantime, if you want to have a shot at it, feel free to have a look at the build instructions in the readme!

@srwi srwi changed the title Shift+right click (or something like that) to open the Windows context menu directly Open Windows context menu using Shift+RClick May 5, 2023
@srwi srwi added the p:2 Priority 2 label Sep 15, 2024
@srwi srwi removed the hacktoberfest label Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to existing functionality p:2 Priority 2
Projects
None yet
Development

No branches or pull requests

2 participants