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

Cannot disable menu helpers (Alt-f, Alt-h, etc.) #485

Closed
ishovkun opened this issue Sep 27, 2018 · 35 comments · Fixed by #604
Closed

Cannot disable menu helpers (Alt-f, Alt-h, etc.) #485

ishovkun opened this issue Sep 27, 2018 · 35 comments · Fixed by #604

Comments

@ishovkun
Copy link

Expected Behavior

I should be able to use keys, such as Alt-f and Alt-h to control my shell as opposed to controlling qterminal. Fast access to the terminal menu entries is a secondary task.

Current Behavior

Cannot disable menu helpers such as Alt-f, Alt-h.

Possible Solution

Either introduce an option to disable the menu helpers, or simple disable them.

Steps to Reproduce (for bugs)
  1. Open Qterminal.
  2. Type some text.
  3. Go to the beginning of the line.
  4. Press Alt-f to jump forward.
Context

I want to use normal emacs-style shell navigation, among other things.

System Information
  • Distribution & Version: Manjaro KDE testing
  • Kernel: 4.17
  • Qt Version: 5.11.1
  • libqtxdg Version:
  • qtermwidget Version: 0.9.0
  • lxqt-build-tools Version:
  • Package version: qterminal 0.9.0
@matrohin
Copy link

matrohin commented Aug 3, 2019

