From f79f0a1dad43628eea867ca433fa13edd2296936 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Thu, 20 Feb 2025 10:25:02 +0900 Subject: integrated nwg-display --- copy.sh | 52 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 7 deletions(-) (limited to 'copy.sh') diff --git a/copy.sh b/copy.sh index 8225349e..edf5a05f 100755 --- a/copy.sh +++ b/copy.sh @@ -104,7 +104,7 @@ if hostnamectl | grep -q 'Chassis: vm'; then sed -i 's/^\([[:space:]]*no_hardware_cursors[[:space:]]*=[[:space:]]*\)false/\1true/' config/hypr/UserConfigs/UserSettings.conf sed -i '/env = WLR_RENDERER_ALLOW_SOFTWARE,1/s/^#//' config/hypr/UserConfigs/ENVariables.conf #sed -i '/env = LIBGL_ALWAYS_SOFTWARE,1/s/^#//' config/hypr/UserConfigs/ENVariables.conf - sed -i '/monitor = Virtual-1, 1920x1080@60,auto,1/s/^#//' config/hypr/UserConfigs/Monitors.conf + sed -i '/monitor = Virtual-1, 1920x1080@60,auto,1/s/^#//' config/hypr/monitors.conf fi # Proper Polkit for NixOS @@ -114,7 +114,7 @@ if hostnamectl | grep -q 'Operating System: NixOS'; then sed -i '/^exec-once = \$scriptsDir\/Polkit\.sh$/ s/^#*/#/' config/hypr/UserConfigs/Startup_Apps.conf fi -# Check if dpkg is installed (use to check if Debian or Ubuntu or based distros +# to check if Debian or Ubuntu or based distros if grep -iq '^\(ID_LIKE\|ID\)=.*\(debian\|ubuntu\)' /etc/os-release >/dev/null 2>&1; then echo "${INFO} Debian/Ubuntu based distro. Disabling pyprland since it does not work properly" 2>&1 | tee -a "$LOG" || true # disabling pyprland as causing issues @@ -583,14 +583,12 @@ FILES_TO_RESTORE=( "ENVariables.conf" "LaptopDisplay.conf" "Laptops.conf" - "Monitors.conf" "Startup_Apps.conf" "UserDecorations.conf" "UserAnimations.conf" "UserKeybinds.conf" "UserSettings.conf" "WindowRules.conf" - "WorkspaceRules.conf" ) DIRPATH=~/.config/"$DIRH" @@ -637,13 +635,13 @@ SCRIPTS_TO_RESTORE=( ) DIRSHPATH=~/.config/"$DIRSH" -BACKUP_DIR_PATH="$DIRSHPATH-backup-$BACKUP_DIR/UserScripts" +BACKUP_DIR_PATH_S="$DIRSHPATH-backup-$BACKUP_DIR/UserScripts" -if [ -d "$BACKUP_DIR_PATH" ]; then +if [ -d "$BACKUP_DIR_PATH_S" ]; then echo -e "${NOTE} Restoring previous ${MAGENTA}User-Scripts${RESET}..." for SCRIPT_NAME in "${SCRIPTS_TO_RESTORE[@]}"; do - BACKUP_SCRIPT="$BACKUP_DIR_PATH/$SCRIPT_NAME" + BACKUP_SCRIPT="$BACKUP_DIR_PATH_S/$SCRIPT_NAME" if [ -f "$BACKUP_SCRIPT" ]; then printf "\n${INFO} Found ${YELLOW}$SCRIPT_NAME${RESET} in hypr backup...\n" @@ -663,6 +661,46 @@ fi printf "\n%.0s" {1..1} +# restoring some files in ~/.config/hypr +DIR_H="hypr" +FILES_2_RESTORE=( + "hyprlock.conf" + "hypridle.conf" + "monitors.conf" + "workspaces.conf" +) + +DIRPATH=~/.config/"$DIR_H" +BACKUP_DIR=$(get_backup_dirname) +BACKUP_DIR_PATH_F="$DIRPATH-backup-$BACKUP_DIR" + +if [ -d "$BACKUP_DIR_PATH_F" ]; then + echo -e "${NOTE} Restoring some files in ${MAGENTA}~/.config/hypr directory${RESET}..." + + for FILE_RESTORE in "${FILES_2_RESTORE[@]}"; do + BACKUP_FILE="$BACKUP_DIR_PATH_F/$FILE_RESTORE" + + if [ -f "$BACKUP_FILE" ]; then + echo -e "\n${INFO} Found ${YELLOW}$FILE_RESTORE${RESET} in hypr backup..." + read -p "${CAT} Do you want to restore ${YELLOW}$FILE_RESTORE${RESET} from backup? (y/N): " file2restore + + if [[ "$file2restore" == [Yy]* ]]; then + if cp "$BACKUP_FILE" "$DIRPATH/$FILE_RESTORE"; then + echo "${OK} - $FILE_RESTORE restored!" 2>&1 | tee -a "$LOG" + else + echo "${ERROR} - Failed to restore $FILE_RESTORE!" 2>&1 | tee -a "$LOG" + fi + else + echo "${NOTE} - Skipped restoring $FILE_RESTORE." + fi + else + echo "${ERROR} - Backup file $BACKUP_FILE does not exist." + fi + done +fi + +printf "\n%.0s" {1..1} + # Define the target directory for rofi themes rofi_DIR="$HOME/.local/share/rofi/themes" -- cgit v1.2.3 From 7c580b07c5fde91f1b03893a282f2c575819ce77 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Fri, 21 Feb 2025 19:20:39 +0900 Subject: adjusted copy.sh to restore Animations and Monitors directories automatically --- config/waybar/configs/[LEFT] WestWing v2 | 2 +- config/waybar/configs/[RIGHT] EastWing v2 | 2 +- copy.sh | 38 +++++++++++++++++++++++++++++-- 3 files changed, 38 insertions(+), 4 deletions(-) (limited to 'copy.sh') diff --git a/config/waybar/configs/[LEFT] WestWing v2 b/config/waybar/configs/[LEFT] WestWing v2 index e5e2fca4..2d90643d 100644 --- a/config/waybar/configs/[LEFT] WestWing v2 +++ b/config/waybar/configs/[LEFT] WestWing v2 @@ -29,7 +29,7 @@ ], "modules-center": [ - "hyprland/workspaces", + "hyprland/workspaces#numbers", ], "modules-right": [ diff --git a/config/waybar/configs/[RIGHT] EastWing v2 b/config/waybar/configs/[RIGHT] EastWing v2 index 134dc18d..ae8581ce 100644 --- a/config/waybar/configs/[RIGHT] EastWing v2 +++ b/config/waybar/configs/[RIGHT] EastWing v2 @@ -29,7 +29,7 @@ ], "modules-center": [ - "hyprland/workspaces", + "hyprland/workspaces#numbers", ], "modules-right": [ diff --git a/copy.sh b/copy.sh index edf5a05f..6f29f750 100755 --- a/copy.sh +++ b/copy.sh @@ -577,6 +577,42 @@ done printf "\n%.0s" {1..1} +# Restore automatically Animations and Monitor-Profiles +# including monitors.conf and workspaces.conf +HYPR_DIR="$HOME/.config/hypr" +BACKUP_DIR=$(get_backup_dirname) +BACKUP_HYPR_PATH="$HYPR_DIR-backup-$BACKUP_DIR" + +if [ ! -d "$BACKUP_HYPR_PATH" ]; then + exit 0 +fi + +echo -e "\n${NOTE} Restoring ${SKY_BLUE}Animations & Monitor Profiles${RESET} directories into ${YELLOW}$HYPR_DIR${RESET}..." + +DIR_B=("Monitor_Profiles" "animations") +# Restore directories automatically +for DIR_RESTORE in "${DIR_B[@]}"; do + BACKUP_SUBDIR="$BACKUP_HYPR_PATH/$DIR_RESTORE" + + if [ -d "$BACKUP_SUBDIR" ]; then + cp -r "$BACKUP_SUBDIR" "$HYPR_DIR/" + echo "${OK} - Restored directory: ${MAGENTA}$DIR_RESTORE${RESET}" 2>&1 | tee -a "$LOG" + fi +done + +# Restore files automatically +FILE_B=("monitors.conf" "workspaces.conf") +for FILE_RESTORE in "${FILE_B[@]}"; do + BACKUP_FILE="$BACKUP_HYPR_PATH/$FILE_RESTORE" + + if [ -f "$BACKUP_FILE" ]; then + cp "$BACKUP_FILE" "$HYPR_DIR/$FILE_RESTORE" + echo "${OK} - Restored file: ${MAGENTA}$FILE_RESTORE${RESET}" 2>&1 | tee -a "$LOG" + fi +done + +printf "\n%.0s" {1..1} + # Restoring UserConfigs and UserScripts DIRH="hypr" FILES_TO_RESTORE=( @@ -666,8 +702,6 @@ DIR_H="hypr" FILES_2_RESTORE=( "hyprlock.conf" "hypridle.conf" - "monitors.conf" - "workspaces.conf" ) DIRPATH=~/.config/"$DIR_H" -- cgit v1.2.3 From d676acab0742932e0f52f4816a308abc043eec30 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Fri, 21 Feb 2025 21:59:54 +0900 Subject: updated --- copy.sh | 4 ---- 1 file changed, 4 deletions(-) (limited to 'copy.sh') diff --git a/copy.sh b/copy.sh index 6f29f750..3fdd7f25 100755 --- a/copy.sh +++ b/copy.sh @@ -583,10 +583,6 @@ HYPR_DIR="$HOME/.config/hypr" BACKUP_DIR=$(get_backup_dirname) BACKUP_HYPR_PATH="$HYPR_DIR-backup-$BACKUP_DIR" -if [ ! -d "$BACKUP_HYPR_PATH" ]; then - exit 0 -fi - echo -e "\n${NOTE} Restoring ${SKY_BLUE}Animations & Monitor Profiles${RESET} directories into ${YELLOW}$HYPR_DIR${RESET}..." DIR_B=("Monitor_Profiles" "animations") -- cgit v1.2.3 From 32954ef25b2eb8081587e7ea9e3c6e4c5388cd57 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Fri, 21 Feb 2025 22:12:09 +0900 Subject: updated copy.sh --- copy.sh | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'copy.sh') diff --git a/copy.sh b/copy.sh index 3fdd7f25..b1344b2b 100755 --- a/copy.sh +++ b/copy.sh @@ -583,29 +583,31 @@ HYPR_DIR="$HOME/.config/hypr" BACKUP_DIR=$(get_backup_dirname) BACKUP_HYPR_PATH="$HYPR_DIR-backup-$BACKUP_DIR" -echo -e "\n${NOTE} Restoring ${SKY_BLUE}Animations & Monitor Profiles${RESET} directories into ${YELLOW}$HYPR_DIR${RESET}..." - -DIR_B=("Monitor_Profiles" "animations") -# Restore directories automatically -for DIR_RESTORE in "${DIR_B[@]}"; do - BACKUP_SUBDIR="$BACKUP_HYPR_PATH/$DIR_RESTORE" +if [ -d "$BACKUP_HYPR_PATH" ]; then + echo -e "\n${NOTE} Restoring ${SKY_BLUE}Animations & Monitor Profiles${RESET} directories into ${YELLOW}$HYPR_DIR${RESET}..." - if [ -d "$BACKUP_SUBDIR" ]; then - cp -r "$BACKUP_SUBDIR" "$HYPR_DIR/" - echo "${OK} - Restored directory: ${MAGENTA}$DIR_RESTORE${RESET}" 2>&1 | tee -a "$LOG" - fi -done + DIR_B=("Monitor_Profiles" "animations") + # Restore directories automatically + for DIR_RESTORE in "${DIR_B[@]}"; do + BACKUP_SUBDIR="$BACKUP_HYPR_PATH/$DIR_RESTORE" + + if [ -d "$BACKUP_SUBDIR" ]; then + cp -r "$BACKUP_SUBDIR" "$HYPR_DIR/" + echo "${OK} - Restored directory: ${MAGENTA}$DIR_RESTORE${RESET}" 2>&1 | tee -a "$LOG" + fi + done -# Restore files automatically -FILE_B=("monitors.conf" "workspaces.conf") -for FILE_RESTORE in "${FILE_B[@]}"; do - BACKUP_FILE="$BACKUP_HYPR_PATH/$FILE_RESTORE" + # Restore files automatically + FILE_B=("monitors.conf" "workspaces.conf") + for FILE_RESTORE in "${FILE_B[@]}"; do + BACKUP_FILE="$BACKUP_HYPR_PATH/$FILE_RESTORE" - if [ -f "$BACKUP_FILE" ]; then - cp "$BACKUP_FILE" "$HYPR_DIR/$FILE_RESTORE" - echo "${OK} - Restored file: ${MAGENTA}$FILE_RESTORE${RESET}" 2>&1 | tee -a "$LOG" - fi -done + if [ -f "$BACKUP_FILE" ]; then + cp "$BACKUP_FILE" "$HYPR_DIR/$FILE_RESTORE" + echo "${OK} - Restored file: ${MAGENTA}$FILE_RESTORE${RESET}" 2>&1 | tee -a "$LOG" + fi + done +fi printf "\n%.0s" {1..1} -- cgit v1.2.3 From eb18f06d8cb34b529567016812c9b3a454280859 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sat, 22 Feb 2025 01:02:43 +0900 Subject: wallpapers and waybar config and styles will be restored automatically --- config/hypr/UserConfigs/UserKeybinds.conf | 2 +- copy.sh | 39 +++++++++++++------------------ 2 files changed, 17 insertions(+), 24 deletions(-) (limited to 'copy.sh') diff --git a/config/hypr/UserConfigs/UserKeybinds.conf b/config/hypr/UserConfigs/UserKeybinds.conf index 16557059..58fb80ac 100644 --- a/config/hypr/UserConfigs/UserKeybinds.conf +++ b/config/hypr/UserConfigs/UserKeybinds.conf @@ -53,7 +53,7 @@ bind = $mainMod CTRL, O, exec, hyprctl setprop active opaque toggle # disable op bind = $mainMod SHIFT, K, exec, $scriptsDir/KeyBinds.sh # search keybinds via rofi bind = $mainMod SHIFT, A, exec, $scriptsDir/Animations.sh #hyprland animations menu bind = $mainMod SHIFT, O, exec, $UserScripts/ZshChangeTheme.sh # Change oh-my-zsh theme -bindn = ALT_L, SHIFT_L, exec, $scriptsDir/SwitchKeyboardLayout.sh # Change keyboard layout +bindln = ALT_L, SHIFT_L, exec, $scriptsDir/SwitchKeyboardLayout.sh # Change keyboard layout bind = $mainMod ALT, C, exec, $UserScripts/RofiCalc.sh # calculator (qalculate) # pyprland (This is not available in Debian and Ubuntu) diff --git a/copy.sh b/copy.sh index b1344b2b..97240e2b 100755 --- a/copy.sh +++ b/copy.sh @@ -483,26 +483,23 @@ for DIR2 in $DIRS; do [Yy]* ) BACKUP_DIR=$(get_backup_dirname) + # Backup the existing directory mv "$DIRPATH" "$DIRPATH-backup-$BACKUP_DIR" 2>&1 | tee -a "$LOG" - if [ $? -eq 0 ]; then - echo -e "${NOTE} - Backed up $DIR2 to $DIRPATH-backup-$BACKUP_DIR." 2>&1 | tee -a "$LOG" - - cp -r config/"$DIR2" ~/.config/"$DIR2" - if [ $? -eq 0 ]; then - echo -e "${OK} - Replaced $DIR2 with new configuration." 2>&1 | tee -a "$LOG" - else - echo "${ERROR} - Failed to copy $DIR2." 2>&1 | tee -a "$LOG" - exit 1 - fi - else - echo "${ERROR} - Failed to back up $DIR2." 2>&1 | tee -a "$LOG" - exit 1 + echo -e "${NOTE} - Backed up $DIR2 to $DIRPATH-backup-$BACKUP_DIR." 2>&1 | tee -a "$LOG" + + # Copy the new config + cp -r config/"$DIR2" ~/.config/"$DIR2" 2>&1 | tee -a "$LOG" + echo -e "${OK} - Replaced $DIR2 with new configuration." 2>&1 | tee -a "$LOG" + + # restoring waybar config and style automatically + if [ "$DIR2" = "waybar" ]; then + cp "$DIRPATH-backup-$BACKUP_DIR/config" ~/.config/waybar/ && cp "$DIRPATH-backup-$BACKUP_DIR/style.css" ~/.config/waybar/ + echo -e "${OK} - waybar config and style restored automatically" 2>&1 | tee -a "$LOG" fi break ;; [Nn]* ) - # Skip the directory - echo -e "${NOTE} - Skipping ${YELLOW}$DIR2${RESET} " 2>&1 | tee -a "$LOG" + echo -e "${NOTE} - Skipping ${YELLOW}$DIR2${RESET}" 2>&1 | tee -a "$LOG" break ;; * ) @@ -513,14 +510,10 @@ for DIR2 in $DIRS; do else # Copy new config if directory does not exist cp -r config/"$DIR2" ~/.config/"$DIR2" 2>&1 | tee -a "$LOG" - if [ $? -eq 0 ]; then - echo "${OK} - Copy completed for ${YELLOW}$DIR2${RESET}" 2>&1 | tee -a "$LOG" - else - echo "${ERROR} - Failed to copy ${YELLOW}$DIR2${RESET}" 2>&1 | tee -a "$LOG" - exit 1 - fi + echo "${OK} - Copy completed for ${YELLOW}$DIR2${RESET}" 2>&1 | tee -a "$LOG" fi done + printf "\n%.0s" {1..1} printf "${INFO} - Copying dotfiles ${SKY_BLUE}second${RESET} part\n" @@ -586,7 +579,7 @@ BACKUP_HYPR_PATH="$HYPR_DIR-backup-$BACKUP_DIR" if [ -d "$BACKUP_HYPR_PATH" ]; then echo -e "\n${NOTE} Restoring ${SKY_BLUE}Animations & Monitor Profiles${RESET} directories into ${YELLOW}$HYPR_DIR${RESET}..." - DIR_B=("Monitor_Profiles" "animations") + DIR_B=("Monitor_Profiles" "animations" "wallpaper_effects") # Restore directories automatically for DIR_RESTORE in "${DIR_B[@]}"; do BACKUP_SUBDIR="$BACKUP_HYPR_PATH/$DIR_RESTORE" @@ -598,7 +591,7 @@ if [ -d "$BACKUP_HYPR_PATH" ]; then done # Restore files automatically - FILE_B=("monitors.conf" "workspaces.conf") + FILE_B=("monitors.conf" "workspaces.conf" "pyprland.toml") for FILE_RESTORE in "${FILE_B[@]}"; do BACKUP_FILE="$BACKUP_HYPR_PATH/$FILE_RESTORE" -- cgit v1.2.3 From 7d89d2547c00a32f102292f31e2fa1ad89b5461b Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sat, 22 Feb 2025 02:09:23 +0900 Subject: improved copy.sh. Will restore previous waybar styles and layouts --- config/hypr/initial-boot.sh | 11 +++++------ copy.sh | 16 ++++++++++++---- 2 files changed, 17 insertions(+), 10 deletions(-) (limited to 'copy.sh') diff --git a/config/hypr/initial-boot.sh b/config/hypr/initial-boot.sh index b2d5bce5..43856e04 100755 --- a/config/hypr/initial-boot.sh +++ b/config/hypr/initial-boot.sh @@ -52,14 +52,13 @@ if [ ! -f ~/.config/hypr/.initial_startup_done ]; then # initiate the kb_layout (for some reason) waybar cant launch it "$scriptsDir/SwitchKeyboardLayout.sh" > /dev/null 2>&1 & - # Initial waybar style - if [ -f "$waybar_style" ]; then - ln -sf "$waybar_style" "$HOME/.config/waybar/style.css" - - # Refreshing waybar, swaync, rofi etc. - "$scriptsDir/Refresh.sh" > /dev/null 2>&1 & + # waybar style + if [ -L "$HOME/.config/waybar/config" ]; then + ln -sf "$waybar_style" "$HOME/.config/waybar/style.css" + "$scriptsDir/Refresh.sh" > /dev/null 2>&1 & fi + # Create a marker file to indicate that the script has been executed. touch ~/.config/hypr/.initial_startup_done diff --git a/copy.sh b/copy.sh index 97240e2b..ddac1208 100755 --- a/copy.sh +++ b/copy.sh @@ -493,7 +493,10 @@ for DIR2 in $DIRS; do # restoring waybar config and style automatically if [ "$DIR2" = "waybar" ]; then - cp "$DIRPATH-backup-$BACKUP_DIR/config" ~/.config/waybar/ && cp "$DIRPATH-backup-$BACKUP_DIR/style.css" ~/.config/waybar/ + rm -f "$HOME/.config/waybar/config" "$HOME/.config/waybar/style.css" || true + cp -L "$DIRPATH-backup-$BACKUP_DIR/config" "$HOME/.config/waybar/config" || true + cp -L "$DIRPATH-backup-$BACKUP_DIR/style.css" "$HOME/.config/waybar/style.css" || true + echo -e "${OK} - waybar config and style restored automatically" 2>&1 | tee -a "$LOG" fi break @@ -768,7 +771,10 @@ else config_remove="" fi -ln -sf "$config_file" "$HOME/.config/waybar/config" 2>&1 | tee -a "$LOG" || true +# Check if ~/.config/waybar/config is a symlink +if [ -L "$HOME/.config/waybar/config" ]; then + ln -sf "$config_file" "$HOME/.config/waybar/config" 2>&1 | tee -a "$LOG" +fi # Remove inappropriate waybar configs rm -rf "$HOME/.config/waybar/configs/[TOP] Default$config_remove" \ @@ -900,8 +906,10 @@ cleanup_backups() { # Execute the cleanup function cleanup_backups -# symlinks for waybar style -ln -sf "$waybar_style" "$HOME/.config/waybar/style.css" && \ +# Check if ~/.config/waybar/style is a symlink +if [ -L "$HOME/.config/waybar/style.css" ]; then + ln -sf "$waybar_style" "$HOME/.config/waybar/style.css" 2>&1 | tee -a "$LOG" +fi printf "\n%.0s" {1..1} -- cgit v1.2.3