You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

20 lines
582 B

#!/bin/bash
# File to store the current state
STATE_FILE="$HOME/.caps_esc_swap_state"
# Default layout - change this to match your keyboard layout (us, au, etc.)
LAYOUT="${RIVER_KEYBOARD_LAYOUT:-us}"
# Check current state
if [ -f "$STATE_FILE" ]; then
# Currently swapped, so swap back to normal
riverctl keyboard-layout "$LAYOUT"
rm "$STATE_FILE"
echo "Restored CapsLock and Escape to normal"
else
# Not swapped, so swap them
riverctl keyboard-layout -options "caps:swapescape" "$LAYOUT"
touch "$STATE_FILE"
echo "Swapped CapsLock and Escape"
fi