working on copy script
This commit is contained in:
parent
ace304bd44
commit
4406c93ac2
87
copy.sh
87
copy.sh
|
@ -123,3 +123,90 @@ if [ -d "$HOME/.icons/Bibata-Modern-Ice/hyprcursors" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "\n%.0s" {1..1}
|
printf "\n%.0s" {1..1}
|
||||||
|
|
||||||
|
# detect the current keyboard layout
|
||||||
|
layout=$(detect_layout)
|
||||||
|
|
||||||
|
if [ "$layout" = "(unset)" ]; then
|
||||||
|
while true; do
|
||||||
|
printf "\n%.0s" {1..1}
|
||||||
|
print_color $WARNING "
|
||||||
|
█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█
|
||||||
|
STOP AND READ
|
||||||
|
█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█
|
||||||
|
|
||||||
|
!!! IMPORTANT WARNING !!!
|
||||||
|
|
||||||
|
the default keyboard layout could not be detected
|
||||||
|
you need to set it manually
|
||||||
|
|
||||||
|
!!! WARNING !!!
|
||||||
|
|
||||||
|
setting a wrong keyboard layout will cause Hyprland to crash
|
||||||
|
If you are not sure, just type ${YELLOW}us${RESET}
|
||||||
|
${SKYBLUE}you can change later in ~/.config/hypr/UserConfigs/UserSettings.conf${RESET}
|
||||||
|
|
||||||
|
${MAGENTA} NOTE:${RESET}
|
||||||
|
• you can also set more than 2 keyboard layouts
|
||||||
|
• for example: ${YELLOW}us, kr, gb, no${RESET}
|
||||||
|
"
|
||||||
|
printf "\n%.0s" {1..1}
|
||||||
|
read -p "${CAT} - please enter the correct keyboard layout: " new_layout
|
||||||
|
|
||||||
|
if [ -n "$new_layout" ]; then
|
||||||
|
layout="$new_layout"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${CAT} please enter a keyboard layout."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "${NOTE} detecting keyboard layout to prepare proper hyprland settings\n"
|
||||||
|
|
||||||
|
# prompt the user to confirm whether the detected layout is correct
|
||||||
|
while true; do
|
||||||
|
printf "${INFO} current keyboard layout is ${MAGENTA}$layout${RESET}\n"
|
||||||
|
read -p "${CAT} is this correct? [y/n] " keyboard_layout
|
||||||
|
|
||||||
|
case $keyboard_layout in
|
||||||
|
[yY])
|
||||||
|
awk -v layout="$layout" '/kb_layout/ {$0 = " kb_layout = " layout} 1' config/hypr/UserConfigs/UserSettings.conf > temp.conf
|
||||||
|
mv temp.conf config/hypr/UserConfigs/UserSettings.conf
|
||||||
|
|
||||||
|
echo "${NOTE} kb_layout ${MAGENTA}$layout${RESET} configured in settings" 2>&1 | tee -a "$LOG"
|
||||||
|
break ;;
|
||||||
|
[nN])
|
||||||
|
printf: "\n%.0s" {1..2}
|
||||||
|
print_color $WARNING "
|
||||||
|
█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█
|
||||||
|
STOP AND READ
|
||||||
|
█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█
|
||||||
|
|
||||||
|
!!! IMPORTANT WARNING !!!
|
||||||
|
|
||||||
|
the default keyboard layout could not be detected
|
||||||
|
you need to set it Manually
|
||||||
|
|
||||||
|
!!! WARNING !!!
|
||||||
|
|
||||||
|
setting a wrong keyboard layout will cause hyprland to crash
|
||||||
|
if you are not sure, just type ${YELLOW}us${RESET}
|
||||||
|
${SKYBLUE}you can change later in ~/.config/hypr/UserConfigs/UserSettings.conf${RESET}
|
||||||
|
|
||||||
|
${MAGENTA} NOTE:${RESET}
|
||||||
|
• you can also set more than 2 keyboard layouts
|
||||||
|
• for example: ${YELLOW}us, kr, gb, no${RESET}
|
||||||
|
"
|
||||||
|
printf "\n%.0s" {1..1}
|
||||||
|
|
||||||
|
read -p "${CAT} - Please enter the correct keyboard layout: " new_layout
|
||||||
|
|
||||||
|
awk -v new_layout="$new_layout" '/kb_layout/ {$0 = " kb_layout = " new_layout} 1' config/hypr/UserConfigs/UserSettings.conf > temp.conf
|
||||||
|
mv temp.conf config/hypr/UserConfigs/UserSettings.conf
|
||||||
|
echo "${OK} kb_layout $new_layout configured in settings." 2>&1 | tee -a "$LOG"
|
||||||
|
break ;;
|
||||||
|
*)
|
||||||
|
echo "${ERROR} Please enter either 'y' or 'n'." ;;
|
||||||
|
esac
|
||||||
|
done
|
Loading…
Reference in New Issue