helloSystem / Menu

Global menu bar written in Qt
43 stars 14 forks source link

Make it possbile to invoke Action Search by a command #8

Closed probonopd closed 3 years ago

probonopd commented 3 years ago

Make it possbile to invoke Action Search by a command. E.g., Ctrl-Shift-/

antony-jr commented 3 years ago

Ctrl + F might be natural for many users. This is totally possible and easy.

antony-jr commented 3 years ago

By Invoke the Action Search do you mean something like the KRunner? Or Just focus on the Action Search Text Bar?

probonopd commented 3 years ago

I'd say, just focus on the Action Search Text Bar.

Things like KRunner are nice but I'd assume that 99% of users will never even know that they exist, because they are hidden out of view unless you somehow magically happen to know that they exist, and how to bring them up. This is why I like to have a visible search box in the menu at all times - everyone will find it. (A tooltip could then show the shortcut used to focus in it.)

What do you think?

pongloongyeat commented 3 years ago

Ctrl + F might be natural for many users. This is totally possible and easy.

I doubt this would make sense as CTRL+F for many is to search for some text within a document. What would be do if our application is a PDF viewer for instance? Perhaps we should utilise the Win/Command key a bit more like Command+F.

antony-jr commented 3 years ago

Okay let's settle with Command + Space like in Macs.

probonopd commented 3 years ago

Can you explain me how to do it @antony-jr?

antony-jr commented 3 years ago

QShortcut is the class you are looking for. The combination for Meta and Key F is Qt::META + Qt::Key_F.

If I have time I will send a PR.

probonopd commented 3 years ago

Thing is, Alt-Space currently results in a window manager context menu popping up. Will QShortcut be able to override this?

antony-jr commented 3 years ago

Nope. You can't override keyboard shortcuts better to try a different one that is available.

probonopd commented 3 years ago

Or change the window manager configuration not to claim Alt-Space. I am doing this now. So Alt-Space is available for use by Qt.

probonopd commented 3 years ago

@antony-jr I have now configured the system so that Alt-Space is not intercepted by the window manager any more.

We'd need Alt-Space to make the Menubar the active application (I guess), and put the cursor into the search box. Doable?

antony-jr commented 3 years ago

@probonopd Yes. I think it is doable. But the problem is I can't test it to a full extent. I think I will install the BSD iso in VM and try it out.

EDIT: Because my distro also has shortcut for Alt+Space.

antony-jr commented 3 years ago

It seems that OpenSUSE Tumbleweed also has Alt+Space mapped to the KRunner which is Interesting.

probonopd commented 3 years ago

Found a solution Will be in the next build.

probonopd commented 3 years ago

Implemented in https://github.com/helloSystem/Menu/commit/6e3c0a5f41e49e0962e22e99da4a9798b105ee66

probonopd commented 3 years ago

Peek 2020-11-26 23-03