By default, AutoKey does not allow use of normal function keys as modifiers when creating hotkey shortcut keys. However it is easy to use Xmodmap utility built into most linux computers to remap one or more chosen function (or other) keys to use a one of the unused modifier keys.
Using xmodmap to allow remapping function keys to modifier key function for use with Autokey.
Goal - Use “F8“ & “=” to trigger python script using Autokey and xmodmap.
Why this particular combination?
It can be triggered with one hand
Very few of my programs use that combination.
Same principle would apply to other function keys or even normal keyboard keys.
Problem: Autokey only allows normal keys to be combined with 6 Special Keys:
Control
Alt
Shift
Super
Hyper
Meta
My solution:
Create a custom .Xmodmap file to remap my F8 key to Hyper_R key function, effectively turning a one of my normal Function keys into a hyper key.
Step-by-step how-to:
Install Autokey
Use xmodmap (CLI) to see if I have any free modifiers I can remap F8 key to Run Xev at command line to find out what keycode my F8 function key was sending (or use Xkeycaps) For example, F8 = keycode 74.
Run Xmodmap at the terminal to see if there were any unused modifiers. Sure enough, it seemed that mod3 was unused.
Created custom ~/.Xmodmap and placed it in my your home directory. It is only three lines. The first line clears mod3 (just to be sure it is not doing anything else), the second line assigns keycode 74 (my F8 key) to Hyper_R. A reboot may be necessary to make the new ~/.Xmodmap effective.*
clear mod3
keycode 74 = Hyper_R
add mod3 = Hyper_R
5. To load/reload configuration files, reboot*
*EDIT - a commenter (max kazakov) mentioned an alternative to rebooting is to simply
type 'xmodmap ~/.Xmodmap'
This applies changes immediately.
Now everything should be set up to create a custom Autokey script in the usual way. The only difference is now I can used my F8 key to trigger the Hyper key and combined it with a normal key, the equals (=) key.
Further references:
This video was inspired by this AutoKey forum thread:
https://groups.google.com/forum/#!top...
Xmodmap manual:
https://www.x.org/archive/current/doc...
More info about metakeys:
https://www.emacswiki.org/emacs/MetaK...
&
https://unix.stackexchange.com/questi...
&
https://askubuntu.com/questions/42362...
&
https://superuser.com/questions/13520...
On this page of the site you can watch the video online Linux AutoKey Keymapping to enable Function Key Modifiers using Xmodmap with a duration of hours minute second in good quality, which was uploaded by the user Open Doctor 07 October 2017, share the link with friends and acquaintances, this video has already been watched 15,857 times on youtube and it was liked by 137 viewers. Enjoy your viewing!