diff --git a/.install/copy.sh b/.install/copy.sh index 4cbd61d..0f090ef 100644 --- a/.install/copy.sh +++ b/.install/copy.sh @@ -51,10 +51,10 @@ if gum confirm "Do you want to install the prepared dotfiles now?" ;then echo "Skipped: DEV MODE!" fi elif [ $? -eq 130 ]; then - echo ":: Installation cancelled" + echo ":: Installation canceled" exit 130 else - echo ":: Installation cancelled" + echo ":: Installation canceled" exit fi echo diff --git a/.install/keyboard.sh b/.install/keyboard.sh index 0db08db..50f1abf 100755 --- a/.install/keyboard.sh +++ b/.install/keyboard.sh @@ -6,37 +6,61 @@ echo -e "${GREEN}" figlet "Keyboard" echo -e "${NONE}" -# Default layout and variants -keyboard_layout="us" - -_setupKeyboardLayout() { - 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...") - echo "" - echo ":: Keyboard layout changed to $keyboard_layout" - 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 -} - +setkeyboard=0 if [ "$restored" == "1" ]; then echo ":: You have already restored your settings into the new installation." -else + echo "You can repeat the keyboard setup again to choose between a desktop and laptop optimized configuration." + echo + if gum confirm "Do you want to setup your keyboard again?" ;then + setkeyboard=0 + elif [ $? -eq 130 ]; then + echo ":: Installation canceled." + exit 130 + else + echo ":: Keyboard setup skipped." + setkeyboard=1 + fi +fi + +if [ "$setkeyboard" == "0" ] ;then + + # Default layout and variants + keyboard_layout="us" + + _setupKeyboardLayout() { + echo + keyboard_layout=$(localectl list-x11-keymap-layouts | gum filter --height 15 --placeholder "Find your keyboard layout...") + echo + echo ":: Keyboard layout changed to $keyboard_layout" + echo + _confirmKeyboard + } + + _confirmKeyboard() { + + echo "Current selected keyboard setup:" + echo "Keyboard layout: $keyboard_layout" + echo + 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 + } + _confirmKeyboard - - cp .install/templates/keyboard.conf ~/dotfiles-versions/$version/hypr/conf/keyboard.conf + + if gum confirm "Are you using a laptop and would you like to enable the laptop presets?"; then + cp .install/templates/keyboard-laptop.conf ~/dotfiles-versions/$version/hypr/conf/keyboard.conf + echo "source = ~/dotfiles/hypr/conf/layouts/laptop.conf" > ~/dotfiles-versions/$version/hypr/conf/layout.conf + elif [ $? -eq 130 ]; then + echo ":: Installation canceled." + exit 130 + else + cp .install/templates/keyboard-default.conf ~/dotfiles-versions/$version/hypr/conf/keyboard.conf + fi cp .install/templates/autostart.sh ~/dotfiles-versions/$version/qtile/autostart.sh SEARCH="KEYBOARD_LAYOUT" @@ -47,7 +71,9 @@ else REPLACE="$keyboard_layout" sed -i "s/$SEARCH/$REPLACE/g" ~/dotfiles-versions/$version/qtile/autostart.sh - echo "" - echo ":: Keyboard setup updated successfully." + echo + echo ":: Keyboard setup complete." + echo echo "PLEASE NOTE: You can update your keyboard layout later in ~/dotfiles/hypr/conf/keyboard.conf" -fi + +fi diff --git a/.install/remove.sh b/.install/remove.sh index 70a5037..e71a3e9 100755 --- a/.install/remove.sh +++ b/.install/remove.sh @@ -1,12 +1,5 @@ #!/bin/bash -# Remove blueman -if [[ $(_isInstalledPacman "blueman") == 0 ]]; then - sudo pacman --noconfirm -Rns blueman - echo ":: blueman removed" - echo -fi - # Remove Rofi Calc if [[ $(_isInstalledPacman "rofi-calc") == 0 ]]; then sudo pacman --noconfirm -Rns rofi-calc diff --git a/.install/restore.sh b/.install/restore.sh index f532579..c51db35 100755 --- a/.install/restore.sh +++ b/.install/restore.sh @@ -42,6 +42,10 @@ _showRestoreOptions() { restorelist+="~/dotfiles/hypr/conf/environment.conf " selectedlist+="~/dotfiles/hypr/conf/environment.conf," fi + if [ -f ~/dotfiles/hypr/conf/layout.conf ] && [ -d ~/dotfiles/hypr/conf/layouts/ ]; then + restorelist+="~/dotfiles/hypr/conf/layout.conf " + selectedlist+="~/dotfiles/hypr/conf/layout.conf," + fi if [ -f ~/dotfiles/hypr/conf/windowrule.conf ] && [ -d ~/dotfiles/hypr/conf/windowrules/ ]; then restorelist+="~/dotfiles/hypr/conf/windowrule.conf " selectedlist+="~/dotfiles/hypr/conf/windowrule.conf," @@ -150,6 +154,12 @@ _startRestore() { echo ":: Hyprland environment.conf restored!" fi fi + if [[ $restoreselect == *"~/dotfiles/hypr/conf/layout.conf"* ]] || [[ $restoreselect == *"All"* ]] ; then + if [ -f ~/dotfiles/hypr/conf/layout.conf ]; then + cp ~/dotfiles/hypr/conf/layout.conf ~/dotfiles-versions/$version/hypr/conf/ + echo ":: Hyprland layout.conf restored!" + fi + fi if [[ $restoreselect == *"~/dotfiles/hypr/conf/windowrule.conf"* ]] || [[ $restoreselect == *"All"* ]] ; then if [ -f ~/dotfiles/hypr/conf/windowrule.conf ]; then cp ~/dotfiles/hypr/conf/windowrule.conf ~/dotfiles-versions/$version/hypr/conf/ diff --git a/.install/templates/keyboard.conf b/.install/templates/keyboard-default.conf similarity index 77% rename from .install/templates/keyboard.conf rename to .install/templates/keyboard-default.conf index 6bed3fa..e81cb8a 100644 --- a/.install/templates/keyboard.conf +++ b/.install/templates/keyboard-default.conf @@ -18,7 +18,13 @@ input { follow_mouse = 1 touchpad { + # for desktop natural_scroll = false + + # for laptop + # natural_scroll = yes + # middle_button_emulation = true + # clickfinger_behavior = 1 } sensitivity = 0 # -1.0 - 1.0, 0 means no modification. } diff --git a/.install/templates/keyboard-laptop.conf b/.install/templates/keyboard-laptop.conf new file mode 100644 index 0000000..dab88f6 --- /dev/null +++ b/.install/templates/keyboard-laptop.conf @@ -0,0 +1,30 @@ +# ----------------------------------------------------- +# Keyboard Layout +# https://wiki.hyprland.org/Configuring/Variables/#input +# ----------------------------------------------------- +input { + kb_layout = KEYBOARD_LAYOUT + kb_variant = + kb_model = + kb_options = + numlock_by_default = true + mouse_refocus=false + + # For United States + # kb_layout = us + # kb_variant = intl + # kb_model = pc105 + # kb_options = + + follow_mouse = 1 + touchpad { + # for desktop + # natural_scroll = false + + # for laptop + natural_scroll = yes + middle_button_emulation = true + clickfinger_behavior = 1 + } + sensitivity = 0 # -1.0 - 1.0, 0 means no modification. +} diff --git a/hypr/conf/layout.conf b/hypr/conf/layout.conf index dc78a62..c2b5cf1 100644 --- a/hypr/conf/layout.conf +++ b/hypr/conf/layout.conf @@ -1,16 +1 @@ -# ----------------------------------------------------- -# Layouts -# ----------------------------------------------------- - -dwindle { - pseudotile = true - preserve_split = true -} - -master { - new_is_master = true -} - -gestures { - workspace_swipe = false -} +source = ~/dotfiles/hypr/conf/layouts/default.conf \ No newline at end of file diff --git a/hypr/conf/layouts/default.conf b/hypr/conf/layouts/default.conf new file mode 100644 index 0000000..b766d1d --- /dev/null +++ b/hypr/conf/layouts/default.conf @@ -0,0 +1,16 @@ +# ----------------------------------------------------- +# Layouts +# ----------------------------------------------------- + +dwindle { + pseudotile = true + preserve_split = true +} + +master { + new_is_master = true +} + +gestures { + workspace_swipe = false +} \ No newline at end of file diff --git a/hypr/conf/layouts/laptop.conf b/hypr/conf/layouts/laptop.conf new file mode 100644 index 0000000..d531762 --- /dev/null +++ b/hypr/conf/layouts/laptop.conf @@ -0,0 +1,16 @@ +# ----------------------------------------------------- +# Layouts +# ----------------------------------------------------- + +dwindle { + pseudotile = true + preserve_split = true +} + +master { + new_is_master = true +} + +gestures { + workspace_swipe = true +} \ No newline at end of file diff --git a/install.sh b/install.sh index 572d795..d5a3f79 100755 --- a/install.sh +++ b/install.sh @@ -64,8 +64,8 @@ source .install/wallpaper.sh source .install/displaymanager.sh source .install/issue.sh source .install/restore.sh -source .install/neovim.sh source .install/keyboard.sh +source .install/neovim.sh source .install/hook.sh source .install/vm.sh source .install/copy.sh diff --git a/scripts/lid-improvements.sh b/scripts/lid-improvements.sh new file mode 100755 index 0000000..2ffad61 --- /dev/null +++ b/scripts/lid-improvements.sh @@ -0,0 +1,12 @@ +#!/bin/bash +while IFS= read -r line; do + # If the line starts with # and the next line is not the lines to be added + if [[ $line == \#HandleLidSwitchDocked=ignore ]]; then + # Add the new lines + echo "HandleLidSwitchDocked=ignore" | sudo tee -a /etc/systemd/logind.conf > /dev/null + fi + if [[ $line == \#HoldoffTimeoutSec=5s ]]; then + # Add the new lines + echo "HoldoffTimeoutSec=5s" | sudo tee -a /etc/systemd/logind.conf > /dev/null + fi +done < /etc/systemd/logind.conf \ No newline at end of file