diff options
| author | Ja.KooLit <85185940+JaKooLit@users.noreply.github.com> | 2025-02-16 11:09:08 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-16 11:09:08 +0900 |
| commit | 8acfbb16d5ef45960a13cb9768517d3c418771a6 (patch) | |
| tree | 7b618f6cca7942c3d2876740fca3963092b2da21 /config/hypr/scripts/KooLsDotsUpdate.sh | |
| parent | 349f564bf307ad1ed99c87d028fccdecf7c1bdeb (diff) | |
| parent | 0c53ef536ca2f028672004e909daac5473e6110f (diff) | |
Merge pull request #556 from JaKooLit/development
Development to main feat. Rofi Themes
Diffstat (limited to 'config/hypr/scripts/KooLsDotsUpdate.sh')
| -rwxr-xr-x | config/hypr/scripts/KooLsDotsUpdate.sh | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/config/hypr/scripts/KooLsDotsUpdate.sh b/config/hypr/scripts/KooLsDotsUpdate.sh new file mode 100755 index 00000000..d0d454e6 --- /dev/null +++ b/config/hypr/scripts/KooLsDotsUpdate.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## +# 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/') +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 + +# GitHub URL - KooL's dots +branch="main" +github_url="https://github.com/JaKooLit/Hyprland-Dots/tree/$branch/config/hypr/" + +# 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//') + +# Cant find GitHub URL - KooL's dots version +if [ -z "$github_version" ]; then + exit 1 +fi + +# 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=$($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 && + git pull && + ./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 && + chmod +x copy.sh && + ./copy.sh + " + fi + ;; + "action2") + exit 0 + ;; + esac +fi |
