diff options
| author | JaKooLit <ejhay.games@gmail.com> | 2025-02-14 14:39:08 +0900 |
|---|---|---|
| committer | JaKooLit <ejhay.games@gmail.com> | 2025-02-14 14:39:08 +0900 |
| commit | c9e787096336f0436e06c49a30fd2a51823b32a6 (patch) | |
| tree | 6896c8eee685ee8d5ff6ad434d50d7505e8a2bf4 | |
| parent | 02c9626c1da104fbcdf32b4b11896e3b9f650531 (diff) | |
Introduction of KooL's hyprland dots notification update
| -rwxr-xr-x | config/hypr/scripts/KooLsDotsUpdate.sh | 63 | ||||
| -rwxr-xr-x | config/hypr/scripts/RofiEmoji.sh | 1 | ||||
| -rwxr-xr-x | copy.sh | 31 |
3 files changed, 85 insertions, 10 deletions
diff --git a/config/hypr/scripts/KooLsDotsUpdate.sh b/config/hypr/scripts/KooLsDotsUpdate.sh new file mode 100755 index 00000000..e6275c10 --- /dev/null +++ b/config/hypr/scripts/KooLsDotsUpdate.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## +# simple bash script to check if KooL Hyprland Dots update is available by comparing local version and github version + +# Local Paths +local_dir="$HOME/.config/hypr" +iDIR="$HOME/.config/swaync/images/ja.png" +local_version=$(ls $local_dir/v* 2>/dev/null | sort -V | tail -n 1 | sed 's/.*v\(.*\)/\1/') +notification_timeout="60s" +KooL_Dots_DIR="$HOME/Hyprland-Dots" + +# exit if cannot find local version +if [ -z "$local_version" ]; then + exit 1 +fi + +# GitHub URL pointing to versioned files +github_url="https://github.com/JaKooLit/Hyprland-Dots/tree/main/config/hypr/" + +# Fetch the latest version from GitHub directly +github_version=$(curl -s $github_url | grep -o 'v[0-9]\+\.[0-9]\+\.[0-9]\+' | sort -V | tail -n 1 | sed 's/v//') + +# Exit if we can't find the GitHub version +if [ -z "$github_version" ]; then + exit 1 +fi + +# Compare the local version with the GitHub version +if [ "$(echo -e "$github_version\n$local_version" | sort -V | tail -n 1)" = "$github_version" ]; then + notify_cmd_base="notify-send -t 10000 -A action1=Update -A action2=NO -h string:x-canonical-private-synchronous:shot-notify" + notify_cmd_shot="${notify_cmd_base} -i $iDIR" + + response=$(timeout $notification_timeout $notify_cmd_shot "KooL Hyprland" "Update available! Update now?") + # exit when timeout reached + if [ $? -eq 124 ]; then + exit 0 + fi + + case "$response" in + "action1") + if [ -d $KooL_Dots_DIR ]; then + kitty -e bash -c " + cd $KooL_Dots_DIR && + git stash && + git pull && + ./copy.sh + " + else + kitty -e bash -c " + git clone --depth=1 https://github.com/JaKooLit/Hyprland-Dots.git $KooL_Dots_DIR && + cd $KooL_Dots_DIR && + chmod +x copy.sh && + ./copy.sh + " + fi + ;; + "action2") + exit 0 + ;; + esac +else + exit 0 +fi diff --git a/config/hypr/scripts/RofiEmoji.sh b/config/hypr/scripts/RofiEmoji.sh index 2e5aaabb..a7141588 100755 --- a/config/hypr/scripts/RofiEmoji.sh +++ b/config/hypr/scripts/RofiEmoji.sh @@ -1,6 +1,5 @@ #!/bin/bash # /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## -# Rofi Emoticons. Not my own. Cant remember the source # Variables rofi_theme="~/.config/rofi/config-emoji.rasi" @@ -403,8 +403,22 @@ while true; do echo "${ERROR} Invalid choice. Please enter y for yes or n for no." fi done +printf "\n%.0s" {1..1} - +# Ask whether to have update notification +while true; do + read -p "$CAT Do you want to ${YELLOW}enable${RESE} ${SKY_BLUE}KooL Hyprland Dots available update notification? (y/n)${RESET}: " update + # Convert the answer to lowercase for comparison + answer=$(echo "$update" | tr '[:upper:]' '[:lower:]') + if [[ "$answer" == "y" ]]; then + break + elif [[ "$answer" == "n" ]]; then + sed -i 's|^exec-once = $HOME/.config/hypr/KooLsDotsUpdate.sh|#exec-once = $HOME/.config/hypr/KooLsDotsUpdate.sh|' config/hypr/hyprland.conf + echo "Update notification disabled" + else + echo "${ERROR} Invalid choice. Please enter y for yes or n for no." + fi +done printf "\n%.0s" {1..1} # Check if the user wants to disable Rainbow borders @@ -422,7 +436,7 @@ if [[ "$border_choice" =~ ^[Yy]$ ]]; then else echo "${NOTE} No changes made. Rainbow borders remain enabled." 2>&1 | tee -a "$LOG" fi -printf "\n" +printf "\n%.0s" {1..1} set -e @@ -498,7 +512,6 @@ for DIR2 in $DIRS; do fi fi done - printf "\n%.0s" {1..1} printf "${INFO} - Copying dotfiles ${SKY_BLUE}second${RESET} part\n" @@ -553,7 +566,7 @@ for DIR_NAME in $DIR; do fi done -printf "\n%.0s" {1..2} +printf "\n%.0s" {1..1} # Restoring UserConfigs and UserScripts DIRH="hypr" @@ -604,7 +617,7 @@ if [ -d "$BACKUP_DIR_PATH" ]; then done fi -printf "\n%.0s" {1..2} +printf "\n%.0s" {1..1} # Restoring previous UserScripts DIRSH="hypr" @@ -692,7 +705,7 @@ rm -rf "$HOME/.config/waybar/configs/[TOP] Default$config_remove" \ "$HOME/.config/waybar/configs/[TOP] Default$config_remove (old v3)" \ "$HOME/.config/waybar/configs/[TOP] Default$config_remove (old v4)" 2>&1 | tee -a "$LOG" || true -printf "\n%.0s" {1..2} +printf "\n%.0s" {1..1} # for SDDM (sequoia_2) sddm_sequioa="/usr/share/sddm/themes/sequoia_2" @@ -817,15 +830,15 @@ cleanup_backups # symlinks for waybar style ln -sf "$waybar_style" "$HOME/.config/waybar/style.css" && \ -printf "\n%.0s" {1..2} +printf "\n%.0s" {1..1} # initialize wallust to avoid config error on hyprland wallust run -s $wallpaper 2>&1 | tee -a "$LOG" printf "\n%.0s" {1..2} printf "${OK} GREAT! KooL's Hyprland-Dots is now Loaded & Ready !!! " -printf "\n%.0s" {1..2} +printf "\n%.0s" {1..1} printf "${INFO} However, it is ${MAGENTA}HIGHLY SUGGESTED${RESET} to logout and re-login or better reboot to avoid any issues" -printf "\n%.0s" {1..2} +printf "\n%.0s" {1..1} printf "${SKY_BLUE}Thank you${RESET} for using ${MAGENTA}KooL's Hyprland Configuration${RESET}... ${YELLOW}ENJOY!!!${RESET}" printf "\n%.0s" {1..3}
\ No newline at end of file |
