tidy up keyboard key swap

This commit is contained in:
Malin Freeborn 2025-02-07 17:42:10 +01:00
parent 8b7912a68f
commit 5e703a65c0
Signed by: andonome
GPG Key ID: 52295D2377F4D70F
3 changed files with 65 additions and 105 deletions

65
hardware/keyboard.md Normal file
View File

@ -0,0 +1,65 @@
---
title: "keyboard"
tags: [ "Documentation", "keyboard", "vim" ]
---
# System-Wide Capslock and Escape Swap
This works everywhere, including in a bare-ass tty.
Select a keymap, and create a new custom map.
```bash
su root
basemap=/usr/share/kbd/keymaps/i386/qwerty/pl1.map.gz
newmap=/usr/share/kbd/keymaps/custom.map.gz
gunzip -c $basemap | \
sed 's/Caps_Lock/\n/g;s/Escape/Caps_Lock/g;s/\n/Escape/g' | \
gzip > $newmap
```
Tell the system to use this keymap at startup by naming it in the `rc.conf` file:
```bash
echo "KEYMAP=$newmap" >> /etc/rc.conf
cat /etc/rc.conf
reboot
```
# Set Layout with X Display
Set layout to British English.
```bash
setxkbmap -layout gb
```
Or Polish with:
```bash
setxkbmap -layout pl
```
| Language | short |
|:--------|:------|
| Polish | pl |
| Serbian | rs |
Set 'alt + shift', as the command which cycles through the British English, Polish and Serbian keyboard layout.
```bash
setxkbmap -layout gb,pl,rs -option grp:alt_shift_toggle
```
## Alt_GR
Remap, e.g., the right Windows key, to Alt_Gr.
```
key <RWIN> {[ ISO_Level3_Shift ]};
```

View File

@ -1,68 +0,0 @@
---
title: "keyboard"
tags: [ "Documentation", "keyboard" ]
---
# Set Layout with X Display
Set layout to British English.
```bash
setxkbmap -layout gb
```
Or Polish with:
```bash
setxkbmap -layout pl
```
| Language | short |
|:--------|:------|
| Polish | pl |
| Serbian | rs |
Set 'alt + shift', as the command which cycles through the British English, Polish and Serbian keyboard layout.
```bash
setxkbmap -layout gb,pl,rs -option grp:alt_shift_toggle
```
## Alt_GR
Remap, e.g., the right Windows key, to Alt_Gr.
```
key <RWIN> {[ ISO_Level3_Shift ]};
```
# Set TTY Keymap
Copy your keymap, e.g. if it's polish-1, then:
```bash
cp /usr/share/kbd/keymaps/i386/qwerty/pl1.map.gz /usr/share/kbd/keymaps/*custom*.map.gz
```
Then change that map:
```bash
sudo vim /usr/share/kbd/keymaps/custom.map.gz
```
---
You can switch Escape and Caps Lock with a single line:
```bash
sudo sh -c "gunzip -c /usr/share/kbd/keymaps/i386/qwerty/pl1.map.gz | sed 's/ Escape/ PLACEHOLDER/ ; s/Caps_Lock/Escape/g ; s/PLACEHOLDER/Caps_Lock/' | gzip > /usr/share/kbd/keymaps/custom.map.gz"
```
---
Change the default keyboard mapping to the custom map:
```bash
echo 'KEYMAP="/usr/share/kbd/keymaps/*custom*.map.gz"' | sudo tee /etc/vconsole.conf
```
Reboot to have changes take effect.

View File

@ -1,37 +0,0 @@
☢ ☣ s ☠ ⚠
radioactive sign biohazard sign skull and crossbones warning sign
☤ ⚕ ⚚ †
caduceus staff of aesculapius staff of hermes dagger
☯ ⚖ ☮ ⚘
yin yang scales peace flower
⚔ ☭ ⚒ ⚓
crossed swords hammer and sickle hammer and pick anchor
⚛ ⚜ ⚡ ⚶
atom symbol fleur-de-lis lightning vesta
☥ ✠ ✙ ✞
ankh cross cross cross
✟ ✧ ⋆ ★
cross diamond star star
☆ ✪ ✫ ✬
star star star star
✭ ✮ ✯ ✰
star star star star
☸ ✵ ❂ ☘
wheel of dharma star sun shamrock
♡ ♥ ❤ ⚘
heart heart big heart flower
❀ ❃ ❁ ✼
flower flower flower flower
☀ ✌ ♫ ♪
sun V sign music note / melody music note / melody
☃ ❄ ❅ ❆
snowman snowflake snowflake snowflake
☕ ☂ ❦ ✈
cofee umbrella floral heart / leaf airplane
♕ ♛ ♖ ♜
white king / crown black king / crown white rook / tower black rook / tower
☁ ☾
cloud waning crescent moon