From 295382d268b00871db1b00c135814e9a803b7c85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dias?= Date: Tue, 1 Jul 2025 13:24:28 -0300 Subject: [PATCH 1/5] :books: docs(readme): add warning about ags v3 --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 448beea..8b2b089 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ # colorshell

(previously retrozinndev/Hyprland-Dots)

+> [!warning] +> [AGS v3](https://github.com/aylur/ags/blob/main) is going to be an official release soon(for now, it's only in the main branch)
+> I'm currently migrating this shell to the new AGS version. More info in [#12](https://github.com/retrozinndev/colorshell/issues/12). + > [!note] > My personal dotfiles are now on [retrozinndev/Hyprland-Dots](https://github.com/retrozinndev/Hyprland-Dots) From f30316fa19df3a6a73415fbbdf2d090ad088826b Mon Sep 17 00:00:00 2001 From: retrozinndev Date: Thu, 31 Jul 2025 19:40:16 -0300 Subject: [PATCH 2/5] :sparkles: feat(install, update-repo): allow standalone installation, improvements no need to clone repository to run the script anymoregit add install.sh update-repo.sh utils.sh --- install.sh | 58 ++++++++++++++++--------- update-repo.sh | 114 +++++++++++++++++++++++-------------------------- utils.sh | 46 ++++++++++++++------ 3 files changed, 125 insertions(+), 93 deletions(-) diff --git a/install.sh b/install.sh index 8335de5..710c7ed 100755 --- a/install.sh +++ b/install.sh @@ -1,17 +1,19 @@ #!/usr/bin/bash source ./utils.sh - set -e + trap "printf \"\nOk, quitting beacuse you entered an exit signal. (SIGINT).\n\"; exit 1" SIGINT trap "printf \"\nOh noo!! Some application just killed the script!\"; exit 2" SIGTERM -XDG_CONFIG_HOME=$(sh -c '[[ ! -z "$XDG_CONFIG_HOME" ]] && echo "$XDG_CONFIG_HOME" || echo "$HOME/.config"') +XDG_CONFIG_HOME=`[[ ! -z "$XDG_CONFIG_HOME" ]] && echo $XDG_CONFIG_HOME || echo $HOME/.config` + +skip_prompts=`[[ "$@" =~ "\-y" ]] && echo -n true` +is_standalone=`git remove -v && remote=\`git remote -v | head -n 1 | awk '{print $2}' | sed 's/.git$//g'\` || echo -n` +repo_directory=`[[ $is_standalone ]] && echo "/tmp/colorshell-git" || echo "."` function Apply_wallpapers() { - echo -n "Would you also like to apply the wallpapers folder? :3 [y/n] " - read answer - printf "\n" + Ask "Would you also like to apply the wallpapers folder? :3" if [[ $answer =~ "y" ]]; then echo "Thanks for choosing! Please remember that I am not the author of the wallpapers!" @@ -31,40 +33,57 @@ function Apply_wallpapers() { # Start # ######### +# makes bash force-load the script into memory to avoid issues when +# switching source to a tag +{ Print_header -echo -e "colorshell is a project made by retrozinndev. source: https://github.com/retrozinndev/colorshell\n" +echo -e "Colorshell is a project made by retrozinndev.\nhttps://github.com/retrozinndev/colorshell\n" sleep .5 echo "Welcome to the colorshell installation script!" # Warn user of possible problems that can happen -echo "!!!WARNING!!! By running this script, you assume total responsability for any issues that may occur with your filesystem" +Send_log warn "!! By running this script, you assume total responsability for any issues that may occur with your filesystem" -echo -n "Do you want to start the shell installation? [y/n] " -[[ ! $1 == "dots" ]] && read input || printf "\n" +[[ ! $1 == "dots" ]] && Ask "Do you want to start the shell installation?" -if [[ $1 == "dots" ]] || [[ $input =~ "y" ]]; then - Send_log "Starting installation...\n" +rm -rf $repo_directory 2> /dev/null +Send_log "cloning repository in \`$repo_directory\`..." +git clone https://github.com/retrozinndev/colorshell.git $repo_directory - for dir in ${config_dirs[@]}; do +if [[ $1 == "dots" ]] || [[ $answer == "y" ]]; then + Ask "Nice! Use the stable version instead of the unstable(git)?" + + if [[ ! $1 == "dots" ]] && [[ $answer == "y" ]]; then + Send_log "fetching latest release from colorshell repository" + latest_tag=`curl -s "$repo_api_url/releases" | jq -r '. | select(.[].prerelease == false) | .[0].tag_name'` + + Send_log "done fetching" + Send_log "checking out latest non-pre-release version: $latest_tag" + git -C $repo_directory checkout $latest_tag 1> /dev/null + fi + + Send_log "starting colorshell installation" + + for dir in ${config_dirs[@]}; do dest=$XDG_CONFIG_HOME/$dir echo "-> Installing $dir in $dest" mkdir -p "$dest" # create parents - if [[ -f "./$dir" ]]; then - rm -r "$dest" # delete unused directory - cp -f ./$dir "$dest" # copy actual file + if [[ -f "$repo_directory/$dir" ]]; then + rm -rf "$dest" # delete unused directory + cp -f $repo_directory/$dir "$dest" # copy actual file else - cp -rf ./$dir/* "$dest" # force-copy content + cp -rf $repo_directory/$dir/* "$dest" # force-copy content fi done echo "-> Copying default user config" - cp -rf ./hypr/user $XDG_CONFIG_HOME/hypr + cp -rf $repo_directory/hypr/user $XDG_CONFIG_HOME/hypr echo "-> Copying default hyprpaper.conf" - cp -f ./hypr/hyprpaper.conf $XDG_CONFIG_HOME/hypr + cp -f $repo_directory/hypr/hyprpaper.conf $XDG_CONFIG_HOME/hypr # Ask if user also wants to install default wallpapers Apply_wallpapers @@ -84,4 +103,5 @@ if [[ $1 == "dots" ]] || [[ $input =~ "y" ]]; then fi printf "Ok, doing as you said! Bye bye!\n" -exit 0 +exit +} diff --git a/update-repo.sh b/update-repo.sh index 8c1c700..02d780f 100644 --- a/update-repo.sh +++ b/update-repo.sh @@ -4,7 +4,8 @@ source ./utils.sh Check_current_dir() { if ! [[ -f ./utils.sh ]]; then - Send_log warn "Looks like you're not in the repository directory!\nPlease run this script from the repo directory to avoid problems." + Send_log warn "Looks like you're not in the repository directory! \ +Please run this script from the repo directory to avoid problems." Send_log "Exiting" sleep .5 exit 1 @@ -22,7 +23,7 @@ Clean_local() { Send_log "info" "Cleaning wallpapers..." rm -rf ./wallpapers - echo "Done cleaning." + Send_log "Done cleaning" } Update_local() { @@ -53,43 +54,42 @@ Update_local() { } Update_remote() { - echo "Git status:" - /bin/env git status - echo "Please type one of the dotfiles you want to push now(only one dir):" - printf "directory/file: " - read chosen_dir - if [[ -d $chosen_dir ]] || [[ -f $chosen_dir ]]; then - git add $chosen_dir - echo -n "Would you like to add more dirs to queue? [y/n] " - read add_more_dirs - if [[ $add_more_dirs =~ y ]]; then + git status + read -p "Single file/directory to add: " chosen + if [[ -d $chosen ]] || [[ -f $chosen ]]; then + git add $chosen + Ask "Add more files/directories to queue?" + if [[ $answer =~ y ]]; then Update_remote - else - commit_message="" - commit_description="" - push_changes="" - echo -en "(You can use emojis by typing its name between colons, e.g.: \":tada:\" for \"🎉\").\nCommit message: " - read commit_message - echo -n "Type commit description(leave blank if none): " - read commit_description - - echo "Committing changes..." - [[ ! -z $commit_description ]] && \ - git commit -m "$commit_message" -m "$commit_description" || \ - git commit -m "$commit_message" - - echo -n "Done! Do you want to push? If not, you'll go back to file selection [y/n] " - read push_changes - - if [[ $push_changes =~ "y" ]]; then - git push - echo "Done pushing!!" - else - Update_remote - fi + return fi + + commit_message="" + commit_description="" + push_changes="" + echo "You can use emojis by typing its name between colons, e.g.: \":tada:\" for \"🎉\"" + echo -n "Commit message: " + read commit_message + echo -n "Type commit description(leave blank if none): " + read commit_description + + Send_log "Committing changes..." + [[ ! -z $commit_description ]] && \ + git commit -m "$commit_message" -m "$commit_description" || \ + git commit -m "$commit_message" + + Send_log "Done!" + Ask "Push changes now? If not, you'll go back to the queue step" + + if [[ $answer == y ]]; then + git push + Send_log "Done pushing!" + return + fi + + Update_remote else - echo "Looks like this directory does not exist! Try taking a look at the dir list." + echo "Looks like this file/directory does not exist." Update_remote fi @@ -99,38 +99,32 @@ Update_remote() { Check_current_dir Print_header -printf "\n" -echo "!!WARNING!! Running this script may override all data in current repo with host configurations." -echo "This script is intended to be used only by the dotfiles owner" -printf "\n" +Send_log warn "!! Running this script may override all data in the local repo with host files" +Send_log warn "This script is intended to be used only by the dotfiles owner\n" -echo "Please run this script in it's current directory to avoid issues" -echo "Tip: Press Ctrl + C to stop script at any time" +Send_log "Please run this script in it's current directory to avoid issues" +Send_log "Tip: Press ^C([Ctrl] + [C]) to stop script at any time\n" -printf "\n" - -echo -n "Do you want to update local repository with host configurations? [y/n] " -read answer -if ! [[ $answer =~ y ]]; then +Ask "Update local repository with host configurations?" +if ! $answer == y; then Send_log "Exiting" - exit 1 + exit 0 fi -printf "\n" +printf '\n' Clean_local Update_local -echo -n "Would you like to commit to remote? (You will be prompted for commits) [y/n] " -read answer +if command -v git; then + Ask "Would you like to commit to remote? (You will be prompted for commits)" -if [[ $answer =~ y ]]; then - Update_remote - echo "Looks like it's done! Have a great day!" -else - echo "Ok, work's finished here! Have a great day!" + if $answer =~ y; then + Update_remote + echo "Looks like it's done! Have a great day!" + else + echo "Ok, work's finished here! Have a great day!" + fi + + git status fi - -env git status - -exit 0 diff --git a/utils.sh b/utils.sh index ade010a..9f5354e 100644 --- a/utils.sh +++ b/utils.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # This script contains useful functions to be used -# in other scripts from retrozindev's dotfiles. +# in other scripts from colorshell. # ---------- # Made by retrozinndev (João Dias) # Licensed under the MIT License @@ -23,6 +23,11 @@ config_dirs=( "ags" ) +# ------------- +# The repository's api url +# ------------- +repo_api_url=https://api.github.com/repos/retrozinndev/colorshell + # ------------- # Sends stdout log with type and message provided # in parameters. @@ -30,29 +35,22 @@ config_dirs=( # param $2 log message # ------------- function Send_log() { - log_message=$2 + log_message=`[[ -z $2 ]] && echo $1 || echo $2` + color="\e[34m" + log_type="info" - case ${1,,} in - "^warn(ing)$") + case "${1,,}" in + warn) color="\e[33m" log_type="warning" ;; - "^err(or)$") + err) color="\e[31m" log_type="error" ;; - - *) - color="\e[34m" - log_type="info" - ;; esac - if [[ -z $2 ]]; then - log_message=$1 - fi - echo -e "${color}[$log_type]\e[0m $log_message" } @@ -67,3 +65,23 @@ function Print_header() { echo "#############################" printf "\n" } + +# ------------- +# Ask a yes/no question to user +# Input answer is exported as $answer +# ------------- +function Ask() { + read -n 1 -p "$1 [y/n] " r + printf '\n' + export answer=$r +} + +# ------------- +# Ask a yes/no question to user +# Input answer is exported as $answer +# ------------- +function Choose() { + read -n 1 -p "$1 [y/n] " r + printf '\n' + export answer=$r +} From 2ec2c7af0fe712627ec597bc1ba83fcc8090bfd0 Mon Sep 17 00:00:00 2001 From: retrozinndev Date: Sun, 3 Aug 2025 16:08:32 -0300 Subject: [PATCH 3/5] :boom: fix(install): no utils script on standalone mode --- install.sh | 39 +++++++++++++++++++++++++++++---------- update-repo.sh | 2 +- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/install.sh b/install.sh index 710c7ed..d46fdf1 100755 --- a/install.sh +++ b/install.sh @@ -1,16 +1,30 @@ -#!/usr/bin/bash +#!/usr/bin/env bash -source ./utils.sh set -e trap "printf \"\nOk, quitting beacuse you entered an exit signal. (SIGINT).\n\"; exit 1" SIGINT -trap "printf \"\nOh noo!! Some application just killed the script!\"; exit 2" SIGTERM +trap "printf \"\nOh noo!! Some application just killed the script! (SIGTERM)\"; exit 2" SIGTERM XDG_CONFIG_HOME=`[[ ! -z "$XDG_CONFIG_HOME" ]] && echo $XDG_CONFIG_HOME || echo $HOME/.config` +XDG_CACHE_HOME=`[[ ! -z "$XDG_CACHE_HOME" ]] && echo $XDG_CACHE_HOME || echo $HOME/.cache` skip_prompts=`[[ "$@" =~ "\-y" ]] && echo -n true` -is_standalone=`git remove -v && remote=\`git remote -v | head -n 1 | awk '{print $2}' | sed 's/.git$//g'\` || echo -n` -repo_directory=`[[ $is_standalone ]] && echo "/tmp/colorshell-git" || echo "."` +is_standalone=`git remote -v && remote=\`git remote -v | head -n 1 | awk '{print $2}' | sed 's/.git$//g'\` || echo -n` +temp_dir="$XDG_CACHE_HOME/colorshell-installer" +repo_directory=`[[ $is_standalone ]] && echo "$temp_dir/repo" || echo "."` + + +# source utils script before installation +if $is_standalone; then + mkdir -p $temp_dir + # testing only, change to commented value before merging (hope I don't forget lol) + default_branch="standalone-installer" # `curl -s https://api.github.com/repos/retrozinndev/colorshell | jq -r .default_branch` + # get utils script + curl -s https://raw.githubusercontent.com/retrozinndev/colorshell/refs/heads/$default_branch/utils.sh > $temp_dir/utils.sh + source $temp_dir/utils.sh +else + source ./utils.sh +fi function Apply_wallpapers() { Ask "Would you also like to apply the wallpapers folder? :3" @@ -45,13 +59,18 @@ echo "Welcome to the colorshell installation script!" # Warn user of possible problems that can happen Send_log warn "!! By running this script, you assume total responsability for any issues that may occur with your filesystem" -[[ ! $1 == "dots" ]] && Ask "Do you want to start the shell installation?" +[[ ! $skip_prompts ]] && Ask "Do you want to start the shell installation?" -rm -rf $repo_directory 2> /dev/null -Send_log "cloning repository in \`$repo_directory\`..." -git clone https://github.com/retrozinndev/colorshell.git $repo_directory +if $is_standalone; then + Send_log "installer noticed that you don't have a local clone of colorshell yet" + rm -rf $repo_directory 2> /dev/null + Send_log "cloning repository in \`$repo_directory\`..." + git clone https://github.com/retrozinndev/colorshell.git $repo_directory +else + Send_log "installer detected that you're running the script from a local clone" +fi -if [[ $1 == "dots" ]] || [[ $answer == "y" ]]; then +if [[ $skip_prompts ]] || [[ $answer == "y" ]]; then Ask "Nice! Use the stable version instead of the unstable(git)?" if [[ ! $1 == "dots" ]] && [[ $answer == "y" ]]; then diff --git a/update-repo.sh b/update-repo.sh index 02d780f..abae4ca 100644 --- a/update-repo.sh +++ b/update-repo.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash source ./utils.sh From 0018047563883a4e9766d24a55dd9ac93e4fda58 Mon Sep 17 00:00:00 2001 From: retrozinndev Date: Sun, 3 Aug 2025 19:29:14 -0300 Subject: [PATCH 4/5] :boom: fix(update-repo): tried calling 'y' as a function lol --- update-repo.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/update-repo.sh b/update-repo.sh index abae4ca..6d60b66 100644 --- a/update-repo.sh +++ b/update-repo.sh @@ -1,9 +1,8 @@ #!/usr/bin/env bash - source ./utils.sh Check_current_dir() { - if ! [[ -f ./utils.sh ]]; then + if ! git remote -v 2> /dev/null; then Send_log warn "Looks like you're not in the repository directory! \ Please run this script from the repo directory to avoid problems." Send_log "Exiting" @@ -20,7 +19,7 @@ Clean_local() { fi done - Send_log "info" "Cleaning wallpapers..." + Send_log "Cleaning wallpapers..." rm -rf ./wallpapers Send_log "Done cleaning" @@ -59,7 +58,7 @@ Update_remote() { if [[ -d $chosen ]] || [[ -f $chosen ]]; then git add $chosen Ask "Add more files/directories to queue?" - if [[ $answer =~ y ]]; then + if $answer == "y"; then Update_remote return fi @@ -81,7 +80,7 @@ Update_remote() { Send_log "Done!" Ask "Push changes now? If not, you'll go back to the queue step" - if [[ $answer == y ]]; then + if $answer == "y"; then git push Send_log "Done pushing!" return @@ -106,7 +105,7 @@ Send_log "Please run this script in it's current directory to avoid issues" Send_log "Tip: Press ^C([Ctrl] + [C]) to stop script at any time\n" Ask "Update local repository with host configurations?" -if ! $answer == y; then +if ! $answer == "y"; then Send_log "Exiting" exit 0 fi @@ -119,7 +118,7 @@ Update_local if command -v git; then Ask "Would you like to commit to remote? (You will be prompted for commits)" - if $answer =~ y; then + if $answer == "y"; then Update_remote echo "Looks like it's done! Have a great day!" else From 7122daa82c84f98db5ce9a3ef1541add9e86b3c1 Mon Sep 17 00:00:00 2001 From: retrozinndev Date: Mon, 4 Aug 2025 14:12:30 -0300 Subject: [PATCH 5/5] :boom: fix(install): redirect stderr to null, so it doesn't panic --- install.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index d46fdf1..fc4c2f4 100755 --- a/install.sh +++ b/install.sh @@ -9,9 +9,10 @@ XDG_CONFIG_HOME=`[[ ! -z "$XDG_CONFIG_HOME" ]] && echo $XDG_CONFIG_HOME || echo XDG_CACHE_HOME=`[[ ! -z "$XDG_CACHE_HOME" ]] && echo $XDG_CACHE_HOME || echo $HOME/.cache` skip_prompts=`[[ "$@" =~ "\-y" ]] && echo -n true` -is_standalone=`git remote -v && remote=\`git remote -v | head -n 1 | awk '{print $2}' | sed 's/.git$//g'\` || echo -n` +is_standalone=`[[ $(git remote -v > /dev/null) ]] && remote=\`git remote -v | head -n 1 \ + | awk '{print $2}' | sed 's/.git$//g'\` echo -n $remote || echo -n` temp_dir="$XDG_CACHE_HOME/colorshell-installer" -repo_directory=`[[ $is_standalone ]] && echo "$temp_dir/repo" || echo "."` +repo_directory=`$is_standalone && echo "$temp_dir/repo" || echo "."` # source utils script before installation @@ -29,7 +30,7 @@ fi function Apply_wallpapers() { Ask "Would you also like to apply the wallpapers folder? :3" - if [[ $answer =~ "y" ]]; then + if $answer == "y"; then echo "Thanks for choosing! Please remember that I am not the author of the wallpapers!" echo "You can see sources in the repo: https://github.com/retrozinndev/colorshell/WALLPAPERS.md"