LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Keyboard shortcuts not recognized often (https://www.linuxquestions.org/questions/linux-newbie-8/keyboard-shortcuts-not-recognized-often-4175697992/)

teerex 07-20-2021 03:52 AM

Keyboard shortcuts not recognized often
 
Hello. I just started using Linux and chose to use KDE neon. I noticed one problem. When I use keyboard shortcuts to navigate and select text, they don't work that well.

One easy example is using Home and End keys on my laptop keyboard. I noticed that when I hold Fn key and press Home/End, it often ignores the shortcut completely.

For example, if I hold and keep holding Fn key and then quickly click Home, End, Home, End etc. Then there is no problem. The cursor jumps to the right position. But when I quickly press Fn and Home/End (hold down Fn for a short time before pressing Home/End), it has the problem.

Any ideas what to do about it? I would appreciate the help. Linux is the king of keyboard navigation. It is too bad it doesn't want to listen though :P

DavidMcCann 07-20-2021 10:22 AM

The Fn key on laptops has nothing to do with Linux — it's hard-wired, so you cannot configure it. When it's held down, the processor inside the keyboard will send different codes to the computer, like 110 (Home) instead of 113 (Left), so that's why you have to press both simultaneously. The computer doesn't even know the Fn key exists — it just sees the codes that the keyboard gives it.

teerex 07-20-2021 10:43 AM

Quote:

Originally Posted by DavidMcCann (Post 6268071)
The Fn key on laptops has nothing to do with Linux — it's hard-wired, so you cannot configure it. When it's held down, the processor inside the keyboard will send different codes to the computer, like 110 (Home) instead of 113 (Left), so that's why you have to press both simultaneously. The computer doesn't even know the Fn key exists — it just sees the codes that the keyboard gives it.

It must have something do to with Linux because I have never had this problem in Windows on the same laptop which I have been using for 5 years. As soon as installed and started using Linux, the keyboard just "won't listen". It fails like 1/5 times when I am using shortcuts to select text which is really annoying. I really hope there is some solution out there

boughtonp 07-20-2021 05:36 PM


 
Your description is confusing. The Fn key needs to be held down until you press the other key - similar to how you hold down shift to get uppercase letters and symbols (you can't just press and release shift then press A). If you are releasing Fn before pressing the other key, it will be as if you didn't press the Fn key.

This is the same on Windows and Linux, though it is possible that Windows had special software to allow the slight delay/stickyness you seem to be suggesting (maybe provided by the laptop manufacturer).
Also, if you're trying to select all text on a line (via Home,Shift-End), note that the order matters - there's a difference between (e.g.) Fn-Left,Shift-Fn-Right and Fn-Left,Fn-Shift-Right.

Anyhow, David is half-right - the Fn key is not a modifier (like Shift/Ctrl/Alt/Super keys), so when used it sends different keycodes to be sent than when not using it - afaict the OS doesn't get told which key you you are using in combination with Fn to cause a "Home" key press to be sent (some laptop keyboards use Left/Right, others use PgUp/PgDn, etc), but - at least on some computers - the Fn key itself does send an event when pressed and released (with keycode 151), meaning that you might be able to configure it to do what you want.

If you open a terminal, you can use "xev" to see incoming keyboard events (and confirm your Fn generates an event), then I think either "xmodmap" and/or "xbindkeys" are the relevant commands for changing things.


teerex 07-21-2021 11:49 AM

Quote:

Originally Posted by boughtonp (Post 6268239)
Your description is confusing. The Fn key needs to be held down until you press the other key - similar to how you hold down shift to get uppercase letters and symbols (you can't just press and release shift then press A). If you are releasing Fn before pressing the other key, it will be as if you didn't press the Fn key.

This is the same on Windows and Linux, though it is possible that Windows had special software to allow the slight delay/stickyness you seem to be suggesting (maybe provided by the laptop manufacturer).
Also, if you're trying to select all text on a line (via Home,Shift-End), note that the order matters - there's a difference between (e.g.) Fn-Left,Shift-Fn-Right and Fn-Left,Fn-Shift-Right.

Anyhow, David is half-right - the Fn key is not a modifier (like Shift/Ctrl/Alt/Super keys), so when used it sends different keycodes to be sent than when not using it - afaict the OS doesn't get told which key you you are using in combination with Fn to cause a "Home" key press to be sent (some laptop keyboards use Left/Right, others use PgUp/PgDn, etc), but - at least on some computers - the Fn key itself does send an event when pressed and released (with keycode 151), meaning that you might be able to configure it to do what you want.

If you open a terminal, you can use "xev" to see incoming keyboard events (and confirm your Fn generates an event), then I think either "xmodmap" and/or "xbindkeys" are the relevant commands for changing things.


It sounds to me that you are trying to blame me for not knowing how keyboard shortcuts work and how to press the keys correctly in order for them to work. As I said in the previous reply, I have NEVER had this problem on Windows using the exact same hardware that I am using on Linux at the moment. Just because I posted this in a newbie section you should not assume that it is the first day I am using a computer. Note that there is nothing wrong with my hardware either. When I boot back to Windows, the issue is gone. When I boot to Linux, the issue with the keys is there. I hope I have clarified the situation and we can continue the discussion.

I tried to use the xev command to explore what happens when I am pressing the keys.

If I hold down Fn key, then wait a second, then press Left and then release Left (Fn+Left=End on my keyboard), I get this output:

Code:

KeyPress event, serial 40, synthetic NO, window 0x8200001,
    root 0x7e0, subw 0x0, time 5437576, (-802,741), root:(451,778),
    state 0x0, keycode 115 (keysym 0xff57, End), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 40, synthetic NO, window 0x8200001,
    root 0x7e0, subw 0x0, time 5437785, (-802,741), root:(451,778),
    state 0x0, keycode 115 (keysym 0xff57, End), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

If I press Fn key, then wait a very short time, then press Left and release it, it starts to loop infinitely and spams this output:

Code:

KeyRelease event, serial 40, synthetic NO, window 0x8200001,
    root 0x7e0, subw 0x0, time 5795318, (162,-22), root:(1415,15),
    state 0x0, keycode 115 (keysym 0xff57, End), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 40, synthetic NO, window 0x8200001,
    root 0x7e0, subw 0x0, time 5795318, (162,-22), root:(1415,15),
    state 0x0, keycode 115 (keysym 0xff57, End), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 40, synthetic NO, window 0x8200001,
    root 0x7e0, subw 0x0, time 5795359, (162,-23), root:(1415,14),
    state 0x0, keycode 115 (keysym 0xff57, End), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 40, synthetic NO, window 0x8200001,
    root 0x7e0, subw 0x0, time 5795359, (162,-23), root:(1415,14),
    state 0x0, keycode 115 (keysym 0xff57, End), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

That's something interesting, ain't it? Does anyone have any ideas what it could be? Could that be some sort of bug or are there any settings that I could experiment with?


All times are GMT -5. The time now is 06:32 PM.