# various methods of setting key bindings

## We really should get 020_kmonad.sh working

```bash
# !/usr/bin/env zsh

# <https://thesynack.com/posts/persistent-capslock-behavior/>

DEST=${1:-/etc/skel}

# xmodmap

# cat <-'EOF' | tee ~/.Xmodmap

# # ! Swap caps lock and escape

# remove Lock = Caps_Lock

# keysym Escape = Caps_Lock

# keysym Caps_Lock = Escape

# add Lock = Caps_Lock

# EOF

#

# xmodmap ~/.Xmodmap

# cat <<-EOF | sudo tee ${HOME}/.config/autostart/xmodmap.desktop >/dev/null

# [Desktop Entry]

# Name=Xmodmap

# Exec=/usr/bin/xmodmap ${HOME}/.Xmodmap

# Terminal=false

# Type=Application

# X-GNOME-Autostart-enabled=true

# EOF

#

# chmod +x ~/.config/autostart/xmodmap.desktop

# Console tty

# cat <<-EOF | sudo tee loadkeys

# keycode 1 = Caps_Lock

# keycode 58 = Escape

# EOF

## current XKN settings

# setxkbmap -v 9

#

# Setting verbose level to 9

# locale is C

# Trying to load rules file ./rules/evdev

# Trying to load rules file /usr/share/X11/xkb/rules/evdev

# Success

# Applied rules from evdev

# rules: evdev

# model: pc104

# layout: gb

# options: caps:swapescape

# Trying to build keymap using the following components

# keycodes: evdev+aliases(qwerty)

# types: complete

# compat: complete

# symbols: pc+gb+inet(evdev)+capslock(swapescape)

# geometry: pc(pc104)

# setxkbmap -model pc104 -layout gb,us -variant ,dvorak -option caps:swapecape

# setxkbmap -v 9 -option "" -option "misc:extend,lv5:caps_switch_lock,compose:menu"

# mkdir -p ${DEST}/.xinitrc.d

#

# cat <<-EOF | tee ${DEST}/.xinitrc.d/setxkbmap.sh >/dev/null

# #!/usr/bin/env bash

#

# setxkbmap -model pc104 -layout gb,us -option "caps:swapescape"

# EOF

#

# chmod +x ${DEST}/.xinitrc.d/setxkbmap.sh

# default keyboard layout is described in /etc/default/keyboard and it is shared between X and the console

# "lv3:lwin_switch,caps:swapescape,compose:caps"

config_file="/etc/default/keyboard"

     typeset -A rules
     rules=(
     "XKBMODEL" "pc104"
     "XKBLAYOUT" "gb"
     "XKBVARIANT" ""
     "XKBOPTIONS" "caps:swapescape"
      "BACKSPACE" "guess"
     )

     for rule in "${(@k)rules}"; do
           regex="s|^#\?\(${rule}\s*\).*$|\1\=\"${rules[${rule}]}\"|"
            sudo sed -i "${regex}" ${config_file};
     done

sudo udevadm trigger --subsystem-match=input --action=change

# cat <<-EOF | sudo tee /etc/X11/xorg.conf.d/00-keyboard.conf > /dev/null

# Section "InputClass"

# Identifier "system-keyboard"

# MatchIsKeyboard "on"

# Option "XkbLayout" "gb,us"

# Option "XkbModel" "pc104"

# Option "XkbVariant" ""

# Option "XkbOptions" "caps:swapescape"

# EndSection

# EOF

# echo "enlightenment desktop settings-input-keyboard allowd swapping esc with caps."

```

```

```
