profile: move swapping caps and escape to a script

This commit is contained in:
PowerUser64 2022-04-15 14:53:04 -07:00
parent 80e6430342
commit a0bececb43
2 changed files with 18 additions and 10 deletions

View file

@ -0,0 +1,14 @@
#!/bin/sh
# This will swap caps and escape. Will ask for root privilage.
# Requires: sudo
# Usage: swap-caps-escape
TMP_KEYMAP=/tmp/keymap_tmp.kmap
cat <<-EOF > "$TMP_KEYMAP"
keycode 1 = Caps_Lock
keycode 58 = Escape
EOF
sudo loadkeys "$TMP_KEYMAP"
rm "$TMP_KEYMAP"

View file

@ -56,18 +56,12 @@ export $(dbus-launch)
if [ "$(tty | sed 's-[0-9]$--g')" = /dev/tty ]; then
export IS_TTY=true
# 1- Swap caps and escape
TMP_KEYMAP=/tmp/keymap_tmp.kmap
cat <<-EOF >> "$TMP_KEYMAP"
keycode 1 = Caps_Lock
keycode 58 = Escape
EOF
sudo -n loadkeys "$TMP_KEYMAP" 2>/dev/null
rm "$TMP_KEYMAP"
# 2- Change the prompt theme to one that doesn't use nerdfonts
# Change the prompt theme to one that doesn't use nerdfonts
export P10K_CONFIG_LOCATION="$HOME/.config/shell/p10k/simple.p10k.zsh"
echo
echo "Welcome home"
else
export IS_TTY=false