#!/bin/bash # Check if keyd is using the swapped config if pgrep -f "keyd.*default.conf" > /dev/null && keyd list | grep -q "capslock = esc"; then # Currently swapped, switch to normal config sudo cp ~/.config/keyd/normal.conf ~/.config/keyd/default.conf sudo keyd reload notify-send "Keyboard Layout" "Caps Lock and Escape returned to normal" -i input-keyboard else # Not swapped, switch to swapped config sudo cp ~/.config/keyd/swapped.conf ~/.config/keyd/default.conf sudo keyd reload notify-send "Keyboard Layout" "Caps Lock and Escape swapped" -i input-keyboard fi