Hello!
I had the same issue and I solved it by disabling menu bar (#41 )
Tested version: 0.14.1 (installed from sources)

@tsujan
Copy link
Member

tsujan commented Aug 3, 2019

They're called "mnemonics" and I'm not sure how popular they are (I never use them in any app). They can be removed easily in the app code (ui files); I think it's a good idea to remove them from QTerminal's menubar, at least. @yan12125, what do you think?

BTW, KDE has a "feature" that's sometimes called "auto-mnemonics", so that even if "&" is removed from the ui files, KDE will add it! However, that's not our problem.

@matrohin
Copy link

matrohin commented Aug 3, 2019

It was made on purpose at #139. So, maybe some people use it.
For me it's ok to have menu bar disabled (hidden). I rarely use it.
If I really need it I will do Ctrl+Shift+M (toggle menu bar visibility), then Alt+<letter> to access it.

@agaida
Copy link
Member

agaida commented Aug 3, 2019

One should be able to toggle them on and off as they might interfere with applications that we don't know or don't care of.

@matrohin - we refinded the shortcuts several times but will be still busted if a certain application don't follow some commons.

@tsujan
Copy link
Member

tsujan commented Aug 3, 2019

One should be able to toggle them on and off

I agree but there's no clean Qt method for that, as far as I know. Once you add "&" to a text, the mnemonic will be activated for its button/menubar-item/menu-item.... It's possible to change texts on the fly but I haven't seen that in any app.

@agaida
Copy link
Member

agaida commented Aug 3, 2019

@tsujan
Copy link
Member

tsujan commented Aug 3, 2019

If you mean Qt::AA_DontShowShortcutsInContextMenus, it's about shortcuts in right-click menus. Its corresponding platform value, i.e. QPlatformTheme::ShowShortcutsInContextMenus was a total mess when introduced in Qt 5.10: its name said about context menus but its default value caused this problem: lxqt/lxqt#1426

Anyhow, Qt::AA_DontShowShortcutsInContextMenus isn't about alt+....

@agaida
Copy link
Member

agaida commented Aug 3, 2019

bah :(

@tsujan
Copy link
Member

tsujan commented Aug 3, 2019

VERY UNRELATED AND OFF TOPIC but please test:

@agaida, @yan12125, ... If you have Qt 5.13, please open QTerminal Preferences → Shortcuts and try to create a shortcut that starts with Meta. Here, garbage appears before Meta+.... Can you see that?

@agaida
Copy link
Member

agaida commented Aug 3, 2019

https://doc.qt.io/qt-5/qkeysequence.html#qt_set_sequence_auto_mnemonic - next try 😎

@tsujan - must upgrade my arch, had not much time for lately

@tsujan
Copy link
Member

tsujan commented Aug 3, 2019

https://doc.qt.io/qt-5/qkeysequence.html#qt_set_sequence_auto_mnemonic - next try 

Will see it later.

@tsujan - must upgrade my arch, had not much time for lately

No problem. I'm sure @yan12125 has Qt 5.13. Here it happens with any app that has a shortcut editor of any kind: QTerminal, Screengrab, FeatherPad.... :( A new bug in Qt 5.13?

@tsujan
Copy link
Member

tsujan commented Aug 3, 2019

@agaida

Very nice finding! I didn't know about it. qt_set_sequence_auto_mnemonic works (I tested it with FeatherPad).

But it can't be toggled on the fly; the app should be restarted. Moreover, Qt has an inconsistency about it: if it's set to false, the underlines will still be shown on pressing Alt, although Alt+... won't be consumed. I don't like that but it's tolerable.

Since there' s already a workaround, i.e. making the menubar invisible, I don't think we need to add an option for qt_set_sequence_auto_mnemonic.

IMHO, this can be closed.

@ishovkun
Copy link
Author

ishovkun commented Aug 3, 2019 via email

@agaida
Copy link
Member

agaida commented Aug 3, 2019

bah - let it rain brain onto github and forbid umbrellas - why it is not possible to create a global set of labels?

@agaida
Copy link
Member

agaida commented Aug 3, 2019

i want a wish-list label everywhere

@tsujan
Copy link
Member

tsujan commented Aug 3, 2019

I got global menu (kde) enabled and menu bar hidden.

The global menu replaces menu-bar, which means you haven't made the menu-bar invisible in the app; if you did, you wouldn't see it on Plasma panel.

@agaida Konsole has removed & from its menu-bar. I don't think anything else can be done here. This page will remain open until eternity ;)

@ishovkun
Copy link
Author

ishovkun commented Aug 3, 2019 via email

@tsujan
Copy link
Member

tsujan commented Aug 3, 2019

Even when "show menu bar" is unchecked the plasma global menu still shows
the menu bar.

Strange and interesting! I'd checked pcmanfm-qt and FeatherPad under Plasma, with plasma5-applets-window-appmenu; when their menubars were hidden, plasma5-applets-window-appmenu didn't show anything. Maybe, we use different Plasma widgets or the behavior is changed. In both cases, there should be a Plasma bug. I'll check it later.

@tsujan
Copy link
Member

tsujan commented Aug 3, 2019

OK, I checked Plasma and saw what @ishovkun said (it's a mess).

My conclusion:

Since this is a terminal emulator, the Konsole solution can be used, namely reversing a part of #139. IMO, #139 was a mistake for a terminal emulator.

Please note that if #139 is going to be reversed for menu-bar items, that should be done for all of them, not just for File, because &F may be used in translations of other menu-bar items.

@agaida
Copy link
Member

agaida commented Aug 3, 2019

not reversed, extended - and yes, it will be fugly.

@agaida
Copy link
Member

agaida commented Aug 4, 2019

To be honest: If some wide spread terminals can handle it we should be able to do so too 😎

And if it need some upstream bugs we should file them and work around if really needed. Having accelerators optional on the fly is legit, being able to change them on the fly is legit too. Or we agree that Qt isn't mature enough for "simple" tasks.

@tsujan
Copy link
Member

tsujan commented Aug 4, 2019

@agaida I took a look at your attached screenshot, saw "mate-terminal" in it and installed it. mate-terminal has the same issue -- and more ;) You can't use alt+f with it because alt+f opens the File menu.

The solution is VERY simple. We should remove menu-bar accelerators. #139 was done without due care in 2015.

Or we agree that Qt isn't mature enough for "simple" tasks.

As someone who has worked with GTK, Qt and a little EFL, I have the opposite view. Qt may make me angry from time to time, mostly because of Qt developer's inattention, that causes regressions (there are a few in 5.13). But, in practice, it has been mostly flexible. This isn't a Qt problem.

Uninstalling mate-terminal...

@agaida
Copy link
Member

agaida commented Aug 4, 2019

hmm - if you have a closer look at the applied screen shot - it should be possible to deactivate the accellerators completely. Should be the first hook in the keyboard shortcut settings - the upper one.

@tsujan
Copy link
Member

tsujan commented Aug 4, 2019

I saw it later and am trying to do the same thing :D Don't curse me if I fail.

@agaida
Copy link
Member

agaida commented Aug 4, 2019

Me? Cursing? Never. I'm far to shy ...

tsujan added a commit that referenced this issue Aug 4, 2019
Because `Alt+F` and some other shortcuts have meaning for a terminal emulator.

Fixes #485
@tsujan
Copy link
Member

tsujan commented Aug 4, 2019

Me? Cursing?

In this case, it was the right thing to do… but not anymore: #604

preferences

Please see if it works with localization too — I tested it without localization.

@agaida
Copy link
Member

agaida commented Aug 4, 2019

Apply, compile and installs just fine - and works for me™ too. @yan12125 - please test and if no objections, please merge. GTM

@tsujan
Copy link
Member

tsujan commented Aug 4, 2019

Oh, forgot to request a review from @yan12125! Doing it now...

@tsujan
Copy link
Member

tsujan commented Aug 4, 2019

Useful Bash Alt shortcuts that aren't consumed anymore: Alt+F (forward), Alt+B (backward), Alt+D (delete to the word end), Alt+T (swap -- rarely usable), ....

@agaida
Copy link
Member

agaida commented Aug 4, 2019

Maybe accelerators should be off by default

@tsujan
Copy link
Member

tsujan commented Aug 4, 2019

Maybe accelerators should be off by default

They are, in the patch. I also thought they shouldn't be enabled by default with a terminal emulator and added a tooltip for the new option.

@agaida
Copy link
Member

agaida commented Aug 4, 2019

ah, cool, don't noticed it

agaida pushed a commit that referenced this issue Aug 18, 2019
Because `Alt+F` and some other shortcuts have meaning for a terminal emulator.

Fixes #485
@tsujan
Copy link
Member

tsujan commented Aug 18, 2019

@yan12125 If you see this please also answer to #485 (comment) . I have a simple workaround for it.

@yan12125
Copy link
Member

yan12125 commented Aug 19, 2019 via email

@tsujan
Copy link
Member

tsujan commented Aug 19, 2019

Yes I can reproduce the issue with Qt 5.13.

Thanks! I wanted to be sure that it wasn't something else. I'd added a comment to https://bugreports.qt.io/browse/QTBUG-62102. Unfortunately, they think the problem is in QKeySequenceEdit, while the code of QKeySequenceEdit hasn't changed in 5.13.

what's the workaround?

A few lines of code for reimplementing QKeySequenceEdit::keyPressEvent.

Andersbakken pushed a commit to Andersbakken/qterminal that referenced this issue Mar 13, 2020
Because `Alt+F` and some other shortcuts have meaning for a terminal emulator.

Fixes lxqt#485
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants