lxqt / qterminal

A lightweight Qt-based terminal emulator
https://lxqt.github.io
GNU General Public License v2.0
595 stars 150 forks source link

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

Closed ishovkun closed 5 years ago

ishovkun commented 5 years ago
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
matrohin commented 5 years ago

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

tsujan commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

https://bugreports.qt.io/browse/QTBUG-49435?focusedCommentId=400096&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel

if i read it right it can be set in QAppliction

tsujan commented 5 years ago

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: https://github.com/lxqt/lxqt/issues/1426

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

agaida commented 5 years ago

bah :(

tsujan commented 5 years ago

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 commented 5 years ago

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

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

tsujan commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

I got global menu (kde) enabled and menu bar hidden. Therefore I couldn't use the workaround. I do not consider it resolved.

On Sat, Aug 3, 2019, 10:24 AM tsujan notifications@github.com wrote:

@agaida https://github.com/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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lxqt/qterminal/issues/485?email_source=notifications&email_token=ACVDG73HYAIYAN35OFGFXT3QCW5M3A5CNFSM4FXPNMQ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3PSPRQ#issuecomment-517941190, or mute the thread https://github.com/notifications/unsubscribe-auth/ACVDG7YZBG6QDA7TV4GFGVLQCW5M3ANCNFSM4FXPNMQQ .

agaida commented 5 years ago

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

agaida commented 5 years ago

i want a wish-list label everywhere

tsujan commented 5 years ago

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 commented 5 years ago

Even when "show menu bar" is unchecked the plasma global menu still shows the menu bar. So the workaround is useless. I guess the qtermnal devs shouldn't really care if the app is misused on other DEs.

Then the issue should indeed be closed provided there is a note on this behavior in the manual.

On Sat, Aug 3, 2019, 11:02 AM tsujan notifications@github.com wrote:

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 https://github.com/agaida Konsole has removed & from its menu-bar. I don't think anything can be done here. This page will remain open until eternity ;)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lxqt/qterminal/issues/485?email_source=notifications&email_token=ACVDG76IXJ2U2LVFZBQATNLQCXB25A5CNFSM4FXPNMQ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3PTBYY#issuecomment-517943523, or mute the thread https://github.com/notifications/unsubscribe-auth/ACVDG7YFHASKQHLG4KZQ77LQCXB25ANCNFSM4FXPNMQQ .

tsujan commented 5 years ago

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 commented 5 years ago

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 https://github.com/lxqt/qterminal/pull/139. IMO, https://github.com/lxqt/qterminal/pull/139 was a mistake for a terminal emulator.

Please note that if https://github.com/lxqt/qterminal/pull/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 commented 5 years ago

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

agaida commented 5 years ago

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

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 commented 5 years ago

@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. https://github.com/lxqt/qterminal/pull/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 commented 5 years ago

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 commented 5 years ago

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

agaida commented 5 years ago

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

tsujan commented 5 years ago

Me? Cursing?

In this case, it was the right thing to do… but not anymore: https://github.com/lxqt/qterminal/pull/604

preferences

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

agaida commented 5 years ago

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

tsujan commented 5 years ago

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

tsujan commented 5 years ago

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 commented 5 years ago

Maybe accelerators should be off by default

tsujan commented 5 years ago

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 commented 5 years ago

ah, cool, don't noticed it

tsujan commented 5 years ago

@yan12125 If you see this please also answer to https://github.com/lxqt/qterminal/issues/485#issuecomment-517934137 . I have a simple workaround for it.

yan12125 commented 5 years ago

tsujan notifications@github.com 於 2019年8月19日 週一 上午12:07寫道:

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

Oops, I thought I've replied that. Yes I can reproduce the issue with Qt 5.13. Out of curiousity - what's the workaround?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

tsujan commented 5 years ago

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.