0

Someone sent me over here from the main page, original post

I've got a Royal Kludge RK61 (60%) keyboard that has different modes depending on a few different combinations of Fn+Enter / Ctrl / Windows. Unfortunately, there is no actual indication as to which mode the keyboard has selected in any way. I'm looking to change that with my extremely limited bash knowledge by implementing a notification upon key press.

I checked xev which didn't recognize the 61's Fn, however my laptops Fn did register. I ended up using the Fn key keysym code from my laptops keyboard and incorporated it below.

I found some code that seems it would do what I want, but I think my incorporation of the data needed is flawed, or wrong even as I'm extremely green.

#!/bin/bash

while true; do
read $key input
if [ "$input" = "keysym 0x1008ff2b" + "keysym 0xff0d" ]; then
    notify-send -u normal -i $HOME/Downloads/keyboard_icon.jpeg "Keyboard is now in Function mode:" " Arrow Keys on"
fi
done

How do I ensure that it would be executed without needing the console open if this is even correct? Further more, with the 60%'s Fn not registering in xev, what am I supposed to do?

2
  • Does this answer your question? xmodmap for key combination - how to toggle the Fn behavior? Commented Jan 16, 2021 at 8:55
  • I suppose it does for half of the question. Realizing now that I've left this in two parts, I'll make a new post with a less rough draft of the bigger question. Thank you very much. Commented Jan 16, 2021 at 16:45

1 Answer 1

0

The Fn key is non-standard. Many Laptops process it in the Embedded Controller, and every vendor does it differently. If something is programmable, it's hidden behind a vendor-specific protocol that the vendor doesn't bother to publish.

So the best you can hope for is to have a look at what Fn does on a specific computer, which normally means finding out what (sequence of) key presses and releases it gets translated to, and somehow act on that (with the possible source of error that a similar sequence produced by using other keys will also cause the action).

In particular, this

I checked xev which didn't recognize the 61's Fn, however my laptops Fn did register. I ended up using the Fn key keysym code from my laptops keyboard and incorporated it below.

won't work.

In some cases looking at the kernel input layer can also help, run evtest on the right /dev/input/eventX file (use the symlinks of appropriate) and see if it does in your case. Reading from this file also doesn't require the console to be open.

Once you've figured this out, you can think about which tools to use to do your action, depending on what this action is supposed to be, and if you can do it on the X layer.

4
  • This got me hopeful, but once again the FN key doesnt register. If I was to reach out to the manufacturer, are they likely to release the information to me that I need? Thanks for your reply and thank you for introducing me to evtest. Commented Jan 23, 2021 at 18:20
  • I would be extremely surprised if the FN key would have registered. I would also be extremely surprised if the manufacturer gave you information. If he does, please make it publicly accessible somehow, if you are allowed to; or at least make what you did with it publicly accessible. Commented Jan 23, 2021 at 19:41
  • Update: I reached out to the company. Turns out their support team doesn't get access to the type of information needed and can't give me an alternative. Guess I'm stuck for now. Commented Feb 15, 2021 at 18:29
  • That was to be expected... Commented Feb 15, 2021 at 20:28

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.