diff --git a/.install/apps.sh b/.install/apps.sh index 93203580..625c725f 100755 --- a/.install/apps.sh +++ b/.install/apps.sh @@ -8,11 +8,13 @@ echo -e "${GREEN}" figlet "ML4W Apps" echo -e "${NONE}" +# Create local applications folder if not exits if [ ! -d $HOME/.local/share/applications/ ] ;then mkdir $HOME/.local/share/applications echo ":: $HOME/.local/share/applications created" fi +# Copy desktop files to the correct locations sed -i "s|HOME|${HOME}|g" $HOME/dotfiles/apps/ml4w-welcome.desktop cp $HOME/dotfiles/apps/ml4w-welcome.desktop $HOME/.local/share/applications echo ":: ML4W Welcome App installed successfully" @@ -25,6 +27,8 @@ sed -i "s|HOME|${HOME}|g" $HOME/dotfiles/apps/ml4w-hyprland-settings.desktop cp $HOME/dotfiles/apps/ml4w-hyprland-settings.desktop $HOME/.local/share/applications echo ":: ML4W Hyprland Settings App installed successfully" echo + +# Execute hyprctl from the Settings app if [ -f ~/.config/ml4w-hyprland-settings/hyprctl.sh ] ;then echo ":: Starting restore from ML4W Hyprland Settings App" ~/.config/ml4w-hyprland-settings/hyprctl.sh diff --git a/.install/packages/general-packages.sh b/.install/packages/general-packages.sh index d54e91aa..a2df3d33 100644 --- a/.install/packages/general-packages.sh +++ b/.install/packages/general-packages.sh @@ -31,7 +31,7 @@ packagesPacman=( "tumbler" "papirus-icon-theme" "breeze-icons" - "polkit-kde-agent" + "polkit-gnome" "brightnessctl" "gum" "man-pages" diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ab83ec1..85f77acf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,10 @@ -Version 2.9.2.2 -https://gitlab.com/stephan-raabe/dotfiles/-/releases/2.9.2.2 +Version 2.9.3 +https://gitlab.com/stephan-raabe/dotfiles/-/releases/2.9.3 -------------------------------------------------------- - ML4W .bashrc can be extended by adding a file .bashrc_custom in your home directory to create custom aliases and more - Adding Missioncontrol as new systeminfo app - New animation variation animations-dynamic.conf. Requires some resources and is therefore not recommended for installations on virtual machines or slower systems. Can be selected in the ML4W Dotfiles Settings app. - New repository folder structure. All configuration dotfiles are now separated from the installer in the folder dotfiles -- Switched from polkit-gnome to polkit-kde-agent due to it's recommendation on Hyprland Wiki Version 2.9.2.1 https://gitlab.com/stephan-raabe/dotfiles/-/releases/2.9.2.1 diff --git a/README.md b/README.md index 093ee028..d96077cd 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,37 @@ -# ML4W Hyprland Dotfiles 2.9.2.2 RC4 +# ML4W Hyprland Dotfiles 2.9.3 An advanced configuration of Hyprland for Arch Linux based distributions. This package includes an installation script to install and setup the required components. -[![Screenshot](https://gitlab.com/stephan-raabe/dotfiles/-/wikis/uploads/5402287acd05825a9581e8bb261c465c/image.png "Screenshot")](![screenshots/screenshot2.png](https://gitlab.com/stephan-raabe/dotfiles/-/wikis/uploads/5402287acd05825a9581e8bb261c465c/image.png)) - -The ML4W Dotfiles are available as - -- main release (Official release): [https://gitlab.com/stephan-raabe/dotfiles](https://gitlab.com/stephan-raabe/dotfiles) -- rolling release (Development release): [https://gitlab.com/stephan-raabe/dotfiles/-/tree/dev](https://gitlab.com/stephan-raabe/dotfiles/-/tree/dev) +[![Screenshot](https://gitlab.com/stephan-raabe/dotfiles/-/wikis/uploads/964d54d46d1a602bb414311df48b1695/image.png "Screenshot")](![screenshots/screenshot2.png](hhttps://gitlab.com/stephan-raabe/dotfiles/-/wikis/uploads/964d54d46d1a602bb414311df48b1695/image.png)) YouTube Video [https://youtu.be/HMxHUvN6VGo](https://youtu.be/GHYk1Iv4GkY) ## Installation -The installation should work on all Arch Linux based distributions. [You can find more information here](https://gitlab.com/stephan-raabe/dotfiles/-/wikis/home). +The installation should work on all Arch Linux based distributions. [You can find more information here](hhttps://github.com/mylinuxforwork/dotfiles/wiki). The easiest way is to use the setup.sh script. The script will download all files from GitLab and start the installation automatically. Just copy/enter the following command into your terminal. ``` -bash <(curl -s https://gitlab.com/stephan-raabe/dotfiles/-/raw/main/setup.sh) +bash <(curl -s https://raw.githubusercontent.com/mylinuxforwork/dotfiles/main/setup.sh) ``` +The installer will ask you to select between: + +- main release (Latest official release): [https://github.com/mylinuxforwork/dotfiles/releases/latest](https://github.com/mylinuxforwork/dotfiles/releases/latest) +- rolling release (Development release): [https://github.com/mylinuxforwork/dotfiles](https://github.com/mylinuxforwork/dotfiles) + > PLEASE NOTE: Every Linux distribution, setup and personal configuration can be different. Therefore, I cannot guarantee that the ML4W Dotfiles will work everywhere. Installation at your own risk. ## Documentation (Wiki) -You can find the complete documentation of the ML4W Dotfiles in the Wiki. [Open the Wiki here](https://gitlab.com/stephan-raabe/dotfiles/-/wikis/home) +You can find the complete documentation of the ML4W Dotfiles in the Wiki. [Open the Wiki here](https://github.com/mylinuxforwork/dotfiles/wiki) ## Contributing -Thanks for using the ML4W Dotfiles on your system. If you find a problem or a bug, please [report your issue on this page](https://gitlab.com/stephan-raabe/dotfiles/-/issues/?sort=created_date&state=opened). +Thanks for using the ML4W Dotfiles on your system. If you find a problem or a bug, please [report your issue on this page](https://github.com/mylinuxforwork/dotfiles/issues). You can also visit the [ML4W Discord Server](https://discord.gg/c4fJK7Za3g) to start a discussion with other users. @@ -41,7 +41,7 @@ You can also visit the [ML4W Discord Server](https://discord.gg/c4fJK7Za3g) to s ## Wallpaper repository -You can find my wallpaper collection in the repository https://gitlab.com/stephan-raabe/wallpaper +You can find my wallpaper collection in the repository https://github.com/mylinuxforwork/wallpaper ## Special Thanks diff --git a/dotfiles/.version/name b/dotfiles/.version/name index 860382f4..eafef0d4 100644 --- a/dotfiles/.version/name +++ b/dotfiles/.version/name @@ -1 +1 @@ -2.9.2.2RC4 \ No newline at end of file +2.9.3 \ No newline at end of file diff --git a/dotfiles/.version/update.sh b/dotfiles/.version/update.sh index df21db7f..928b03f6 100755 --- a/dotfiles/.version/update.sh +++ b/dotfiles/.version/update.sh @@ -1,10 +1,49 @@ #!/bin/bash +repo="mylinuxforwork/dotfiles" + +# Get latest tag from GitHub +get_latest_release() { + curl --silent "https://api.github.com/repos/$repo/releases/latest" | # Get latest release from GitHub api + grep '"tag_name":' | # Get tag line + sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value +} + +# Calculate version string +calc_latest_version() { + latest_release=$(get_latest_release "mylinuxforwork/hyprland-dotfiles") + IFS='.' read -r -a array <<< "$latest_release" + + # version pos 1 + v1="${array[0]}" + + # version pos 2 + v2="${array[1]}" + l2=${#v2} + if [ $l2 -eq 1 ] ;then + v2="00$v2" + elif [ $l2 -eq 2 ] ;then + v2="0$v2" + fi + + # version pos 3 + v3="${array[2]}" + l3=${#v3} + if [ $l3 -eq 1 ] ;then + v3="00$v3" + elif [ $l3 -eq 2 ] ;then + v3="0$v3" + fi + + echo "$v1$v2$v3" +} + # Check for internet connection if ping -q -c 1 -W 1 google.com >/dev/null; then + version=$(cat ~/dotfiles/.version/version) - online=$(curl -s https://gitlab.com/stephan-raabe/dotfiles/-/raw/main/.version/version?ref_type=heads) - if [ "$version" -lt "$online" ]; then + online=$(calc_latest_version) + if [ $((version)) -lt $((online)) ]; then # Update available echo "0" else diff --git a/dotfiles/.version/version b/dotfiles/.version/version index 787b2cc8..5694a4e3 100644 --- a/dotfiles/.version/version +++ b/dotfiles/.version/version @@ -1 +1 @@ -2922 \ No newline at end of file +2009003 \ No newline at end of file diff --git a/dotfiles/apps/ML4W_Dotfiles_Settings-x86_64.AppImage b/dotfiles/apps/ML4W_Dotfiles_Settings-x86_64.AppImage index f72f2075..56fed291 100755 Binary files a/dotfiles/apps/ML4W_Dotfiles_Settings-x86_64.AppImage and b/dotfiles/apps/ML4W_Dotfiles_Settings-x86_64.AppImage differ diff --git a/dotfiles/apps/ML4W_Hyprland_Settings-x86_64.AppImage b/dotfiles/apps/ML4W_Hyprland_Settings-x86_64.AppImage index 1013ec2b..252a4d49 100755 Binary files a/dotfiles/apps/ML4W_Hyprland_Settings-x86_64.AppImage and b/dotfiles/apps/ML4W_Hyprland_Settings-x86_64.AppImage differ diff --git a/dotfiles/apps/ML4W_Welcome-x86_64.AppImage b/dotfiles/apps/ML4W_Welcome-x86_64.AppImage index e98c5caf..1a15469f 100755 Binary files a/dotfiles/apps/ML4W_Welcome-x86_64.AppImage and b/dotfiles/apps/ML4W_Welcome-x86_64.AppImage differ diff --git a/dotfiles/eww/ml4w-sidebar/eww.yuck b/dotfiles/eww/ml4w-sidebar/eww.yuck index e06c9b95..3df24a48 100644 --- a/dotfiles/eww/ml4w-sidebar/eww.yuck +++ b/dotfiles/eww/ml4w-sidebar/eww.yuck @@ -72,8 +72,8 @@ ;; ** Windows ************************************************************************* (defwindow close - :geometry (geometry :x "1px" - :y "-1px" + :geometry (geometry :x "20px" + :y "20px" :width "44px" :height "44px" :anchor "top right") @@ -82,8 +82,8 @@ (close)) (defwindow ml4wlauncher - :geometry (geometry :x "13px" - :y "10px" + :geometry (geometry :x "30px" + :y "30px" :width "480px" :anchor "top right") :stacking "fg" diff --git a/dotfiles/hypr/conf/autostart.conf b/dotfiles/hypr/conf/autostart.conf index 8908be13..341e19ee 100644 --- a/dotfiles/hypr/conf/autostart.conf +++ b/dotfiles/hypr/conf/autostart.conf @@ -6,7 +6,8 @@ exec-once = ~/dotfiles/hypr/scripts/xdg.sh # Start Polkit -exec-once=/usr/lib/polkit-kde-authentication-agent-1 +# Test Polkit pkexec --user username alacritty +exec-once=/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 # Load Dunst Notification Manager exec-once = dunst diff --git a/dotfiles/hypr/conf/environments/kvm.conf b/dotfiles/hypr/conf/environments/kvm.conf index 442cebea..f24b6c0b 100644 --- a/dotfiles/hypr/conf/environments/kvm.conf +++ b/dotfiles/hypr/conf/environments/kvm.conf @@ -7,4 +7,7 @@ # KVM Environment env = WLR_RENDERER_ALLOW_SOFTWARE, 1 -env = WLR_NO_HARDWARE_CURSORS, 1 \ No newline at end of file + +cursor { + no_hardware_cursors = true +} \ No newline at end of file diff --git a/dotfiles/hypr/conf/environments/nvidia.conf b/dotfiles/hypr/conf/environments/nvidia.conf index d9b4161c..0fe64b2d 100644 --- a/dotfiles/hypr/conf/environments/nvidia.conf +++ b/dotfiles/hypr/conf/environments/nvidia.conf @@ -10,4 +10,8 @@ env = LIBVA_DRIVER_NAME,nvidia env = GBM_BACKEND,nvidia-drm env = __GLX_VENDOR_LIBRARY_NAME,nvidia # env = __GL_VRR_ALLOWED,1 -# env = WLR_DRM_NO_ATOMIC,1 \ No newline at end of file +# env = WLR_DRM_NO_ATOMIC,1 + +cursor { + no_hardware_cursors = true +} \ No newline at end of file diff --git a/dotfiles/hypr/conf/ml4w.conf b/dotfiles/hypr/conf/ml4w.conf index ed6df2d0..43bbdfb8 100644 --- a/dotfiles/hypr/conf/ml4w.conf +++ b/dotfiles/hypr/conf/ml4w.conf @@ -6,10 +6,10 @@ windowrulev2 = float,class:(.*org.pulseaudio.pavucontrol.*) windowrulev2 = size 700 600,class:(.*org.pulseaudio.pavucontrol.*) windowrulev2 = center,class:(.*org.pulseaudio.pavucontrol.*) +windowrulev2 = pin,class:(.*org.pulseaudio.pavucontrol.*) # OpenAI ChatGPT floating windowrulev2 = float,title:(ChatGPT.*) - windowrulev2 = float,title:(.*chat.openai.com.*) windowrulev2 = size 500 50%,title:(.*chat.openai.com.*) windowrulev2 = move 20 70,title:(.*chat.openai.com.*) @@ -18,33 +18,52 @@ windowrulev2 = move 20 70,title:(.*chat.openai.com.*) windowrulev2 = float,class:(.*waypaper.*) windowrulev2 = size 800 700,class:(.*waypaper.*) windowrulev2 = center,class:(.*waypaper.*) +windowrulev2 = pin,class:(.*waypaper.*) # ML4W Welcome App floating windowrulev2 = float,class:(com.ml4w.welcome) windowrulev2 = size 700 600,class:(com.ml4w.welcome) windowrulev2 = center,class:(com.ml4w.welcome) +windowrulev2 = pin,class:(com.ml4w.welcome) windowrulev2 = float,class:(ml4w-welcome.py) windowrulev2 = size 400 500,class:(ml4w-welcome.py) windowrulev2 = center,class:(ml4w-welcome.py) +windowrulev2 = pin,class:(ml4w-welcome.py) # ML4W Settings App floating windowrulev2 = float,class:(com.ml4w.dotfilessettings) windowrulev2 = size 700 600,class:(com.ml4w.dotfilessettings) windowrulev2 = move 10% 20%,class:(com.ml4w.dotfilessettings) +windowrulev2 = pin,class:(com.ml4w.dotfilessettings) windowrulev2 = float,class:(ml4w-dotfiles-settings.py) windowrulev2 = size 400 500,class:(ml4w-dotfiles-settings.py) windowrulev2 = move 10% 20%,class:(ml4w-dotfiles-settings.py) +windowrulev2 = pin,class:(ml4w-dotfiles-settings.py) # ML4W Hyprland App floating windowrulev2 = float,class:(com.ml4w.hyprland.settings) windowrulev2 = size 700 600,class:(com.ml4w.hyprland.settings) windowrulev2 = center,class:(com.ml4w.hyprland.settings) +windowrulev2 = pin,class:(com.ml4w.hyprland.settings) windowrulev2 = float,class:(ml4w-hyprland-settings.py) windowrulev2 = size 700 600,class:(ml4w-hyprland-settings.py) windowrulev2 = center,class:(ml4w-hyprland-settings.py) +windowrulev2 = pin,class:(ml4w-hyprland-settings.py) + +# System Mission Center +windowrulev2 = float, title:^(Mission Center)$ +windowrulev2 = pin, title:^(Mission Center)$ +windowrulev2 = center, title:^(Mission Center)$ +windowrulev2 = size 900 600, title:^(Mission Center)$ + +# Hyprland Share Picker +windowrulev2 = float, class:(hyprland-share-picker) +windowrulev2 = pin, class:(hyprland-share-picker) +windowrulev2 = center, title:class:(hyprland-share-picker) +windowrulev2 = size 600 400,class:(hyprland-share-picker) # General floating windowrulev2 = float,class:(dotfiles-floating) diff --git a/dotfiles/hypr/conf/windowrules/default.conf b/dotfiles/hypr/conf/windowrules/default.conf index 86b137f7..b9bae08b 100644 --- a/dotfiles/hypr/conf/windowrules/default.conf +++ b/dotfiles/hypr/conf/windowrules/default.conf @@ -9,3 +9,8 @@ windowrule = float,^(pavucontrol)$ windowrule = float,^(blueman-manager)$ windowrule = float,^(nm-connection-editor)$ windowrule = float,^(qalculate-gtk)$ + +# Browser Picture in Picture +windowrulev2 = float, title:^(Picture-in-Picture)$ +windowrulev2 = pin, title:^(Picture-in-Picture)$ +windowrulev2 = move 69.5% 4%, title:^(Picture-in-Picture)$ diff --git a/dotfiles/hypr/hyprlock.conf b/dotfiles/hypr/hyprlock.conf index a46da129..deae0245 100644 --- a/dotfiles/hypr/hyprlock.conf +++ b/dotfiles/hypr/hyprlock.conf @@ -48,7 +48,7 @@ label { color = rgba(200, 200, 200, 1.0) font_size = 55 font_family = Fira Semibold - position = -100, -40 + position = -100, 70 halign = right valign = bottom shadow_passes = 5 diff --git a/dotfiles/hypr/scripts/toggleallfloat.sh b/dotfiles/hypr/scripts/toggleallfloat.sh index fb6737ca..6ff58f38 100755 --- a/dotfiles/hypr/scripts/toggleallfloat.sh +++ b/dotfiles/hypr/scripts/toggleallfloat.sh @@ -9,3 +9,4 @@ # ----------------------------------------------------- hyprctl dispatch workspaceopt allfloat +notify-send "Windows on this workspace toggled to floating/tiling" diff --git a/dotfiles/hypr/scripts/wallpaper.sh b/dotfiles/hypr/scripts/wallpaper.sh index 41734c04..affdf224 100755 --- a/dotfiles/hypr/scripts/wallpaper.sh +++ b/dotfiles/hypr/scripts/wallpaper.sh @@ -117,6 +117,11 @@ output=${wal_tpl//WALLPAPER/$used_wallpaper} echo "$output" > $HOME/dotfiles/hypr/hyprpaper.conf hyprpaper & > /dev/null 2>&1 +# ----------------------------------------------------- +# Reload Waybar +# ----------------------------------------------------- +~/dotfiles/waybar/launch.sh + # ----------------------------------------------------- # Created blurred wallpaper # ----------------------------------------------------- diff --git a/dotfiles/waybar/themes/ml4w-blur/style.css b/dotfiles/waybar/themes/ml4w-blur/style.css index 406ed5a2..4569c864 100644 --- a/dotfiles/waybar/themes/ml4w-blur/style.css +++ b/dotfiles/waybar/themes/ml4w-blur/style.css @@ -133,6 +133,13 @@ window#waybar.empty #window { padding: 0px 5px 0px 5px; } +#taskbar.empty { + background:transparent; + border:0; + padding:0; + margin:0; +} + /* ----------------------------------------------------- * Modules * ----------------------------------------------------- */ diff --git a/dotfiles/waybar/themes/ml4w/style.css b/dotfiles/waybar/themes/ml4w/style.css index 1539a0f3..03521f40 100644 --- a/dotfiles/waybar/themes/ml4w/style.css +++ b/dotfiles/waybar/themes/ml4w/style.css @@ -134,6 +134,13 @@ window#waybar.empty #window { padding: 0px 5px 0px 5px; } +#taskbar.empty { + background:transparent; + border:0; + padding:0; + margin:0; +} + /* ----------------------------------------------------- * Modules * ----------------------------------------------------- */ diff --git a/setup.sh b/setup.sh index 966ea4da..26c3fa83 100755 --- a/setup.sh +++ b/setup.sh @@ -1,6 +1,22 @@ #!/bin/bash clear +repo="mylinuxforwork/dotfiles" + +# Get latest tag from GitHub +get_latest_release() { + curl --silent "https://api.github.com/repos/$repo/releases/latest" | # Get latest release from GitHub api + grep '"tag_name":' | # Get tag line + sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value +} + +# Get latest zip from GitHub +get_latest_zip() { + curl --silent "https://api.github.com/repos/$repo/releases/latest" | # Get latest release from GitHub api + grep '"zipball_url":' | # Get tag line + sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value +} + # Check if package is installed _isInstalledPacman() { package="$1"; @@ -53,7 +69,7 @@ cat <<"EOF" |___|_| |_|___/\__\__,_|_|_|\___|_| EOF -echo "for ML4W Dotfiles" +echo "for ML4W Dotfiles $(get_latest_release)" echo echo -e "${NONE}" echo "This script will support you to download and install the ML4W Dotfiles". @@ -92,6 +108,9 @@ fi if [ -d $HOME/Downloads/dotfiles ] ;then rm -rf $HOME/Downloads/dotfiles fi +if [ -d $HOME/Downloads/dotfiles_temp ] ;then + rm -rf $HOME/Downloads/dotfiles_temp +fi if [ -d $HOME/Downloads/dotfiles-main ] ;then rm -rf $HOME/Downloads/dotfiles-main fi @@ -121,19 +140,38 @@ echo echo "Please choose between the main-release or the rolling-release (development version):" version=$(gum choose "main-release" "rolling-release") if [ "$version" == "main-release" ] ;then - git clone -b main --single-branch --depth 1 https://gitlab.com/stephan-raabe/dotfiles.git ~/Downloads/dotfiles + wget -O ~/Downloads/dotfiles.zip $(get_latest_zip) + echo ":: Download complete." + + mkdir -p ~/Downloads/dotfiles_temp + mkdir -p ~/Downloads/dotfiles + + unzip -o -q ~/Downloads/dotfiles.zip -d ~/Downloads/dotfiles_temp/ + echo ":: Unzip complete." + + zip_folder="$(ls ~/Downloads/dotfiles_temp/)" + mv ~/Downloads/dotfiles_temp/$zip_folder/* ~/Downloads/dotfiles/ + echo ":: Dotfiles moved into installation directory" + + if [ -d $HOME/Downloads/dotfiles_temp ] ;then + rm -rf $HOME/Downloads/dotfiles_temp + fi + if [ -f $HOME/Downloads/dotfiles.zip ] ;then + rm $HOME/Downloads/dotfiles.zip + fi + echo ":: Cleanup complete" + elif [ "$version" == "rolling-release" ] ;then - git clone -b dev --single-branch --depth 1 https://gitlab.com/stephan-raabe/dotfiles.git ~/Downloads/dotfiles + git clone --depth 1 https://github.com/mylinuxforwork/dotfiles.git ~/Downloads/dotfiles + echo ":: Clone complete." else exit 130 fi -echo ":: Download complete." # Change into dotfiles folder cd $HOME/Downloads/dotfiles echo ":: Changed into ~/Downloads/dotfiles/" echo - # Start Spinner gum spin --spinner dot --title "Starting the installation now..." -- sleep 3 ./install.sh \ No newline at end of file diff --git a/update.sh b/update.sh index 7c55e328..c25de46a 100755 --- a/update.sh +++ b/update.sh @@ -7,65 +7,101 @@ # |_| # clear + +repo="mylinuxforwork/dotfiles" + +# Get latest tag from GitHub +get_latest_release() { + curl --silent "https://api.github.com/repos/$repo/releases/latest" | # Get latest release from GitHub api + grep '"tag_name":' | # Get tag line + sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value +} + +# Get latest zip from GitHub +get_latest_zip() { + curl --silent "https://api.github.com/repos/$repo/releases/latest" | # Get latest release from GitHub api + grep '"zipball_url":' | # Get tag line + sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value +} + sleep 1 figlet "Update" +echo +echo "to ML4W Dotfiles $(get_latest_release)" if [ ! -d $HOME/Downloads ] ;then echo "ERROR:: $HOME/Downloads folder not found." exit fi echo if gum confirm "Do you want to start the update now?" ;then + echo ":: Update started" +elif [ $? -eq 130 ]; then + echo ":: Update canceled" + exit +else + echo ":: Update canceled" + exit +fi - # Remove existing download folder and zip files - if [ -f $HOME/Downloads/dotfiles-main.zip ] ;then - rm $HOME/Downloads/dotfiles-main.zip - fi - if [ -f $HOME/Downloads/dotfiles-dev.zip ] ;then - rm $HOME/Downloads/dotfiles-dev.zip - fi - if [ -f $HOME/Downloads/dotfiles.zip ] ;then - rm $HOME/Downloads/dotfiles.zip - fi - if [ -d $HOME/Downloads/dotfiles ] ;then - rm -rf $HOME/Downloads/dotfiles - fi - if [ -d $HOME/Downloads/dotfiles-main ] ;then - rm -rf $HOME/Downloads/dotfiles-main - fi - if [ -d $HOME/Downloads/dotfiles-dev ] ;then - rm -rf $HOME/Downloads/dotfiles-dev - fi - echo +# Remove existing download folder and zip files +if [ -f $HOME/Downloads/dotfiles-main.zip ] ;then + rm $HOME/Downloads/dotfiles-main.zip +fi +if [ -f $HOME/Downloads/dotfiles-dev.zip ] ;then + rm $HOME/Downloads/dotfiles-dev.zip +fi +if [ -f $HOME/Downloads/dotfiles.zip ] ;then + rm $HOME/Downloads/dotfiles.zip +fi +if [ -d $HOME/Downloads/dotfiles ] ;then + rm -rf $HOME/Downloads/dotfiles +fi +if [ -d $HOME/Downloads/dotfiles_temp ] ;then + rm -rf $HOME/Downloads/dotfiles_temp +fi +if [ -d $HOME/Downloads/dotfiles-main ] ;then + rm -rf $HOME/Downloads/dotfiles-main +fi +if [ -d $HOME/Downloads/dotfiles-dev ] ;then + rm -rf $HOME/Downloads/dotfiles-dev +fi - # Select the dotfiles version - echo "Please choose between the main-release or the rolling-release (development version):" - version=$(gum choose "main-release" "rolling-release") - if [ "$version" == "main-release" ] ;then - git clone -b main --single-branch --depth 1 https://gitlab.com/stephan-raabe/dotfiles.git ~/Downloads/dotfiles - elif [ "$version" == "rolling-release" ] ;then - git clone -b dev --single-branch --depth 1 https://gitlab.com/stephan-raabe/dotfiles.git ~/Downloads/dotfiles - else - exit 130 - fi +# Select the dotfiles version +echo "Please choose between the main-release or the rolling-release (development version):" +version=$(gum choose "main-release" "rolling-release") +if [ "$version" == "main-release" ] ;then + wget -O ~/Downloads/dotfiles.zip $(get_latest_zip) echo ":: Download complete." - echo - # Start the installatiom - if gum confirm "Do you want to start the update now?" ;then - # Change into dotfiles folder - cd $HOME/Downloads/dotfiles/ - echo ":: Changed into ~/Downloads/dotfiles/" + mkdir -p ~/Downloads/dotfiles_temp + mkdir -p ~/Downloads/dotfiles - # Start Spinner - gum spin --spinner dot --title "Starting the update now..." -- sleep 3 - ./install.sh + unzip -o -q ~/Downloads/dotfiles.zip -d ~/Downloads/dotfiles_temp/ + echo ":: Unzip complete." - elif [ $? -eq 130 ]; then - exit 130 - else - echo "Installation canceled." - exit; + zip_folder="$(ls ~/Downloads/dotfiles_temp/)" + mv ~/Downloads/dotfiles_temp/$zip_folder/* ~/Downloads/dotfiles/ + echo ":: Dotfiles moved into installation directory" + + if [ -d $HOME/Downloads/dotfiles_temp ] ;then + rm -rf $HOME/Downloads/dotfiles_temp fi -elif [ $? -eq 130 ]; then + if [ -f $HOME/Downloads/dotfiles.zip ] ;then + rm $HOME/Downloads/dotfiles.zip + fi + echo ":: Cleanup complete" + +elif [ "$version" == "rolling-release" ] ;then + git clone --depth 1 https://github.com/mylinuxforwork/dotfiles.git ~/Downloads/dotfiles + echo ":: Clone complete." +else exit 130 -fi \ No newline at end of file +fi + +# Change into dotfiles folder +cd $HOME/Downloads/dotfiles +echo ":: Changed into ~/Downloads/dotfiles/" +echo +# Start Spinner +gum spin --spinner dot --title "Starting the installation now..." -- sleep 3 +./install.sh \ No newline at end of file