diff --git a/CHANGELOGS.md b/CHANGELOGS.md index f6ba853..5dc256f 100644 --- a/CHANGELOGS.md +++ b/CHANGELOGS.md @@ -2,6 +2,9 @@ ## 30 Apr 2024 - Updated hyprland.sh to install v0.34.0 Hyprland +- adding hypridle and hyprlock +- dropping swaylock-effects and swayidle +- adjusted to work with current Hyprland-Dots ## 22 Apr 2024 - Change dotfiles to specific version only as Debian and Ubuntu cant keep up with Hyprland development diff --git a/README.md b/README.md index 8a54de8..fd5a813 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,6 @@ ### ♨️♨️♨️ ATTENTION ♨️♨️♨️ 30 Apr 2024 - Due to fast development of Hyprland and most up to date requirement of hyprland, Hyprland version to be installed by this script will be older version. For now, the hyprland version to be installed with this script is v0.34.0 -### ♨️♨️♨️ ATTENTION ♨️♨️♨️ 22 Apr 2024 -- Pre-configured dotfiles to be downloaded here will be v2.2.6 only -- [`Hyprland-Dots v2.2.6`](https://github.com/JaKooLit/Hyprland-Dots/releases/tag/v2.2.6) -- This is because Debian/Ubuntu are very slow with Hyprland Development - > [!IMPORTANT] > install a backup tool like `snapper` or `timeshift`. and Backup your system before installing hyprland using this script. This script does NOT include uninstallation of packages diff --git a/install-scripts/00-hypr-pkgs.sh b/install-scripts/00-hypr-pkgs.sh index ce7e923..b7554d2 100755 --- a/install-scripts/00-hypr-pkgs.sh +++ b/install-scripts/00-hypr-pkgs.sh @@ -51,7 +51,6 @@ hypr_package_2=( mpv-mpris nvtop pamixer - swayidle vim ) diff --git a/install-scripts/dotfiles.sh b/install-scripts/dotfiles.sh index 5630cb0..bf492fb 100755 --- a/install-scripts/dotfiles.sh +++ b/install-scripts/dotfiles.sh @@ -1,51 +1,86 @@ #!/bin/bash # 💫 https://github.com/JaKooLit 💫 # -# Hyprland-Dots to download a specific release # - -# Define the specific release version to download -specific_version="v2.2.6" +# Hyprland-Dots to download from Releases # +if [[ $USE_PRESET = [Yy] ]]; then + source ./preset.sh +fi ## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## source "$(dirname "$(readlink -f "$0")")/Global_functions.sh" -printf "${NOTE} Downloading / Checking for existing Hyprland-Dots-${specific_version}.tar.gz...\n" +printf "${NOTE} Downloading / Checking for existing Hyprland-Dots.tar.gz...\n" -# Check if the specific release tarball exists -if [ -f "Hyprland-Dots-${specific_version}.tar.gz" ]; then - printf "${NOTE} Hyprland-Dots-${specific_version}.tar.gz found.\n" - echo -e "${OK} Hyprland-Dots-${specific_version}.tar.gz is already downloaded." - exit 0 +# Check if Hyprland-Dots.tar.gz exists +if [ -f Hyprland-Dots.tar.gz ]; then + printf "${NOTE} Hyprland-Dots.tar.gz found.\n" + + # Get the version from the existing tarball filename + existing_version=$(echo Hyprland-Dots.tar.gz | grep -oP 'v\d+\.\d+\.\d+' | sed 's/v//') + + # Fetch the tag_name for the latest release using the GitHub API + latest_version=$(curl -s https://api.github.com/repos/JaKooLit/Hyprland-Dots/releases/latest | grep "tag_name" | cut -d '"' -f 4 | sed 's/v//') + + # Check if versions match + if [ "$existing_version" = "$latest_version" ]; then + echo -e "${OK} Hyprland-Dots.tar.gz is up-to-date with the latest release ($latest_version)." + + # Sleep for 10 seconds before exiting + printf "${NOTE} No update found. Sleeping for 10 seconds...\n" + sleep 10 + exit 0 + else + echo -e "${WARN} Hyprland-Dots.tar.gz is outdated (Existing version: $existing_version, Latest version: $latest_version)." + if [[ -z $upgrade_choice ]]; then + read -p "Do you want to upgrade to the latest version? (y/n): " upgrade_choice + fi + if [ "$upgrade_choice" = "y" ]; then + echo -e "${NOTE} Proceeding to download the latest release." 2>&1 | tee -a "../Install-Logs/install-$(date +'%d-%H%M%S')_dotfiles.log" + + # Delete existing directories starting with JaKooLit-Hyprland-Dots + find . -type d -name 'JaKooLit-Hyprland-Dots*' -exec rm -rf {} + + rm -f Hyprland-Dots.tar.gz + printf "${WARN} Removed existing Hyprland-Dots.tar.gz.\n" + else + echo -e "${NOTE} User chose not to upgrade. Exiting..." 2>&1 | tee -a "../Install-Logs/install-$(date +'%d-%H%M%S')_dotfiles.log" + exit 0 + fi + fi fi -printf "${NOTE} Downloading the Hyprland-Dots-${specific_version} source code release...\n" +printf "${NOTE} Downloading the latest Hyprland source code release...\n" -# Fetch the tag name for the specific release using the GitHub API -release_info=$(curl -s "https://api.github.com/repos/JaKooLit/Hyprland-Dots/releases/tags/${specific_version}") -if [ -z "$release_info" ]; then - echo -e "${ERROR} Unable to fetch information for release ${specific_version}." 2>&1 | tee -a "../Install-Logs/install-$(date +'%d-%H%M%S')_dotfiles.log" +# Fetch the tag name for the latest release using the GitHub API +latest_tag=$(curl -s https://api.github.com/repos/JaKooLit/Hyprland-Dots/releases/latest | grep "tag_name" | cut -d '"' -f 4) + +# Check if the tag is obtained successfully +if [ -z "$latest_tag" ]; then + echo -e "${ERROR} Unable to fetch the latest tag information." 2>&1 | tee -a "../Install-Logs/install-$(date +'%d-%H%M%S')_dotfiles.log" exit 1 fi -# Get the tarball URL for the specific release -tarball_url=$(echo "$release_info" | grep "tarball_url" | cut -d '"' -f 4) +# Fetch the tarball URL for the latest release using the GitHub API +latest_tarball_url=$(curl -s https://api.github.com/repos/JaKooLit/Hyprland-Dots/releases/latest | grep "tarball_url" | cut -d '"' -f 4) # Check if the URL is obtained successfully -if [ -z "$tarball_url" ]; then - echo -e "${ERROR} Unable to fetch the tarball URL for release ${specific_version}." 2>&1 | tee -a "../Install-Logs/install-$(date +'%d-%H%M%S')_dotfiles.log" +if [ -z "$latest_tarball_url" ]; then + echo -e "${ERROR} Unable to fetch the tarball URL for the latest release." 2>&1 | tee -a "../Install-Logs/install-$(date +'%d-%H%M%S')_dotfiles.log" exit 1 fi -# Download the specific release source code tarball to the current directory -if curl -L "$tarball_url" -o "Hyprland-Dots-${specific_version}.tar.gz"; then - # Extract the contents of the tarball - tar -xzf "Hyprland-Dots-${specific_version}.tar.gz" || exit 1 +# Get the filename from the URL and include the tag name in the file name +file_name="Hyprland-Dots-${latest_tag}.tar.gz" - # Delete existing Hyprland-Dots +# Download the latest release source code tarball to the current directory +if curl -L "$latest_tarball_url" -o "$file_name"; then + # Extract the contents of the tarball + tar -xzf "$file_name" || exit 1 + + # delete existing Hyprland-Dots rm -rf JaKooLit-Hyprland-Dots # Identify the extracted directory - extracted_directory=$(tar -tf "Hyprland-Dots-${specific_version}.tar.gz" | grep -o '^[^/]\+' | uniq) + extracted_directory=$(tar -tf "$file_name" | grep -o '^[^/]\+' | uniq) # Rename the extracted directory to JaKooLit-Hyprland-Dots mv "$extracted_directory" JaKooLit-Hyprland-Dots || exit 1 @@ -56,9 +91,9 @@ if curl -L "$tarball_url" -o "Hyprland-Dots-${specific_version}.tar.gz"; then chmod +x copy.sh ./copy.sh - echo -e "${OK} Hyprland-Dots-${specific_version} release downloaded, extracted, and processed successfully. Check JaKooLit-Hyprland-Dots folder for more detailed install logs" 2>&1 | tee -a "../Install-Logs/install-$(date +'%d-%H%M%S')_dotfiles.log" + echo -e "${OK} Latest Dotfiles release downloaded, extracted, and processed successfully. Check JaKooLit-Hyprland-Dots folder for more detailed install logs" 2>&1 | tee -a "../Install-Logs/install-$(date +'%d-%H%M%S')_dotfiles.log" else - echo -e "${ERROR} Failed to download Hyprland-Dots-${specific_version} release." 2>&1 | tee -a "../Install-Logs/install-$(date +'%d-%H%M%S')_dotfiles.log" + echo -e "${ERROR} Failed to download the latest Dotfiles release." 2>&1 | tee -a "../Install-Logs/install-$(date +'%d-%H%M%S')_dotfiles.log" exit 1 fi diff --git a/install-scripts/hypridle.sh b/install-scripts/hypridle.sh new file mode 100755 index 0000000..b033120 --- /dev/null +++ b/install-scripts/hypridle.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# 💫 https://github.com/JaKooLit 💫 # +# hypidle # + +idle=( +libsdbus-c++-dev +) + +## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## +# Determine the directory where the script is located +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Change the working directory to the parent directory of the script +PARENT_DIR="$SCRIPT_DIR/.." +cd "$PARENT_DIR" || exit 1 + +source "$(dirname "$(readlink -f "$0")")/Global_functions.sh" + +# Set the name of the log file to include the current date and time +LOG="Install-Logs/install-$(date +%d-%H%M%S)_hypridle.log" +MLOG="install-$(date +%d-%H%M%S)_hypridle.log" + +# Installation of dependencies +printf "\n%s - Installing hypridle dependencies.... \n" "${NOTE}" + +for PKG1 in "${idle[@]}"; do + install_package "$PKG1" 2>&1 | tee -a "$LOG" + if [ $? -ne 0 ]; then + echo -e "\e[1A\e[K${ERROR} - $PKG1 install had failed, please check the install.log" + exit 1 + fi +done + +# Check if hypridle folder exists and remove it +if [ -d "hypridle" ]; then + printf "${NOTE} Removing existing hypridle folder...\n" + rm -rf "hypridle" +fi + +# Clone and build +printf "${NOTE} Installing hypridle...\n" +if git clone https://github.com/hyprwm/hypridle.git; then + cd hypridle || exit 1 + cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B ./build + cmake --build ./build --config Release --target hypridle -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` + if sudo cmake --install ./build 2>&1 | tee -a "$MLOG" ; then + printf "${OK} hypridle installed successfully.\n" 2>&1 | tee -a "$MLOG" + else + echo -e "${ERROR} Installation failed for hypridle." 2>&1 | tee -a "$MLOG" + fi + #moving the addional logs to Install-Logs directory + mv $MLOG ../Install-Logs/ || true + cd .. +else + echo -e "${ERROR} Download failed for hypridle." 2>&1 | tee -a "$LOG" +fi + +clear + + diff --git a/install-scripts/hyprlock.sh b/install-scripts/hyprlock.sh new file mode 100755 index 0000000..411e122 --- /dev/null +++ b/install-scripts/hyprlock.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# 💫 https://github.com/JaKooLit 💫 # +# hyprlock # + +lock=( +libmagic-dev +) + +## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## +# Determine the directory where the script is located +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Change the working directory to the parent directory of the script +PARENT_DIR="$SCRIPT_DIR/.." +cd "$PARENT_DIR" || exit 1 + +source "$(dirname "$(readlink -f "$0")")/Global_functions.sh" + +# Set the name of the log file to include the current date and time +LOG="Install-Logs/install-$(date +%d-%H%M%S)_hyprlock.log" +MLOG="install-$(date +%d-%H%M%S)_hyprlock.log" + +# Installation of dependencies +printf "\n%s - Installing hyprlock dependencies.... \n" "${NOTE}" + +for PKG1 in "${lock[@]}"; do + install_package "$PKG1" 2>&1 | tee -a "$LOG" + if [ $? -ne 0 ]; then + echo -e "\e[1A\e[K${ERROR} - $PKG1 install had failed, please check the install.log" + exit 1 + fi +done + +# Check if hyprlidle folder exists and remove it +if [ -d "hyprlock" ]; then + printf "${NOTE} Removing existing hyprlock folder...\n" + rm -rf "hyprlock" +fi + +# Clone and build hyprlock +printf "${NOTE} Installing hyprlock...\n" +if git clone https://github.com/hyprwm/hyprlock.git; then + cd hyprlock || exit 1 + cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B ./build + cmake --build ./build --config Release --target hyprlock -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` + if sudo cmake --install ./build 2>&1 | tee -a "$MLOG" ; then + printf "${OK} hyprlock installed successfully.\n" 2>&1 | tee -a "$MLOG" + else + echo -e "${ERROR} Installation failed for hyprlock." 2>&1 | tee -a "$MLOG" + fi + #moving the addional logs to Install-Logs directory + mv $MLOG ../Install-Logs/ || true + cd .. +else + echo -e "${ERROR} Download failed for hyprlock." 2>&1 | tee -a "$LOG" +fi + +clear + diff --git a/install-scripts/swaylock-effects.sh b/install-scripts/swaylock-effects.sh deleted file mode 100755 index ed2e99e..0000000 --- a/install-scripts/swaylock-effects.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# 💫 https://github.com/JaKooLit 💫 # -# Swaylock Effects # - -## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## -# Determine the directory where the script is located -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -# Change the working directory to the parent directory of the script -PARENT_DIR="$SCRIPT_DIR/.." -cd "$PARENT_DIR" || exit 1 - -source "$(dirname "$(readlink -f "$0")")/Global_functions.sh" - -# Set the name of the log file to include the current date and time -LOG="Install-Logs/install-$(date +%d-%H%M%S)_swaylock-effects2.log" -MLOG="install-$(date +%d-%H%M%S)_swaylock-effects.log" - -printf "${NOTE} Installing swaylock-effects\n" -# Check if swaylock-effects folder exists -if [ -d "swaylock-effects" ]; then - printf "${NOTE} swaylock-effects folder exists. Pulling latest changes...\n" - cd swaylock-effects || exit 1 - git pull origin master 2>&1 | tee -a "$MLOG" -else - printf "${NOTE} Cloning swaylock-effects repository...\n" - if git clone https://github.com/jirutka/swaylock-effects.git; then - cd swaylock-effects || exit 1 - else - echo -e "${ERROR} Download failed for swaylock-effects" 2>&1 | tee -a "$LOG" - exit 1 - fi -fi - -# Proceed with the installation steps -meson build -ninja -C build -sudo ninja -C build install 2>&1 | tee -a "$MLOG" - -# Moving logs into main Install-Logs -mv "$MLOG" ../Install-Logs/ || true -cd - || exit 1 - -clear \ No newline at end of file diff --git a/install.sh b/install.sh index 95eb670..05cec53 100755 --- a/install.sh +++ b/install.sh @@ -84,7 +84,6 @@ nvidia="" nwg="" rog="" sddm="" -swaylock="" thunar="" xdph="" zsh="" @@ -155,8 +154,6 @@ ask_yes_no "-Install XDG-DESKTOP-PORTAL-HYPRLAND? (For proper Screen Share ie OB printf "\n" ask_yes_no "-Install zsh & oh-my-zsh plus (OPTIONAL) pokemon-colorscripts for tty?" zsh printf "\n" -ask_yes_no "-Install swaylock-effects? (recommended - for screen locks)" swaylock -printf "\n" ask_yes_no "-Install nwg-look? (a GTK Theming app - lxappearance-like) WARN! This Package Takes long time to build!" nwg printf "\n" ask_yes_no "-Installing on Asus ROG Laptops?" rog @@ -179,6 +176,8 @@ execute_script "rofi-wayland.sh" execute_script "pywal.sh" execute_script "force-install.sh" execute_script "hyprlang.sh" +execute_script "hyprlock.sh" +execute_script "hyprlidle.sh" #execute_script "cliphist.sh" @@ -214,10 +213,6 @@ if [ "$zsh" == "Y" ]; then execute_script "zsh.sh" fi -if [ "$swaylock" == "Y" ]; then - execute_script "swaylock-effects.sh" -fi - if [ "$nwg" == "Y" ]; then execute_script "nwg-look.sh" fi