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 /config/hypr/scripts | |
| parent | 02c9626c1da104fbcdf32b4b11896e3b9f650531 (diff) | |
Introduction of KooL's hyprland dots notification update
Diffstat (limited to 'config/hypr/scripts')
| -rwxr-xr-x | config/hypr/scripts/KooLsDotsUpdate.sh | 63 | ||||
| -rwxr-xr-x | config/hypr/scripts/RofiEmoji.sh | 1 |
2 files changed, 63 insertions, 1 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" |
