diff options
| author | JaKooLit <ejhay.games@gmail.com> | 2025-02-14 18:00:14 +0900 |
|---|---|---|
| committer | JaKooLit <ejhay.games@gmail.com> | 2025-02-14 18:00:14 +0900 |
| commit | 86ec85bfb60459fe51afbc0b572d9c1f3a74ed2c (patch) | |
| tree | 403ef5a80772249fbc9a2c285655cb82d221362b /config/hypr/scripts/KooLsDotsUpdate.sh | |
| parent | f9a295fc4f95a6c4b442fbb2b05ea45fbf8c0409 (diff) | |
updated.....updated notification is via waybar added to swaync group
Diffstat (limited to 'config/hypr/scripts/KooLsDotsUpdate.sh')
| -rwxr-xr-x | config/hypr/scripts/KooLsDotsUpdate.sh | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/config/hypr/scripts/KooLsDotsUpdate.sh b/config/hypr/scripts/KooLsDotsUpdate.sh index 8baf2b3a..067f42ae 100755 --- a/config/hypr/scripts/KooLsDotsUpdate.sh +++ b/config/hypr/scripts/KooLsDotsUpdate.sh @@ -1,47 +1,49 @@ #!/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 -# it utilizes curl and also has a default time of 60s if users dont do anything -# will only ran once you logged into your system. It will not continously pinging the KooL github +# simple bash script to check if 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 + notify-send -i $iDIR "ERROR "!?!?!!"" "Unable to find KooL's dots version . exiting.... " exit 1 fi -# KooL's Dots GitHub URL +# GitHub URL - KooL's dots branch="main" github_url="https://github.com/JaKooLit/Hyprland-Dots/tree/$branch/config/hypr/" -# Fetch the latest version from GitHub directly +# Fetch the version from GitHub URL - KooL's dots 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 +# Cant find GitHub URL - KooL's dots 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 +# Comparing local and github versions +if [ "$(echo -e "$github_version\n$local_version" | sort -V | head -n 1)" = "$github_version" ]; then + notify-send -i $iDIR "KooL Hyprland" "No update available" + exit 0 +else + # update available 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 + response=$($notify_cmd_shot "KooL Hyprland" "Update available! Update now?") case "$response" in "action1") if [ -d $KooL_Dots_DIR ]; then + if ! command -v kitty &> /dev/null; then + notify-send -i $iDIR "Need Kitty" "Kitty terminal not found. Please install Kitty terminal." + exit 1 + fi kitty -e bash -c " cd $KooL_Dots_DIR && git stash && @@ -49,6 +51,10 @@ if [ "$(echo -e "$github_version\n$local_version" | sort -V | tail -n 1)" = "$gi ./copy.sh " else + if ! command -v kitty &> /dev/null; then + notify-send -i $iDIR "Need Kitty" "Kitty terminal not found. Please install Kitty terminal." + exit 1 + fi kitty -e bash -c " git clone --depth=1 https://github.com/JaKooLit/Hyprland-Dots.git $KooL_Dots_DIR && cd $KooL_Dots_DIR && @@ -61,6 +67,4 @@ if [ "$(echo -e "$github_version\n$local_version" | sort -V | tail -n 1)" = "$gi exit 0 ;; esac -else - exit 0 fi |
