My main machine is Windows. I don't want my hand to move away from the home position when I press the cursor keys or function keys, so I use AutoHotkey to set it so that I don't have to leave the home position as much as possible.
Related article: -I want to withdraw to the home position of the Japanese keyboard with AutoHotKey -Google search anytime, anywhere with Autohotkey
Recently, I have more opportunities to use Kali Linux, but since Linux does not have AutoHotkey, keyboard operation was troublesome. However, by using software called AutoKey, we were able to achieve something similar to AutoHotkey, such as being able to move the cursor without taking your hands off the home position and being able to perform a Google search with zero mouse operation.
I know there is no demand, but I'm a person who loves keyboard metamorphosis settings, so I'll write it here. The version of Kali Linux is 2020.2.
--I want to move the cursor up / down / left / right by pressing "Convert" and the h, j, k, l keys (any of them) at the same time (← achieved) --I want to delete one line, BackSpace, Delete by pressing "Convert" and the b, n, m keys (any one) at the same time (← achieved) --I want to convert full-width kana, full-width kana, half-width kana, and half-width alphanumeric characters by pressing "no conversion" and h, j, k, l (any of) at the same time (F7 to F10 conversion when inputting Japanese). Same as) (← achieved) --I want to move Chrome tabs with Alt + 1,2 (either) (← achieved) ――I want to switch between Japanese input and direct input just by "no conversion" (← not achieved)
AutoKey creates shortcut keys with 6 types of modifier keys, Ctrl, Alt, Shift, Super, Hyper, and Meta, and other key combinations. Super is a Windows key. It seems to be called Super in the Linux world. Hyper, Meta are modifier keys found in old special keyboards and are not found in today's popular keyboards. Also, since Autokey does not support Japanese keyboards, it does not support special keys such as "convert" and "no conversion". If Hyper and Meta are not used, and "Conversion" and "No conversion" cannot be used, you should be able to do what you want by assigning "Conversion" to Hyper and "No conversion" to Meta. ..
Use xkb (X Keyboard Extension) to change this key binding. First, check the current behavior of xkb (the target to read the configuration file) with "set xkbmap -print".
$ sudo setxkbmap -print -verbose 10
It seems that 3 files "pc", "jp" and "inet" in the "/ usr / share / X11 / xkb / symbols" folder are being read.
I'm reading three files, but this time I'm only editing "inet". Edit after backup.
$ sudo cp /usr/share/X11/xkb/symbols/inet /usr/share/X11/xkb/symbols/inet_bak
$ sudo vi /usr/share/X11/xkb/symbols/inet
There are two places to edit,
Modify "Henkan" in \
When you're done saving and exiting, clear the xkb cache.
$ sudo rm -rf /var/lib/xkb/*
Then restart Kali Linux.
It's finally AutoKey's work. If nothing else, let's install it first.
$ sudo apt install autokey-gtk
Cut the folder from "New" in the upper left (you can do it later). I created three subfolders under the folder "MySettings": "browser", "cursor" and "input_conversion".
This time, we will create a setting to move the cursor to the left when "Convert" and "h" are pressed at the same time. Select Script from New and enter a name.
Press the "Set" button in the "Hotkey" line.
Press the "Press to Set" button, press the "h" key, and press the "Hyper" button.
It has been set.
Enter the following in the script input field at the top right of the screen.
Click the "Save" button to save your input.
Now, pressing "Convert" and "h" at the same time will move the cursor to the left. Follow the same procedure to create up / down / left / right, Delete, BackSpace, etc. Set the hotkey as you like. Please refer to here for the names of special keys such as cursor keys and control keys. autokey - SpecialKeys.wiki
If h, j, k, l are set to move up / down / left / right, "Hyper" + "l" will be batting with "log off" set in the OS, so delete this. Select the Settings> Keyboard> Application Shortcut Keys tab.
Delete this line.
Setup is completed.
cursor
Move cursor left Hyper+h left.py
keyboard.send_keys("<left>")
Move cursor to the right Hyper+l right.py
keyboard.send_keys("<right>")
Move on cursor Hyper+k up.py
keyboard.send_keys("<up>")
Move down the cursor Hyper+j down.py
keyboard.send_keys("<down>")
delete.py Hyper+n
keyboard.send_keys("<delete>")
backspace.py Hyper+m
keyboard.send_keys("<backspace>")
Delete one line Hyper+b line_delete.py
keyboard.send_keys("<home>")
keyboard.send_keys("<shift>+<end>")
keyboard.send_keys("<delete>")
Hiragana Meta+h hiragana_zen.py
keyboard.send_keys("<f6>")
Katakana full-width Meta+j katakana_zen.py
keyboard.send_keys("<f7>")
Katakana half-width Meta+k katakana_han.py
keyboard.send_keys("<f8>")
Alphabet Meta+l alphabet.py
keyboard.send_keys("<f10>")
Left tab move ctrl+1 chrome_lefttab.py
keyboard.send_keys("<ctrl>+<page_up>")
Move right tab ctrl+2 chrome_righttab.py
keyboard.send_keys("<ctrl>+<page_down>")
Google search meta+g chrome_search.py (Focus on the address bar. Chrome must be running)
window.activate("Chrome")
keyboard.send_keys("<ctrl>+l")
Actually, I wanted to switch between Japanese input and direct input only with "No conversion", but I couldn't because I set "No conversion" to Meta. I think I'll substitute ctrl + space.
-** Part 2 ** By assigning Meta to "no conversion", you can now grab the window with "no conversion". It may be convenient for soberness.
-** Part 3 ** The processing code seems to be Python, so I think anyone who can write Python can do more advanced things.
-[Ubuntu: How to convert non-conversion / conversion key to Meta / Hyper key and make it a modifier key that can be customized with AutoKey](https://did2memo.net/2015/07/19/ubuntu-xkb-muhenkan-henkan- meta-hyper /) Thank you very much for your help. Thank you very much.
Recommended Posts