2023-11-20 16:47:51 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# ------------------------------------------------------
|
|
|
|
# Setup
|
|
|
|
# ------------------------------------------------------
|
|
|
|
echo -e "${GREEN}"
|
2023-12-21 20:57:44 +00:00
|
|
|
figlet "Keyboard"
|
2023-11-20 16:47:51 +00:00
|
|
|
echo -e "${NONE}"
|
|
|
|
|
|
|
|
# Default layout and variants
|
|
|
|
keyboard_layout="us"
|
|
|
|
|
|
|
|
_setupKeyboardLayout() {
|
2023-11-23 07:18:28 +00:00
|
|
|
echo ""
|
|
|
|
echo "Start typing = Search, RETURN = Confirm, CTRL-C = Cancel"
|
|
|
|
keyboard_layout=$(localectl list-x11-keymap-layouts | gum filter --height 15 --placeholder "Find your keyboard layout...")
|
2023-11-22 13:21:02 +00:00
|
|
|
echo ""
|
|
|
|
echo "Keyboard layout changed to $keyboard_layout"
|
2023-11-20 16:47:51 +00:00
|
|
|
echo ""
|
|
|
|
_confirmKeyboard
|
|
|
|
}
|
|
|
|
|
|
|
|
_confirmKeyboard() {
|
|
|
|
echo "Current selected keyboard setup:"
|
|
|
|
echo "Keyboard layout: $keyboard_layout"
|
|
|
|
if gum confirm "Do you want proceed with this keyboard setup?" --affirmative "Proceed" --negative "Change" ;then
|
|
|
|
return 0
|
|
|
|
elif [ $? -eq 130 ]; then
|
|
|
|
exit 130
|
|
|
|
else
|
|
|
|
_setupKeyboardLayout
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ "$restored" == "1" ]; then
|
|
|
|
echo "You have already restored your settings into the new installation."
|
|
|
|
else
|
|
|
|
_confirmKeyboard
|
|
|
|
|
|
|
|
cp .install/templates/keyboard.conf ~/dotfiles-versions/$version/hypr/conf/keyboard.conf
|
2023-12-22 08:51:55 +00:00
|
|
|
cp .install/templates/autostart.sh ~/dotfiles-versions/$version/qtile/autostart.sh
|
2023-11-20 16:47:51 +00:00
|
|
|
|
2023-11-20 20:45:56 +00:00
|
|
|
SEARCH="KEYBOARD_LAYOUT"
|
|
|
|
REPLACE="$keyboard_layout"
|
2023-11-20 16:47:51 +00:00
|
|
|
sed -i "s/$SEARCH/$REPLACE/g" ~/dotfiles-versions/$version/hypr/conf/keyboard.conf
|
|
|
|
|
2024-01-06 14:14:21 +00:00
|
|
|
SEARCH="KEYBOARD_LAYOUT"
|
|
|
|
REPLACE="$keyboard_layout"
|
2023-12-20 10:05:15 +00:00
|
|
|
sed -i "s/$SEARCH/$REPLACE/g" ~/dotfiles-versions/$version/qtile/autostart.sh
|
2023-11-20 16:47:51 +00:00
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "Keyboard setup updated successfully."
|
2023-11-22 13:21:02 +00:00
|
|
|
echo "PLEASE NOTE: You can update your keyboard layout later in ~/dotfiles/hypr/conf/keyboard.conf"
|
2023-11-20 16:47:51 +00:00
|
|
|
fi
|