diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..692ae59e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,6 @@ +root = true + +[*.sh] +indent_style = space +indent_size = 4 +end_of_line = lf diff --git a/.github/workflows/differential-shellcheck.yaml b/.github/workflows/differential-shellcheck.yaml new file mode 100644 index 00000000..f77883e1 --- /dev/null +++ b/.github/workflows/differential-shellcheck.yaml @@ -0,0 +1,38 @@ +# From ShellCheck wiki +# https://www.shellcheck.net/wiki/GitHub-Actions + +name: Differential ShellCheck +on: + push: + pull_request: + +permissions: + contents: read + +jobs: + lint: + runs-on: ubuntu-latest + + permissions: + # required for all workflows + security-events: write + + steps: + - name: Repository checkout + uses: actions/checkout@v4 + with: + # Differential ShellCheck requires full git history + fetch-depth: 0 + + - id: ShellCheck + name: Differential ShellCheck + uses: redhat-plumbers-in-action/differential-shellcheck@v5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - if: always() + name: Upload artifact with ShellCheck defects in SARIF format + uses: actions/upload-artifact@v4 + with: + name: Differential ShellCheck SARIF + path: ${{ steps.ShellCheck.outputs.sarif }} diff --git a/.github/workflows/shfmt.yaml b/.github/workflows/shfmt.yaml new file mode 100644 index 00000000..5f732a07 --- /dev/null +++ b/.github/workflows/shfmt.yaml @@ -0,0 +1,10 @@ +name: Shell Formatting +on: + pull_request: +jobs: + shfmt: + name: runner / shfmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: reviewdog/action-shfmt@v1 diff --git a/bin/ml4w-hyprland-setup b/bin/ml4w-hyprland-setup index 8d689f78..23044c13 100755 --- a/bin/ml4w-hyprland-setup +++ b/bin/ml4w-hyprland-setup @@ -1,32 +1,32 @@ #!/bin/bash -# __ __ _ _ ___ __ ____ _ __ _ _ -# | \/ | | | || \ \ / / | _ \ ___ | |_ / _(_) | ___ ___ +# __ __ _ _ ___ __ ____ _ __ _ _ +# | \/ | | | || \ \ / / | _ \ ___ | |_ / _(_) | ___ ___ # | |\/| | | | || |\ \ /\ / / | | | |/ _ \| __| |_| | |/ _ \/ __| # | | | | |__|__ _\ V V / | |_| | (_) | |_| _| | | __/\__ \ # |_| |_|_____| |_| \_/\_/ |____/ \___/ \__|_| |_|_|\___||___/ -# +# # for Hyprland -# ----------------------------------------------------- +# ----------------------------------------------------- # Folders # ----------------------------------------------------- -dir=$(dirname "$(realpath $0)") - -if [[ $dir == "/usr/bin" ]] ;then - # AUR - install_mode="aur" - package_name="ml4w-hyprland" - base_directory="/usr" - bin_directory="$base_directory/bin/$package_name" - share_directory="$base_directory/share/$package_name" - lib_directory="$base_directory/lib/$package_name" +dir=$(dirname "$(realpath "$0")") + +if [[ $dir == "/usr/bin" ]]; then + # AUR + install_mode="aur" + package_name="ml4w-hyprland" + base_directory="/usr" + bin_directory="$base_directory/bin/$package_name" + share_directory="$base_directory/share/$package_name" + lib_directory="$base_directory/lib/$package_name" else - # Filesystem - install_mode="filesystem" - base_directory="$(dirname $(pwd))" - bin_directory="$base_directory/bin" - share_directory="$base_directory/share" - lib_directory="$base_directory/lib" + # Filesystem + install_mode="filesystem" + base_directory="$(dirname $(pwd))" + bin_directory="$base_directory/bin" + share_directory="$base_directory/share" + lib_directory="$base_directory/lib" fi install_directory="$lib_directory/install" @@ -40,139 +40,138 @@ ml4w_directory="$HOME/.ml4w-hyprland" backup_directory="$ml4w_directory/backup" archive_directory="$ml4w_directory/archive" -# ----------------------------------------------------- +# ----------------------------------------------------- # Version # ----------------------------------------------------- -version="$(cat $dotfiles_directory/.config/ml4w/version/name)" +version="$(cat "$dotfiles_directory"/.config/ml4w/version/name)" -# ----------------------------------------------------- +# ----------------------------------------------------- # Colors -# ----------------------------------------------------- -source $install_directory/includes/colors.sh +# ----------------------------------------------------- +source "$install_directory"/includes/colors.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Library -# ----------------------------------------------------- -source $install_directory/includes/library.sh +# ----------------------------------------------------- +source "$install_directory"/includes/library.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Run full installation -# ----------------------------------------------------- +# ----------------------------------------------------- _run_fullinstall() { - source $install_directory/header.sh - source $install_directory/packages.sh - source $install_directory/dotfiles.sh + source "$install_directory"/header.sh + source "$install_directory"/packages.sh + source "$install_directory"/dotfiles.sh } -# ----------------------------------------------------- +# ----------------------------------------------------- # Check for update -# ----------------------------------------------------- +# ----------------------------------------------------- _check_update() { - if [ -f ~/.config/ml4w/settings/dotfiles-folder.sh ] ;then - echo "true" - else - echo "false" - fi + if [ -f ~/.config/ml4w/settings/dotfiles-folder.sh ]; then + echo "true" + else + echo "false" + fi } -# ----------------------------------------------------- +# ----------------------------------------------------- # Run packages installation -# ----------------------------------------------------- +# ----------------------------------------------------- _run_packages() { - source $install_directory/header.sh - source $install_directory/packages.sh + source "$install_directory"/header.sh + source "$install_directory"/packages.sh } -# ----------------------------------------------------- +# ----------------------------------------------------- # Run dotfiles installation -# ----------------------------------------------------- +# ----------------------------------------------------- _run_dotfiles() { - source $install_directory/header.sh - source $install_directory/dotfiles.sh + source "$install_directory"/header.sh + source "$install_directory"/dotfiles.sh } -# ----------------------------------------------------- +# ----------------------------------------------------- # Run unstaller -# ----------------------------------------------------- +# ----------------------------------------------------- _run_optional() { - source $install_directory/optional.sh + source "$install_directory"/optional.sh } -# ----------------------------------------------------- +# ----------------------------------------------------- # Run unstaller -# ----------------------------------------------------- +# ----------------------------------------------------- _run_uninstall() { - source $install_directory/uninstall.sh + source "$install_directory"/uninstall.sh } -# ----------------------------------------------------- +# ----------------------------------------------------- # Run update -# ----------------------------------------------------- +# ----------------------------------------------------- _run_update() { - source $install_directory/update.sh + source "$install_directory"/update.sh } -# ----------------------------------------------------- +# ----------------------------------------------------- # Activate existing dotfiles installation -# ----------------------------------------------------- +# ----------------------------------------------------- _run_activate() { - source $install_directory/activate.sh + source "$install_directory"/activate.sh } -# ----------------------------------------------------- +# ----------------------------------------------------- # Header -# ----------------------------------------------------- +# ----------------------------------------------------- -# ----------------------------------------------------- +# ----------------------------------------------------- # Get script parameter -# ----------------------------------------------------- -if [[ -z $1 ]] ;then - _run_fullinstall +# ----------------------------------------------------- +if [[ -z $1 ]]; then + _run_fullinstall else - while getopts m:vh flag - do - case "${flag}" in - m) - case ${OPTARG} in - full) - _run_fullinstall - ;; - packages) - _run_packages - ;; - dotfiles) - _run_dotfiles - ;; - uninstall) - _run_uninstall - ;; - optional) - _run_optional - ;; - update) - _run_update - ;; - activate) - _run_activate - ;; - esac - ;; - v) - echo ":: ML4W Dotfiles for Hyprland Version $version" - ;; - h) - echo ":: ML4W Dotfiles for Hyprland Version $version" - echo - echo "-m full: Run full installation" - echo "-m packages: Run installation of packages only" - echo "-m dotfiles: Run the setup of the dotfiles only" - echo "-m options: Install optional packages" - echo "-m update: Check for new updates" - echo "-m unstall: Will uninstall the dotfiles" - echo "-m activate: Activate an existing dotfiles folder" - echo - echo "-v: Current version of the ML4W Dotfiles for Hyprland" - ;; - esac - done + while getopts m:vh flag; do + case "${flag}" in + m) + case ${OPTARG} in + full) + _run_fullinstall + ;; + packages) + _run_packages + ;; + dotfiles) + _run_dotfiles + ;; + uninstall) + _run_uninstall + ;; + optional) + _run_optional + ;; + update) + _run_update + ;; + activate) + _run_activate + ;; + esac + ;; + v) + echo ":: ML4W Dotfiles for Hyprland Version $version" + ;; + h) + echo ":: ML4W Dotfiles for Hyprland Version $version" + echo + echo "-m full: Run full installation" + echo "-m packages: Run installation of packages only" + echo "-m dotfiles: Run the setup of the dotfiles only" + echo "-m options: Install optional packages" + echo "-m update: Check for new updates" + echo "-m unstall: Will uninstall the dotfiles" + echo "-m activate: Activate an existing dotfiles folder" + echo + echo "-v: Current version of the ML4W Dotfiles for Hyprland" + ;; + esac + done fi diff --git a/fmt.sh b/fmt.sh new file mode 100755 index 00000000..e01e0668 --- /dev/null +++ b/fmt.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +set -eou pipefail + +usage() { + echo "Usage: $0 {fmt|check|check-apply} [file]" + exit 1 +} + +if [ $# -lt 1 ]; then + usage +else + command=$1 +fi + +if [ $# -eq 1 ]; then + file="" +else + file=$2 +fi + +case $command in +fmt) + if [ -z "$file" ]; then + echo "Please provide a file to format. You can provide '.' for recursion." + exit 1 + fi + shfmt -w "$file" + ;; +check) + if [ -z "$file" ]; then + echo "Please provide a file to check. You can provide '.' for recursion'" + exit 1 + fi + if [ "$file" == "." ]; then + mapfile -t FILES < <(shfmt -f .) + shellcheck "${FILES[@]}" + else + shellcheck "$file" + fi + ;; +check-apply) + if [ -z "$file" ]; then + echo "Please provide a file to check. You can provide '.' for recursion'" + exit 1 + fi + if [ "$file" == "." ]; then + mapfile -t FILES < <(shfmt -f .) + shellcheck "${FILES[@]}" -f diff | git apply --allow-empty + else + shellcheck "$file" -f diff | git apply --allow-empty + fi + ;; +*) + usage + ;; +esac diff --git a/lib/dev/sync.sh b/lib/dev/sync.sh index 295b69ac..ee5619bd 100755 --- a/lib/dev/sync.sh +++ b/lib/dev/sync.sh @@ -1,11 +1,11 @@ #!/bin/bash # Execute the script with ./sync version e.g., ./sync 2.5.2 -if [ ! -z $1 ] ;then - if [ -d ~/.ml4w-hyprland/"$1" ] ;then +if [ ! -z "$1" ]; then + if [ -d ~/.ml4w-hyprland/"$1" ]; then echo "Folder exists. Start rsync now ..." - rsync -avhp -I --exclude-from=$HOME/.ml4w-hyprland/$1/lib/dev/excludes.txt ~/.ml4w-hyprland/dotfiles/share/dotfiles/ ~/dotfiles - else + rsync -avhp -I --exclude-from="$HOME"/.ml4w-hyprland/"$1"/lib/dev/excludes.txt ~/.ml4w-hyprland/dotfiles/share/dotfiles/ ~/dotfiles + else echo "Folder ~/.ml4w-hyprland/$1 not found." fi @@ -15,4 +15,4 @@ if [ ! -z $1 ] ;then else echo "No folder specified. Please use ./sync folder" -fi \ No newline at end of file +fi diff --git a/lib/install/activate.sh b/lib/install/activate.sh index 844db83a..71c887e8 100755 --- a/lib/install/activate.sh +++ b/lib/install/activate.sh @@ -1,63 +1,63 @@ #!/bin/bash -# _ _ _ _ -# / \ ___| |_(_)_ ____ _| |_ ___ +# _ _ _ _ +# / \ ___| |_(_)_ ____ _| |_ ___ # / _ \ / __| __| \ \ / / _` | __/ _ \ # / ___ \ (__| |_| |\ V / (_| | || __/ # /_/ \_\___|\__|_| \_/ \__,_|\__\___| -# +# clear dot_folder="" _activate_dotfiles_folder() { echo ":: Activating $dot_folder now..." - echo + echo # Check home - files=$(ls -a ~/$dot_folder) + files=$(ls -a ~/"$dot_folder") for f in $files; do if [ ! "$f" == "." ] && [ ! "$f" == ".." ] && [ ! "$f" == ".config" ]; then - if [ -f ~/$dot_folder/$f ] ;then + if [ -f ~/"$dot_folder"/"$f" ]; then echo ":: Checking for file ~/$f" - if [ -L ~/$f ] ;then - rm ~/$f + if [ -L ~/"$f" ]; then + rm ~/"$f" fi - if [ -f ~/$f ] ;then - rm ~/$f + if [ -f ~/"$f" ]; then + rm ~/"$f" fi fi fi done # Check .config - files=$(ls -a ~/$dot_folder/.config) + files=$(ls -a ~/"$dot_folder"/.config) for f in $files; do if [ ! "$f" == "." ] && [ ! "$f" == ".." ]; then - if [ -d ~/$dot_folder/.config/$f ] ;then + if [ -d ~/"$dot_folder"/.config/"$f" ]; then echo ":: Checking for directory ~/.config/$f" - if [ -L ~/.config/$f ] ;then - rm ~/.config/$f + if [ -L ~/.config/"$f" ]; then + rm ~/.config/"$f" fi - if [ -f ~/.config/$f ] ;then - rm ~/.config/$f + if [ -f ~/.config/"$f" ]; then + rm ~/.config/"$f" fi - if [ -d ~/.config/$f ] ;then - rm -rf ~/.config/$f + if [ -d ~/.config/"$f" ]; then + rm -rf ~/.config/"$f" fi fi - if [ -f ~/$dot_folder/.config/$f ] ;then + if [ -f ~/"$dot_folder"/.config/"$f" ]; then echo ":: Checking for file ~/.config/$f" - if [ -L ~/.config/$f ] ;then - rm ~/.config/$f + if [ -L ~/.config/"$f" ]; then + rm ~/.config/"$f" fi - if [ -f ~/.config/$f ] ;then - rm ~/.config/$f + if [ -f ~/.config/"$f" ]; then + rm ~/.config/"$f" fi fi fi done - + # Write dot folder into settings - echo "$dot_folder" > $HOME/$dot_folder/.config/ml4w/settings/dotfiles-folder.sh + echo "$dot_folder" >"$HOME"/"$dot_folder"/.config/ml4w/settings/dotfiles-folder.sh stow --dir="$HOME/$dot_folder" --target="$HOME" . echo @@ -68,7 +68,7 @@ _activate_dotfiles_folder() { echo -e "${NONE}" echo "A new login into your system is recommended." echo - if gum confirm "Do you want to exit your system now?" ;then + if gum confirm "Do you want to exit your system now?"; then gum spin --spinner dot --title "Logout has started..." -- sleep 3 killall -9 Hyprland elif [ $? -eq 130 ]; then @@ -86,9 +86,9 @@ _activate_dotfiles_folder() { _define_dotfiles_folder() { dot_folder_tmp=$(gum input --value "$dot_folder" --placeholder "Enter your installation folder name") dot_folder=${dot_folder_tmp//[[:blank:]]/} - if [ $dot_folder == "cancel" ] ;then + if [ "$dot_folder" == "cancel" ]; then exit - elif [ $dot_folder == ".ml4w-hyprland" ] ;then + elif [ "$dot_folder" == ".ml4w-hyprland" ]; then echo ":: The folder .ml4w-hyprland is not allowed." _define_dotfiles_folder else @@ -97,10 +97,10 @@ _define_dotfiles_folder() { } _confirm_dotfiles_folder() { - if [ -d ~/$dot_folder ] && [ -d ~/$dot_folder/.config/ml4w ] ;then + if [ -d ~/"$dot_folder" ] && [ -d ~/"$dot_folder"/.config/ml4w ]; then echo ":: ML4W Dotfiles folder ~/$dot_folder selected." echo - if gum confirm "Do you want to activate now?" ;then + if gum confirm "Do you want to activate now?"; then _activate_dotfiles_folder else echo ":: Activation canceled" @@ -120,5 +120,5 @@ echo echo ":: Please enter the name of the installation folder starting from your home directory." echo ":: (e.g., dotfiles or Documents/mydotfiles, ...)" echo ":: Enter cancel to exit" -echo -_define_dotfiles_folder \ No newline at end of file +echo +_define_dotfiles_folder diff --git a/lib/install/dotfiles.sh b/lib/install/dotfiles.sh index b8030ec0..ac393a27 100755 --- a/lib/install/dotfiles.sh +++ b/lib/install/dotfiles.sh @@ -1,123 +1,122 @@ #!/bin/bash -# ----------------------------------------------------- +# ----------------------------------------------------- # Load automation variables -# ----------------------------------------------------- -source $install_directory/packages/automation.sh +# ----------------------------------------------------- +source "$install_directory"/packages/automation.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Dotfiles target folder -# ----------------------------------------------------- -source $install_directory/dotfiles/dotfiles.sh +# ----------------------------------------------------- +source "$install_directory"/dotfiles/dotfiles.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # AUR Helper -# ----------------------------------------------------- -if [ -z $aur_helper ] ;then - source $install_directory/packages/aur.sh +# ----------------------------------------------------- +if [ -z "$aur_helper" ]; then + source "$install_directory"/packages/aur.sh fi -# ----------------------------------------------------- +# ----------------------------------------------------- # Post Installation -# ----------------------------------------------------- -source $install_directory/dotfiles/postinstall.sh +# ----------------------------------------------------- +source "$install_directory"/dotfiles/postinstall.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Backup files -# ----------------------------------------------------- -source $install_directory/dotfiles/backup.sh +# ----------------------------------------------------- +source "$install_directory"/dotfiles/backup.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Prepare files for the installation -# ----------------------------------------------------- -source $install_directory/dotfiles/preparation.sh +# ----------------------------------------------------- +source "$install_directory"/dotfiles/preparation.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Check if running in Qemu VM -# ----------------------------------------------------- -source $install_directory/dotfiles/vm.sh +# ----------------------------------------------------- +source "$install_directory"/dotfiles/vm.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Install Display Manager # ----------------------------------------------------- -source $install_directory/dotfiles/displaymanager.sh +source "$install_directory"/dotfiles/displaymanager.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Modify existing files before restore starts -# ----------------------------------------------------- -source $install_directory/dotfiles/before_restore.sh +# ----------------------------------------------------- +source "$install_directory"/dotfiles/before_restore.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Restore configuration and settings -# ----------------------------------------------------- -source $install_directory/dotfiles/restore.sh +# ----------------------------------------------------- +source "$install_directory"/dotfiles/restore.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Setup the input devices -# ----------------------------------------------------- -source $install_directory/dotfiles/keyboard.sh +# ----------------------------------------------------- +source "$install_directory"/dotfiles/keyboard.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Execute hook.sh if exists -# ----------------------------------------------------- -source $install_directory/dotfiles/hook.sh +# ----------------------------------------------------- +source "$install_directory"/dotfiles/hook.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Check installation of .bashrc -# ----------------------------------------------------- -source $install_directory/dotfiles/bashrc.sh +# ----------------------------------------------------- +source "$install_directory"/dotfiles/bashrc.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Check installation of .zshrc -# ----------------------------------------------------- -source $install_directory/dotfiles/zshrc.sh +# ----------------------------------------------------- +source "$install_directory"/dotfiles/zshrc.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Check installation of neovim -# ----------------------------------------------------- -source $install_directory/dotfiles/neovim.sh +# ----------------------------------------------------- +source "$install_directory"/dotfiles/neovim.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Copy files to target directory -# ----------------------------------------------------- -source $install_directory/dotfiles/copy.sh +# ----------------------------------------------------- +source "$install_directory"/dotfiles/copy.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Install profile symlinks -# ----------------------------------------------------- -source $install_directory/dotfiles/symlinks.sh +# ----------------------------------------------------- +source "$install_directory"/dotfiles/symlinks.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Install wallpapers -# ----------------------------------------------------- -source $install_directory/dotfiles/wallpaper.sh +# ----------------------------------------------------- +source "$install_directory"/dotfiles/wallpaper.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Initialize pywal color scheme -# ----------------------------------------------------- -source $install_directory/dotfiles/init-pywal.sh +# ----------------------------------------------------- +source "$install_directory"/dotfiles/init-pywal.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Restore hyprland settings -# ----------------------------------------------------- -source $install_directory/dotfiles/settings.sh +# ----------------------------------------------------- +source "$install_directory"/dotfiles/settings.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Install ML4W Apps -# ----------------------------------------------------- -source $install_directory/dotfiles/apps.sh +# ----------------------------------------------------- +source "$install_directory"/dotfiles/apps.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Final cleanup -# ----------------------------------------------------- -source $install_directory/dotfiles/cleanup.sh +# ----------------------------------------------------- +source "$install_directory"/dotfiles/cleanup.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Execute post.sh -# ----------------------------------------------------- -source $install_directory/dotfiles/post.sh +# ----------------------------------------------------- +source "$install_directory"/dotfiles/post.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Offer Reboot -# ----------------------------------------------------- -source $install_directory/dotfiles/reboot.sh - +# ----------------------------------------------------- +source "$install_directory"/dotfiles/reboot.sh diff --git a/lib/install/dotfiles/apps.sh b/lib/install/dotfiles/apps.sh index 40f7faa8..42d78144 100755 --- a/lib/install/dotfiles/apps.sh +++ b/lib/install/dotfiles/apps.sh @@ -3,39 +3,39 @@ # ------------------------------------------------------ # Create local applications folder if not exits -if [ ! -d $HOME/.local/share/applications/ ] ;then - mkdir $HOME/.local/share/applications +if [ ! -d "$HOME"/.local/share/applications/ ]; then + mkdir "$HOME"/.local/share/applications echo ":: $HOME/.local/share/applications created" fi # Installing the ML4W Apps app_name="com.ml4w.welcome" -sudo cp $apps_directory/$app_name.desktop /usr/share/applications -sudo cp $apps_directory/$app_name.png /usr/share/icons/hicolor/128x128/apps -sudo cp $apps_directory/$app_name /usr/bin/$app_name +sudo cp "$apps_directory"/$app_name.desktop /usr/share/applications +sudo cp "$apps_directory"/$app_name.png /usr/share/icons/hicolor/128x128/apps +sudo cp "$apps_directory"/$app_name /usr/bin/$app_name echo ":: ML4W Welcome App installed successfully" app_name="com.ml4w.dotfilessettings" -sudo cp $apps_directory/$app_name.desktop /usr/share/applications -sudo cp $apps_directory/$app_name.png /usr/share/icons/hicolor/128x128/apps -sudo cp $apps_directory/$app_name /usr/bin/$app_name +sudo cp "$apps_directory"/$app_name.desktop /usr/share/applications +sudo cp "$apps_directory"/$app_name.png /usr/share/icons/hicolor/128x128/apps +sudo cp "$apps_directory"/$app_name /usr/bin/$app_name echo ":: ML4W Settings App installed successfully" app_name="com.ml4w.hyprland.settings" -sudo cp $apps_directory/$app_name.desktop /usr/share/applications -sudo cp $apps_directory/$app_name.png /usr/share/icons/hicolor/128x128/apps -sudo cp $apps_directory/$app_name /usr/bin/$app_name +sudo cp "$apps_directory"/$app_name.desktop /usr/share/applications +sudo cp "$apps_directory"/$app_name.png /usr/share/icons/hicolor/128x128/apps +sudo cp "$apps_directory"/$app_name /usr/bin/$app_name echo ":: ML4W Hyprland Settings App installed successfully" app_name="com.ml4w.dotfilesuninstaller" -sudo cp $apps_directory/$app_name /usr/bin/$app_name +sudo cp "$apps_directory"/$app_name /usr/bin/$app_name echo ":: ML4W Uninstaller App installed successfully" -echo +echo # Execute hyprctl from the Settings app -if [ -f ~/.config/ml4w-hyprland-settings/hyprctl.sh ] ;then +if [ -f ~/.config/ml4w-hyprland-settings/hyprctl.sh ]; then echo ":: Starting restore from ML4W Hyprland Settings App" ~/.config/ml4w-hyprland-settings/hyprctl.sh fi -echo \ No newline at end of file +echo diff --git a/lib/install/dotfiles/backup.sh b/lib/install/dotfiles/backup.sh index c2fcc491..a3e32e6e 100755 --- a/lib/install/dotfiles/backup.sh +++ b/lib/install/dotfiles/backup.sh @@ -5,161 +5,161 @@ datets=$(date '+%Y%m%d%H%M%S') _create_backup() { - if [ ! -z "$(ls -A $backup_directory)" ] ;then - rsync -a $backup_directory/ $archive_directory/$datets/ + if [ ! -z "$(ls -A "$backup_directory")" ]; then + rsync -a "$backup_directory"/ "$archive_directory"/"$datets"/ echo ":: Current backup archived in $archive_directory/$datets" fi - if [ -d ~/$dot_folder ]; then - rsync -a ~/$dot_folder $backup_directory/ + if [ -d ~/"$dot_folder" ]; then + rsync -a ~/"$dot_folder" "$backup_directory"/ echo ":: Backup of $HOME/$dot_folder created in $backup_directory" fi - if ! test -L ~/.bashrc ;then - cp ~/.bashrc $backup_directory + if ! test -L ~/.bashrc; then + cp ~/.bashrc "$backup_directory" echo ":: Backup of $HOME/.bashrc created in $backup_directory" fi - if ! test -L ~/.zshrc ;then - cp ~/.zshrc $backup_directory + if ! test -L ~/.zshrc; then + cp ~/.zshrc "$backup_directory" echo ":: Backup of $HOME/.zshrc created in $backup_directory" fi - if [ ! -d $backup_directory/config ] ;then - mkdir $backup_directory/config + if [ ! -d "$backup_directory"/config ]; then + mkdir "$backup_directory"/config fi - if ! test -L ~/.config/qtile && [ -d ~/.config/qtile ] ;then - cp -r ~/.config/qtile $backup_directory/config + if ! test -L ~/.config/qtile && [ -d ~/.config/qtile ]; then + cp -r ~/.config/qtile "$backup_directory"/config echo ":: Backup of $HOME/.config/qtile created in $backup_directory/config/" fi - if ! test -L ~/.config/hypr && [ -d ~/.config/hypr ] ;then - cp -r ~/.config/hypr $backup_directory/config + if ! test -L ~/.config/hypr && [ -d ~/.config/hypr ]; then + cp -r ~/.config/hypr "$backup_directory"/config echo ":: Backup of $HOME/.config/hypr created in $backup_directory/config/" fi - if ! test -L ~/.config/ml4w-hyprland-settings && [ -d ~/.config/ml4w-hyprland-settings ] ;then - cp -r ~/.config/ml4w-hyprland-settings $backup_directory/config + if ! test -L ~/.config/ml4w-hyprland-settings && [ -d ~/.config/ml4w-hyprland-settings ]; then + cp -r ~/.config/ml4w-hyprland-settings "$backup_directory"/config echo ":: Backup of $HOME/.config/ml4w-hyprland-settings created in $backup_directory/config/" fi - if ! test -L ~/.config/qtile && [ -d ~/.config/rofi ] ;then - cp -r ~/.config/rofi $backup_directory/config + if ! test -L ~/.config/qtile && [ -d ~/.config/rofi ]; then + cp -r ~/.config/rofi "$backup_directory"/config echo ":: Backup of $HOME/.config/rofi created in $backup_directory/config/" fi - if ! test -L ~/.config/wal && [ -d ~/.config/wal ] ;then - cp -r ~/.config/wal $backup_directory/config + if ! test -L ~/.config/wal && [ -d ~/.config/wal ]; then + cp -r ~/.config/wal "$backup_directory"/config echo ":: Backup of $HOME/.config/wal created in $backup_directory/config/" fi - if ! test -L ~/.config/waybar && [ -d ~/.config/waybar ] ;then - cp -r ~/.config/waybar $backup_directory/config + if ! test -L ~/.config/waybar && [ -d ~/.config/waybar ]; then + cp -r ~/.config/waybar "$backup_directory"/config echo ":: Backup of $HOME/.config/waybar created in $backup_directory/config/" fi - if ! test -L ~/.config/wlogout && [ -d ~/.config/wlogout ] ;then - cp -r ~/.config/wlogout $backup_directory/config + if ! test -L ~/.config/wlogout && [ -d ~/.config/wlogout ]; then + cp -r ~/.config/wlogout "$backup_directory"/config echo ":: Backup of $HOME/.config/wlogout created in $backup_directory/config/" fi - if ! test -L ~/.config/alacritty && [ -d ~/.config/alacritty ] ;then - cp -r ~/.config/alacritty $backup_directory/config + if ! test -L ~/.config/alacritty && [ -d ~/.config/alacritty ]; then + cp -r ~/.config/alacritty "$backup_directory"/config echo ":: Backup of $HOME/.config/alacritty created in $backup_directory/config/" fi - if ! test -L ~/.config/starship && [ -d ~/.config/starship ] ;then - cp -r ~/.config/starship $backup_directory/config + if ! test -L ~/.config/starship && [ -d ~/.config/starship ]; then + cp -r ~/.config/starship "$backup_directory"/config echo ":: Backup of $HOME/.config/starship created in $backup_directory/config/" fi - if ! test -L ~/.config/picom && [ -d ~/.config/picom ] ;then - cp -r ~/.config/picom $backup_directory/config + if ! test -L ~/.config/picom && [ -d ~/.config/picom ]; then + cp -r ~/.config/picom "$backup_directory"/config echo ":: Backup of $HOME/.config/picom created in $backup_directory/config/" fi - if ! test -L ~/.config/nvim && [ -d ~/.config/nvim ] ;then - cp -r ~/.config/nvim $backup_directory/config + if ! test -L ~/.config/nvim && [ -d ~/.config/nvim ]; then + cp -r ~/.config/nvim "$backup_directory"/config echo ":: Backup of $HOME/.config/nvim created in $backup_directory/config/" fi - if ! test -L ~/.config/vim && [ -d ~/.config/vim ] ;then - cp -r ~/.config/vim $backup_directory/config + if ! test -L ~/.config/vim && [ -d ~/.config/vim ]; then + cp -r ~/.config/vim "$backup_directory"/config echo ":: Backup of $HOME/.config/vim created in $backup_directory/config/" fi - if ! test -L ~/.config/dunst && [ -d ~/.config/dunst ] ;then - cp -r ~/.config/dunst $backup_directory/config + if ! test -L ~/.config/dunst && [ -d ~/.config/dunst ]; then + cp -r ~/.config/dunst "$backup_directory"/config echo ":: Backup of $HOME/.config/dunst created in $backup_directory/config/" fi - if ! test -L ~/.config/swappy && [ -d ~/.config/swappy ] ;then - cp -r ~/.config/swappy $backup_directory/config + if ! test -L ~/.config/swappy && [ -d ~/.config/swappy ]; then + cp -r ~/.config/swappy "$backup_directory"/config echo ":: Backup of $HOME/.config/swappy created in $backup_directory/config/" - fi + fi } # Create Backup File Structure -if [ ! -d $ml4w_directory ] ;then - mkdir $ml4w_directory +if [ ! -d "$ml4w_directory" ]; then + mkdir "$ml4w_directory" echo ":: $ml4w_directory folder created." fi -if [ ! -d $backup_directory ]; then - mkdir $backup_directory +if [ ! -d "$backup_directory" ]; then + mkdir "$backup_directory" echo "$backup_directory created" fi -if [ ! -d $archive_directory ]; then - mkdir $archive_directory +if [ ! -d "$archive_directory" ]; then + mkdir "$archive_directory" echo "$archive_directory created" fi # Backup Existing Dotfiles -if [ -d ~/$dot_folder ] || ! test -L ~/.bashrc || [ -d ~/.config/hypr ] || [ -d ~/.config/qtile ]; then +if [ -d ~/"$dot_folder" ] || ! test -L ~/.bashrc || [ -d ~/.config/hypr ] || [ -d ~/.config/qtile ]; then echo -e "${GREEN}" figlet -f smslant "Backup" echo -e "${NONE}" echo "The script has detected the following files and folders for a backup:" - if [ -d ~/$dot_folder ]; then + if [ -d ~/"$dot_folder" ]; then echo " - $HOME/$dot_folder" fi - if ! test -L ~/.bashrc ;then + if ! test -L ~/.bashrc; then echo " - $HOME/.bashrc" fi - if ! test -L ~/.zshrc ;then + if ! test -L ~/.zshrc; then echo " - $HOME/.zshrc" fi - if ! test -L ~/.config/qtile && [ -d ~/.config/qtile ] ;then + if ! test -L ~/.config/qtile && [ -d ~/.config/qtile ]; then echo " - $HOME/.config/qtile/" fi - if ! test -L ~/.config/hypr && [ -d ~/.config/hypr ] ;then + if ! test -L ~/.config/hypr && [ -d ~/.config/hypr ]; then echo " - $HOME/.config/hypr/" fi - if ! test -L ~/.config/ml4w-hyprland-settings && [ -d ~/.config/ml4w-hyprland-settings ] ;then + if ! test -L ~/.config/ml4w-hyprland-settings && [ -d ~/.config/ml4w-hyprland-settings ]; then echo " - $HOME/.config/ml4w-hyprland-settings/" fi - if ! test -L ~/.config/rofi && [ -d ~/.config/rofi ] ;then + if ! test -L ~/.config/rofi && [ -d ~/.config/rofi ]; then echo " - $HOME/.config/rofi/" fi - if ! test -L ~/.config/wal && [ -d ~/.config/wal ] ;then + if ! test -L ~/.config/wal && [ -d ~/.config/wal ]; then echo " - $HOME/.config/wal/" fi - if ! test -L ~/.config/waybar && [ -d ~/.config/waybar ] ;then + if ! test -L ~/.config/waybar && [ -d ~/.config/waybar ]; then echo " - $HOME/.config/waybar/" fi - if ! test -L ~/.config/wlogout && [ -d ~/.config/wlogout ] ;then + if ! test -L ~/.config/wlogout && [ -d ~/.config/wlogout ]; then echo " - $HOME/.config/wlogout/" fi - if ! test -L ~/.config/alacritty && [ -d ~/.config/alacritty ] ;then + if ! test -L ~/.config/alacritty && [ -d ~/.config/alacritty ]; then echo " - $HOME/.config/alacritty/" fi - if ! test -L ~/.config/starship && [ -d ~/.config/starship ] ;then + if ! test -L ~/.config/starship && [ -d ~/.config/starship ]; then echo " - $HOME/.config/starship/" fi - if ! test -L ~/.config/picom && [ -d ~/.config/picom ] ;then + if ! test -L ~/.config/picom && [ -d ~/.config/picom ]; then echo " - $HOME/.config/picom/" fi - if ! test -L ~/.config/nvim && [ -d ~/.config/nvim ] ;then + if ! test -L ~/.config/nvim && [ -d ~/.config/nvim ]; then echo " - $HOME/.config/nvim/" fi - if ! test -L ~/.config/vim && [ -d ~/.config/vim ] ;then + if ! test -L ~/.config/vim && [ -d ~/.config/vim ]; then echo " - $HOME/.config/vim/" fi - if ! test -L ~/.config/dunst && [ -d ~/.config/dunst ] ;then + if ! test -L ~/.config/dunst && [ -d ~/.config/dunst ]; then echo " - $HOME/.config/dunst/" fi - if ! test -L ~/.config/swappy && [ -d ~/.config/swappy ] ;then + if ! test -L ~/.config/swappy && [ -d ~/.config/swappy ]; then echo " - $HOME/.config/swappy/" fi - echo + echo # Start Backup - if [ -z $automation_backup ] ;then - if gum confirm "Do you want to create a backup?" ;then + if [ -z "$automation_backup" ]; then + if gum confirm "Do you want to create a backup?"; then _create_backup elif [ $? -eq 130 ]; then exit 130 @@ -167,11 +167,11 @@ if [ -d ~/$dot_folder ] || ! test -L ~/.bashrc || [ -d ~/.config/hypr ] || [ -d echo ":: Backup skipped." fi else - if [[ "$automation_backup" = true ]] ;then + if [[ "$automation_backup" = true ]]; then _create_backup fi fi else echo ":: Nothing to backup" fi -echo \ No newline at end of file +echo diff --git a/lib/install/dotfiles/bashrc.sh b/lib/install/dotfiles/bashrc.sh index 8d0128df..7b69e654 100755 --- a/lib/install/dotfiles/bashrc.sh +++ b/lib/install/dotfiles/bashrc.sh @@ -2,28 +2,28 @@ # Install .bashrc # ------------------------------------------------------ -if [ -f ~/.bashrc ] ;then - if ! test -L ~/.bashrc ;then +if [ -f ~/.bashrc ]; then + if ! test -L ~/.bashrc; then echo -e "${GREEN}" figlet -f smslant ".bashrc" echo -e "${NONE}" echo ":: The script has detected an existing .bashrc file." echo ":: You can replace it with the latest version of ML4W Dotfiles $version (Recommended)." echo - if [ -z $automation_bashrc ] ;then - if gum confirm "Do you want to replace your existing .bashrc?" ;then + if [ -z "$automation_bashrc" ]; then + if gum confirm "Do you want to replace your existing .bashrc?"; then rm ~/.bashrc echo ":: .bashrc will be installed" elif [ $? -eq 130 ]; then - exit 130 + exit 130 else echo ":: Installation of the .bashrc file skipped." fi else - if [[ "$automation_bashrc" = true ]] ;then + if [[ "$automation_bashrc" = true ]]; then echo ":: AUTOMATION: .bashrc will be installed." - elif [[ "$automation_bashrc" = false ]] ;then - rm $ml4w_directory/$version/.bashrc + elif [[ "$automation_bashrc" = false ]]; then + rm "$ml4w_directory"/"$version"/.bashrc echo ":: AUTOMATION: Installation of the .bashrc file skipped." else echo ":: AUTOMATION ERROR: bashrc" @@ -32,4 +32,4 @@ if [ -f ~/.bashrc ] ;then fi fi fi -echo +echo diff --git a/lib/install/dotfiles/before_restore.sh b/lib/install/dotfiles/before_restore.sh index a2c1661a..b58b4613 100755 --- a/lib/install/dotfiles/before_restore.sh +++ b/lib/install/dotfiles/before_restore.sh @@ -2,47 +2,47 @@ # Modify existing files before restore starts # ------------------------------------------------------ -if [ -d ~/$dot_folder/.settings ] ;then +if [ -d ~/"$dot_folder"/.settings ]; then echo ":: Legacy folder structure detected." - if [ -d ~/$dot_folder ] ;then + if [ -d ~/"$dot_folder" ]; then echo ":: Modify existing files" # Create new folder structure - if [ ! -d ~/$dot_folder/.config ] ;then - mkdir ~/$dot_folder/.config + if [ ! -d ~/"$dot_folder"/.config ]; then + mkdir ~/"$dot_folder"/.config fi - mv -f ~/$dot_folder/* ~/$dot_folder/.config/ - if [ ! -d ~/$dot_folder/.config/ml4w ] ;then - mkdir ~/$dot_folder/.config/ml4w + mv -f ~/"$dot_folder"/* ~/"$dot_folder"/.config/ + if [ ! -d ~/"$dot_folder"/.config/ml4w ]; then + mkdir ~/"$dot_folder"/.config/ml4w fi # ml4w folder - _move_folder ~/$dot_folder/.settings ~/$dot_folder/.config/ml4w/settings - _move_folder ~/$dot_folder/.config/scripts ~/$dot_folder/.config/ml4w/scripts - _move_folder ~/$dot_folder/.version ~/$dot_folder/.config/ml4w/version - _move_folder ~/$dot_folder/.config/apps ~/$dot_folder/.config/ml4w/apps - _move_folder ~/$dot_folder/.config/login ~/$dot_folder/.config/ml4w/login - _move_folder ~/$dot_folder/.config/sddm ~/$dot_folder/.config/ml4w/sddm - _move_file ~/$dot_folder/.config/update.sh ~/$dot_folder/.config/ml4w/update.sh - _move_file ~/$dot_folder/.config/uninstall.sh ~/$dot_folder/.config/ml4w/uninstall.sh + _move_folder ~/"$dot_folder"/.settings ~/"$dot_folder"/.config/ml4w/settings + _move_folder ~/"$dot_folder"/.config/scripts ~/"$dot_folder"/.config/ml4w/scripts + _move_folder ~/"$dot_folder"/.version ~/"$dot_folder"/.config/ml4w/version + _move_folder ~/"$dot_folder"/.config/apps ~/"$dot_folder"/.config/ml4w/apps + _move_folder ~/"$dot_folder"/.config/login ~/"$dot_folder"/.config/ml4w/login + _move_folder ~/"$dot_folder"/.config/sddm ~/"$dot_folder"/.config/ml4w/sddm + _move_file ~/"$dot_folder"/.config/update.sh ~/"$dot_folder"/.config/ml4w/update.sh + _move_file ~/"$dot_folder"/.config/uninstall.sh ~/"$dot_folder"/.config/ml4w/uninstall.sh # dotfiles - _move_folder ~/$dot_folder/.config/gtk/gtk3.0 ~/$dot_folder/.config/gtk3.0 - _move_folder ~/$dot_folder/.config/gtk/gtk4.0 ~/$dot_folder/.config/gtk4.0 - _move_folder ~/$dot_folder/.config/gtk/xsettings ~/$dot_folder/.config/xsettings - _move_file ~/$dot_folder/.config/gtk/.gtkrc-2.0 ~/$dot_folder/.gtkrc-2.0 - _move_file ~/$dot_folder/.config/gtk/.Xresources ~/$dot_folder/.Xresources - _move_file ~/$dot_folder/.config/starship/starship.toml ~/$dot_folder/.config/starship.toml - _del_folder ~/$dot_folder/gtk - _del_folder ~/$dot_folder/eww - _del_folder ~/$dot_folder/starship + _move_folder ~/"$dot_folder"/.config/gtk/gtk3.0 ~/"$dot_folder"/.config/gtk3.0 + _move_folder ~/"$dot_folder"/.config/gtk/gtk4.0 ~/"$dot_folder"/.config/gtk4.0 + _move_folder ~/"$dot_folder"/.config/gtk/xsettings ~/"$dot_folder"/.config/xsettings + _move_file ~/"$dot_folder"/.config/gtk/.gtkrc-2.0 ~/"$dot_folder"/.gtkrc-2.0 + _move_file ~/"$dot_folder"/.config/gtk/.Xresources ~/"$dot_folder"/.Xresources + _move_file ~/"$dot_folder"/.config/starship/starship.toml ~/"$dot_folder"/.config/starship.toml + _del_folder ~/"$dot_folder"/gtk + _del_folder ~/"$dot_folder"/eww + _del_folder ~/"$dot_folder"/starship # Replace Quicklink - sed -i -e 's/dotfiles\/.settings/.config\/ml4w\/settings/g' ~/$dot_folder/.config/ml4w/settings/waybar-quicklinks.json + sed -i -e 's/dotfiles\/.settings/.config\/ml4w\/settings/g' ~/"$dot_folder"/.config/ml4w/settings/waybar-quicklinks.json fi fi # Move legacy .bashrc_custom to ~/.config/bashrc/bashrc_custom -if [ -f ~/.bashrc_custom ] ;then - mv ~/.bashrc_custom ~/$dot_folder/.config/bashrc/bashrc_custom -fi \ No newline at end of file +if [ -f ~/.bashrc_custom ]; then + mv ~/.bashrc_custom ~/"$dot_folder"/.config/bashrc/bashrc_custom +fi diff --git a/lib/install/dotfiles/cleanup.sh b/lib/install/dotfiles/cleanup.sh index 0f09b02b..25dddd78 100644 --- a/lib/install/dotfiles/cleanup.sh +++ b/lib/install/dotfiles/cleanup.sh @@ -6,47 +6,46 @@ echo ":: Starting Cleanup" # Check for ttf-ms-fonts if [[ $(_isInstalledPacman "ttf-ms-fonts") == 0 ]]; then echo "The script has detected ttf-ms-fonts. This can cause conflicts with icons in Waybar." - if gum confirm "Do you want to uninstall ttf-ms-fonts?" ;then + if gum confirm "Do you want to uninstall ttf-ms-fonts?"; then sudo pacman --noconfirm -R ttf-ms-fonts fi fi # Check for running NetworkManager.service -if [[ $(systemctl list-units --all -t service --full --no-legend "NetworkManager.service" | sed 's/^\s*//g' | cut -f1 -d' ') == "NetworkManager.service" ]];then +if [[ $(systemctl list-units --all -t service --full --no-legend "NetworkManager.service" | sed 's/^\s*//g' | cut -f1 -d' ') == "NetworkManager.service" ]]; then echo ":: NetworkManager.service already running." else sudo systemctl enable NetworkManager.service sudo systemctl start NetworkManager.service - echo ":: NetworkManager.service activated successfully." + echo ":: NetworkManager.service activated successfully." fi # Check for running bluetooth.service -if [[ $(systemctl list-units --all -t service --full --no-legend "bluetooth.service" | sed 's/^\s*//g' | cut -f1 -d' ') == "bluetooth.service" ]];then +if [[ $(systemctl list-units --all -t service --full --no-legend "bluetooth.service" | sed 's/^\s*//g' | cut -f1 -d' ') == "bluetooth.service" ]]; then echo ":: bluetooth.service already running." else sudo systemctl enable bluetooth.service sudo systemctl start bluetooth.service - echo ":: bluetooth.service activated successfully." + echo ":: bluetooth.service activated successfully." fi -if [ -d ~/$dot_folder/hypr/settings/ ] ;then +if [ -d ~/"$dot_folder"/hypr/settings/ ]; then rm -rf ~/dotfiles/hypr/settings echo ":: ~/dotfiles/hypr/settings removed." fi -if [ -f ~/.local/share/applications/ml4w-welcome.desktop ] ;then +if [ -f ~/.local/share/applications/ml4w-welcome.desktop ]; then rm ~/.local/share/applications/ml4w-welcome.desktop fi -if [ -f ~/.local/share/applications/ml4w-dotfiles-settings.desktop ] ;then +if [ -f ~/.local/share/applications/ml4w-dotfiles-settings.desktop ]; then rm ~/.local/share/applications/ml4w-dotfiles-settings.desktop fi -if [ -f ~/.local/share/applications/ml4w-hyprland-settings.desktop ] ;then +if [ -f ~/.local/share/applications/ml4w-hyprland-settings.desktop ]; then rm ~/.local/share/applications/ml4w-hyprland-settings.desktop fi - # Create default folder structure xdg-user-dirs-update -echo -echo ":: Cleanup done." \ No newline at end of file +echo +echo ":: Cleanup done." diff --git a/lib/install/dotfiles/copy.sh b/lib/install/dotfiles/copy.sh index b2d32c8a..4f837941 100644 --- a/lib/install/dotfiles/copy.sh +++ b/lib/install/dotfiles/copy.sh @@ -3,15 +3,15 @@ # ------------------------------------------------------ _copy_confirm() { - if gum confirm "Do you want to install the prepared ML4W Dotfiles now?" ;then + if gum confirm "Do you want to install the prepared ML4W Dotfiles now?"; then echo "Copy started" - if [ ! -d ~/$dot_folder ]; then - mkdir -p ~/$dot_folder + if [ ! -d ~/"$dot_folder" ]; then + mkdir -p ~/"$dot_folder" echo "~/$dot_folder folder created." - fi - rsync -avhp -I $ml4w_directory/$version/ ~/$dot_folder/ - if [[ $(_isFolderEmpty ~/$dot_folder/) == 0 ]] ;then - echo "AN ERROR HAS OCCURED. Copy prepared dofiles from $ml4w_directory/$version/ to ~/$dot_folder/ failed" + fi + rsync -avhp -I "$ml4w_directory"/"$version"/ ~/"$dot_folder"/ + if [[ $(_isFolderEmpty ~/"$dot_folder"/) == 0 ]]; then + echo "AN ERROR HAS OCCURED. Copy prepared dofiles from $ml4w_directory/$version/ to ~/$dot_folder/ failed" echo "Please check that rsync is installad on your system." echo "Execution of rsync -a -I $ml4w_directory/$version/ ~/$dot_folder/ is required." exit @@ -27,13 +27,13 @@ _copy_confirm() { } _copy_automation() { - if [ ! -d ~/$dot_folder ]; then - mkdir -p ~/$dot_folder + if [ ! -d ~/"$dot_folder" ]; then + mkdir -p ~/"$dot_folder" echo ":: AUTOMATION: ~/$dot_folder folder created." - fi - rsync -avhp -I $ml4w_directory/$version/ ~/$dot_folder/ - if [[ $(_isFolderEmpty ~/$dot_folder/) == 0 ]] ;then - echo "AN ERROR HAS OCCURED. Copy prepared dofiles from $ml4w_directory/$version/ to ~/$dot_folder/ failed" + fi + rsync -avhp -I "$ml4w_directory"/"$version"/ ~/"$dot_folder"/ + if [[ $(_isFolderEmpty ~/"$dot_folder"/) == 0 ]]; then + echo "AN ERROR HAS OCCURED. Copy prepared dofiles from $ml4w_directory/$version/ to ~/$dot_folder/ failed" echo "Please check that rsync is installad on your system." echo "Execution of rsync -a -I $ml4w_directory/$version/ ~/$dot_folder/ is required." exit @@ -44,33 +44,32 @@ _copy_automation() { echo -e "${GREEN}" figlet -f smslant "Copy dotfiles" echo -e "${NONE}" -if [ ! -d ~/$dot_folder ]; then -echo "The script will now remove existing directories and files from ~/.config/" -echo "and copy your prepared configuration from $ml4w_directory/$version to ~/$dot_folder" -echo -echo "Symbolic links will then be created from ~/$dot_folder into your ~/.config/ directory." -echo +if [ ! -d ~/"$dot_folder" ]; then + echo "The script will now remove existing directories and files from ~/.config/" + echo "and copy your prepared configuration from $ml4w_directory/$version to ~/$dot_folder" + echo + echo "Symbolic links will then be created from ~/$dot_folder into your ~/.config/ directory." + echo fi -if [[ ! $(tty) == *"pts"* ]] && [ -d ~/$dot_folder ]; then +if [[ ! $(tty) == *"pts"* ]] && [ -d ~/"$dot_folder" ]; then echo "You're running the script in tty. You can delete the existing ~/$dot_folder folder now for a clean installation." echo "If not, the script will overwrite existing files but will not remove additional files or folders of your custom configuration." echo else - if [ -d ~/$dot_folder ]; then + if [ -d ~/"$dot_folder" ]; then echo "The script will overwrite existing files but will not remove additional files or folders from your custom configuration." echo fi fi -if [ ! -d ~/$dot_folder ]; then +if [ ! -d ~/"$dot_folder" ]; then echo "PLEASE BACKUP YOUR EXISTING CONFIGURATIONS in .config IF NEEDED!" echo fi - -if [ -z $automation_copy ] ;then +if [ -z "$automation_copy" ]; then _copy_confirm else - if [[ "$automation_copy" = true ]] ;then + if [[ "$automation_copy" = true ]]; then _copy_automation else _copy_confirm diff --git a/lib/install/dotfiles/displaymanager.sh b/lib/install/dotfiles/displaymanager.sh index cb673dcb..78838f27 100755 --- a/lib/install/dotfiles/displaymanager.sh +++ b/lib/install/dotfiles/displaymanager.sh @@ -7,7 +7,7 @@ figlet -f smslant "Display Manager" echo -e "${NONE}" echo -if [ -z $automation_displaymanager ] ;then +if [ -z "$automation_displaymanager" ]; then if [ -f /etc/systemd/system/display-manager.service ]; then disman=0 echo "You have already installed a display manager. If your display manager is working fine, you can keep the current setup." @@ -22,13 +22,13 @@ if [ -z $automation_displaymanager ] ;then dmsel=$(gum choose "Keep current setup" "Install sddm and theme") fi - if [ -z "${dmsel}" ] ;then + if [ -z "${dmsel}" ]; then echo ":: Installation canceled." exit fi - if [ "$dmsel" == "Install sddm and theme" ] ;then + if [ "$dmsel" == "Install sddm and theme" ]; then - if [ -d /usr/share/sddm/themes/sugar-candy/ ] ;then + if [ -d /usr/share/sddm/themes/sugar-candy/ ]; then sudo rm -rf /usr/share/sddm/themes/sugar-candy/ echo ":: Sugar Candy folder removed" fi @@ -37,21 +37,21 @@ if [ -z $automation_displaymanager ] ;then # Try to force the installation of sddm echo ":: Installing sddm" sudo pacman -S --noconfirm --needed sddm qt5-graphicaleffects qt5-quickcontrols2 qt5-svg --ask 4 - + # Enable sddm if [ -f /etc/systemd/system/display-manager.service ]; then sudo rm /etc/systemd/system/display-manager.service fi sudo systemctl enable sddm.service - echo - if gum confirm "Do you want to install the sddm-sugar-candy theme?" ;then + echo + if gum confirm "Do you want to install the sddm-sugar-candy theme?"; then echo ":: Installing sddm-sugar-candy-git" - if [ -d ~/Downloads/sddm-sugar-candy ] ;then + if [ -d ~/Downloads/sddm-sugar-candy ]; then rm -rf ~/Downloads/sddm-sugar-candy echo ":: ~/Downloads/sddm-sugar-candy removed" - fi + fi wget -P ~/Downloads/sddm-sugar-candy https://github.com/Kangie/sddm-sugar-candy/archive/refs/heads/master.zip echo ":: Download of sddm-sugar-candy complete" unzip -o -q ~/Downloads/sddm-sugar-candy/master.zip -d ~/Downloads/sddm-sugar-candy @@ -64,36 +64,36 @@ if [ -z $automation_displaymanager ] ;then echo "Folder /etc/sddm.conf.d created." fi - sudo cp $dotfiles_directory/.config/ml4w/sddm/sddm.conf /etc/sddm.conf.d/ + sudo cp "$dotfiles_directory"/.config/ml4w/sddm/sddm.conf /etc/sddm.conf.d/ echo "File /etc/sddm.conf.d/sddm.conf updated." if [ -f /usr/share/sddm/themes/sugar-candy/theme.conf ]; then # Cache file for holding the current wallpaper - sudo cp $wallpaper_directory/default.jpg /usr/share/sddm/themes/sugar-candy/Backgrounds/current_wallpaper.jpg + sudo cp "$wallpaper_directory"/default.jpg /usr/share/sddm/themes/sugar-candy/Backgrounds/current_wallpaper.jpg echo "Default wallpaper copied into /usr/share/sddm/themes/sugar-candy/Backgrounds/" - sudo cp $dotfiles_directory/.config/ml4w/sddm/theme.conf /usr/share/sddm/themes/sugar-candy/ + sudo cp "$dotfiles_directory"/.config/ml4w/sddm/theme.conf /usr/share/sddm/themes/sugar-candy/ sudo sed -i 's/CURRENTWALLPAPER/'"current_wallpaper.jpg"'/' /usr/share/sddm/themes/sugar-candy/theme.conf echo "File theme.conf updated in /usr/share/sddm/themes/sugar-candy/" fi fi - elif [ "$dmsel" == "Deactivate current display manager" ] ;then + elif [ "$dmsel" == "Deactivate current display manager" ]; then sudo rm /etc/systemd/system/display-manager.service echo ":: Current display manager deactivated." disman=1 - elif [ "$dmsel" == "Keep current setup" ] ;then + elif [ "$dmsel" == "Keep current setup" ]; then echo ":: sddm setup skipped." else echo ":: sddm setup skipped." fi else - if [[ "$automation_displaymanager" = true ]] ;then + if [[ "$automation_displaymanager" = true ]]; then echo ":: AUTOMATION: Keep current setup of Display Manager" disman=0 fi -fi \ No newline at end of file +fi diff --git a/lib/install/dotfiles/dotfiles.sh b/lib/install/dotfiles/dotfiles.sh index b6d9ee42..26d30bea 100755 --- a/lib/install/dotfiles/dotfiles.sh +++ b/lib/install/dotfiles/dotfiles.sh @@ -13,11 +13,11 @@ _define_dotfiles_folder() { echo dot_folder_tmp=$(gum input --value "$dot_folder" --placeholder "Enter your installation folder name") dot_folder=${dot_folder_tmp//[[:blank:]]/} - echo $dot_folder - if [[ $dot_folder == ".ml4w-hyprland" ]] ;then + echo "$dot_folder" + if [[ $dot_folder == ".ml4w-hyprland" ]]; then echo ":: The folder .ml4w-hyprland is not allowed." _define_dotfiles_folder - elif [ ! -z $dot_folder ] ;then + elif [ ! -z "$dot_folder" ]; then _confirm_dotfiles_folder else echo "ERROR: Please define a folder name" @@ -27,11 +27,11 @@ _define_dotfiles_folder() { _confirm_dotfiles_folder() { echo ":: The ML4W Dotfiles will be installed in ~/$dot_folder" - if [ -d ~/$dot_folder ] ;then + if [ -d ~/"$dot_folder" ]; then echo ":: The folder ~/$dot_folder already exists and the files will be updated." fi echo - if gum confirm "Do you want use this folder?" ;then + if gum confirm "Do you want use this folder?"; then echo ":: ML4W Dotfiles will be installed in ~/$dot_folder" elif [ $? -eq 130 ]; then echo ":: Installation canceled." @@ -41,8 +41,8 @@ _confirm_dotfiles_folder() { fi } -if [ -z $automation_dotfilesfolder ] ;then - if [ -f ~/.config/ml4w/settings/dotfiles-folder.sh ] ;then +if [ -z "$automation_dotfilesfolder" ]; then + if [ -f ~/.config/ml4w/settings/dotfiles-folder.sh ]; then echo ":: An existing ML4W Dotfiles folder has been detected: ~/$(cat ~/.config/ml4w/settings/dotfiles-folder.sh)" echo ":: You can update your existing ML4W Dotfiles in $(cat ~/.config/ml4w/settings/dotfiles-folder.sh) or install in a new folder." echo @@ -57,7 +57,7 @@ if [ -z $automation_dotfilesfolder ] ;then fi fi - if [ $dot_files_update == "0" ] ;then + if [ $dot_files_update == "0" ]; then echo ":: Update will be executed in ~/$dot_folder" echo else @@ -66,4 +66,4 @@ if [ -z $automation_dotfilesfolder ] ;then else dot_folder=$automation_dotfilesfolder echo "AUTOMATION: Installation folder set to ~/$automation_dotfilesfolder" -fi \ No newline at end of file +fi diff --git a/lib/install/dotfiles/hook.sh b/lib/install/dotfiles/hook.sh index cdde5f28..868c890e 100755 --- a/lib/install/dotfiles/hook.sh +++ b/lib/install/dotfiles/hook.sh @@ -2,17 +2,17 @@ # Execute hook.sh # ------------------------------------------------------ -if [ -f $ml4w_directory/hook.sh ]; then +if [ -f "$ml4w_directory"/hook.sh ]; then echo -e "${GREEN}" figlet -f smslant "Hook Script" echo -e "${NONE}" echo ":: The script has detected a hook.sh script." echo - if [ -z $automation_hook ] ;then + if [ -z "$automation_hook" ]; then if gum confirm "Do you want to run the script now?"; then - cd $ml4w_directory + cd "$ml4w_directory" || exit ./hook.sh - cd $base_directory + cd "$base_directory" || exit echo ":: hook.sh executed!" elif [ $? -eq 130 ]; then echo ":: Installation canceled." @@ -21,13 +21,13 @@ if [ -f $ml4w_directory/hook.sh ]; then echo ":: Execution of hook.sh skipped." fi else - if [[ "$automation_hook" = true ]] ;then - cd $ml4w_directory + if [[ "$automation_hook" = true ]]; then + cd "$ml4w_directory" || exit ./hook.sh - cd $base_directory + cd "$base_directory" || exit echo ":: AUTOMATION: hook.sh executed!" echo - elif [[ "$automation_hook" = false ]] ;then + elif [[ "$automation_hook" = false ]]; then echo ":: AUTOMATION: hook.sh skipped" echo else diff --git a/lib/install/dotfiles/init-pywal.sh b/lib/install/dotfiles/init-pywal.sh index 4e26dcf4..8c75d468 100644 --- a/lib/install/dotfiles/init-pywal.sh +++ b/lib/install/dotfiles/init-pywal.sh @@ -12,4 +12,4 @@ if [ ! -f ~/.cache/wal/colors-hyprland.conf ]; then else echo ":: Pywal already activated." echo "" -fi \ No newline at end of file +fi diff --git a/lib/install/dotfiles/keyboard.sh b/lib/install/dotfiles/keyboard.sh index 9a4f75b8..d838cbe9 100755 --- a/lib/install/dotfiles/keyboard.sh +++ b/lib/install/dotfiles/keyboard.sh @@ -9,7 +9,7 @@ _setupKeyboardLayout() { } _setupKeyboardVariant() { - if gum confirm "Do you want to set a variant of the keyboard?" ; then + if gum confirm "Do you want to set a variant of the keyboard?"; then keyboard_variant=$(localectl list-x11-keymap-variants | gum filter --height 15 --placeholder "Find your keyboard layout...") echo ":: Keyboard variant changed to $keyboard_variant" fi @@ -22,7 +22,7 @@ _confirmKeyboard() { echo "Keyboard layout: $keyboard_layout" echo "Keyboard variant: $keyboard_variant" echo - if gum confirm "Do you want proceed with this keyboard setup?" --affirmative "Proceed" --negative "Change" ;then + if gum confirm "Do you want proceed with this keyboard setup?" --affirmative "Proceed" --negative "Change"; then return 0 elif [ $? -eq 130 ]; then exit 130 @@ -37,7 +37,7 @@ _keyboard_confirm() { echo ":: You have already restored your settings into the new installation." echo "You can repeat the keyboard setup again to choose between a desktop and laptop optimized configuration." echo - if gum confirm "Do you want to proceed with your existing keyboard configuration?" ;then + if gum confirm "Do you want to proceed with your existing keyboard configuration?"; then setkeyboard=1 elif [ $? -eq 130 ]; then echo ":: Installation canceled." @@ -48,7 +48,7 @@ _keyboard_confirm() { fi fi - if [ "$setkeyboard" == "0" ] ;then + if [ "$setkeyboard" == "0" ]; then # Default layout and variants keyboard_layout="us" @@ -57,48 +57,48 @@ _keyboard_confirm() { _confirmKeyboard if gum confirm "Are you using a laptop and would you like to enable the laptop presets?"; then - cp $template_directory/keyboard-laptop.conf $ml4w_directory/$version/.config/hypr/conf/keyboard.conf - echo "source = ~/.config/hypr/conf/layouts/laptop.conf" > $ml4w_directory/$version/.config/hypr/conf/layout.conf + cp "$template_directory"/keyboard-laptop.conf "$ml4w_directory"/"$version"/.config/hypr/conf/keyboard.conf + echo "source = ~/.config/hypr/conf/layouts/laptop.conf" >"$ml4w_directory"/"$version"/.config/hypr/conf/layout.conf elif [ $? -eq 130 ]; then echo ":: Installation canceled." exit 130 else - cp $template_directory/keyboard-default.conf $ml4w_directory/$version/.config/hypr/conf/keyboard.conf + cp "$template_directory"/keyboard-default.conf "$ml4w_directory"/"$version"/.config/hypr/conf/keyboard.conf fi SEARCH="KEYBOARD_LAYOUT" REPLACE="$keyboard_layout" - sed -i "s/$SEARCH/$REPLACE/g" $ml4w_directory/$version/.config/hypr/conf/keyboard.conf + sed -i "s/$SEARCH/$REPLACE/g" "$ml4w_directory"/"$version"/.config/hypr/conf/keyboard.conf # Set french keyboard variation - if [[ "$keyboard_layout" == "fr" ]] ;then - echo "source = ~/.config/hypr/conf/keybindings/fr.conf" > $ml4w_directory/$version/.config/hypr/conf/keybinding.conf + if [[ "$keyboard_layout" == "fr" ]]; then + echo "source = ~/.config/hypr/conf/keybindings/fr.conf" >"$ml4w_directory"/"$version"/.config/hypr/conf/keybinding.conf echo ":: Optimized keybindings for french keyboard layout" fi SEARCH="KEYBOARD_VARIANT" REPLACE="$keyboard_variant" - sed -i "s/$SEARCH/$REPLACE/g" $ml4w_directory/$version/.config/hypr/conf/keyboard.conf + sed -i "s/$SEARCH/$REPLACE/g" "$ml4w_directory"/"$version"/.config/hypr/conf/keyboard.conf echo echo ":: Keyboard setup complete." echo echo "PLEASE NOTE: You can update your keyboard layout later in ~/.config/hypr/conf/keyboard.conf" - fi + fi } -if [[ $(_check_update) == "false" ]] ;then +if [[ $(_check_update) == "false" ]]; then echo -e "${GREEN}" figlet -f smslant "Keyboard" echo -e "${NONE}" - if [ -z $automation_keyboard ] ;then + if [ -z "$automation_keyboard" ]; then _keyboard_confirm else - if [[ "$automation_keyboard" = true ]] && [[ "$restored" = 1 ]] ;then + if [[ "$automation_keyboard" = true ]] && [[ "$restored" = 1 ]]; then echo ":: AUTOMATION: Proceed with existing keyboard configuration." else - _keyboard_confirm + _keyboard_confirm fi fi fi diff --git a/lib/install/dotfiles/neovim.sh b/lib/install/dotfiles/neovim.sh index 7c0056e6..6568b8bd 100755 --- a/lib/install/dotfiles/neovim.sh +++ b/lib/install/dotfiles/neovim.sh @@ -2,8 +2,8 @@ # Neovim # ------------------------------------------------------ -if [ -z $automation_neovim ] ;then - if [ -d $ml4w_directory/$version/.config/nvim ] ;then +if [ -z "$automation_neovim" ]; then + if [ -d "$ml4w_directory"/"$version"/.config/nvim ]; then if [ -d ~/.config/nvim ]; then echo -e "${GREEN}" figlet -f smslant "Neovim" @@ -17,22 +17,22 @@ if [ -z $automation_neovim ] ;then echo ":: Installation canceled." exit 130 else - rm -rf $ml4w_directory/$version/.config/nvim/ - if [ -d ~/$dot_folder/.config/nvim ] ;then - rm -rf ~/$dot_folder/.config/nvim + rm -rf "$ml4w_directory"/"$version"/.config/nvim/ + if [ -d ~/"$dot_folder"/.config/nvim ]; then + rm -rf ~/"$dot_folder"/.config/nvim fi echo ":: Installation of ML4W Neovim configuration skipped." fi fi fi else - if [[ "$automation_neovim" = true ]] ;then + if [[ "$automation_neovim" = true ]]; then echo ":: AUTOMATION: neovim configuration will be installed." else - rm -rf $ml4w_directory/$version/.config/nvim - if [ -d ~/$dot_folder/.config/nvim ] ;then - rm -rf ~/$dot_folder/.config/nvim + rm -rf "$ml4w_directory"/"$version"/.config/nvim + if [ -d ~/"$dot_folder"/.config/nvim ]; then + rm -rf ~/"$dot_folder"/.config/nvim fi echo ":: AUTOMATION: Installation of the neovim configuration skipped." fi -fi \ No newline at end of file +fi diff --git a/lib/install/dotfiles/post.sh b/lib/install/dotfiles/post.sh index 56d4ab56..1cbaf81e 100755 --- a/lib/install/dotfiles/post.sh +++ b/lib/install/dotfiles/post.sh @@ -2,17 +2,17 @@ # Execute post.sh # ------------------------------------------------------ -if [ -f $ml4w_directory/post.sh ]; then +if [ -f "$ml4w_directory"/post.sh ]; then echo -e "${GREEN}" figlet -f smslant "Post Script" echo -e "${NONE}" echo ":: The script has detected a post.sh script." echo - if [ -z $automation_post ] ;then + if [ -z "$automation_post" ]; then if gum confirm "Do you want to run the script now?"; then - cd $ml4w_directory + cd "$ml4w_directory" || exit ./post.sh - cd $base_directory + cd "$base_directory" || exit echo ":: post.sh executed!" elif [ $? -eq 130 ]; then echo ":: Installation canceled." @@ -21,12 +21,12 @@ if [ -f $ml4w_directory/post.sh ]; then echo ":: Execution of post.sh skipped." fi else - if [[ "$automation_post" = true ]] ;then - cd $ml4w_directory + if [[ "$automation_post" = true ]]; then + cd "$ml4w_directory" || exit ./post.sh - cd $base_directory + cd "$base_directory" || exit echo ":: AUTOMATION: post.sh executed!" - elif [[ "$automation_post" = false ]] ;then + elif [[ "$automation_post" = false ]]; then echo ":: AUTOMATION: post.sh skipped" else echo ":: AUTOMATION ERROR: post error" diff --git a/lib/install/dotfiles/postinstall.sh b/lib/install/dotfiles/postinstall.sh index a55ffc59..f8c6f8c4 100644 --- a/lib/install/dotfiles/postinstall.sh +++ b/lib/install/dotfiles/postinstall.sh @@ -2,9 +2,9 @@ # Post Installation script # ------------------------------------------------------ -if [ -f ~/.config/ml4w/settings/dotfiles-folder.sh ] || [ -d ~/dotfiles ] ;then +if [ -f ~/.config/ml4w/settings/dotfiles-folder.sh ] || [ -d ~/dotfiles ]; then echo ":: Existing Dotfiles Installation detected. Post installation not needed." else touch ~/.cache/ml4w-post-install echo ":: Post installation script created" -fi \ No newline at end of file +fi diff --git a/lib/install/dotfiles/preparation.sh b/lib/install/dotfiles/preparation.sh index 4ec9cb80..510e0756 100644 --- a/lib/install/dotfiles/preparation.sh +++ b/lib/install/dotfiles/preparation.sh @@ -12,30 +12,30 @@ fi # Create required folder structure echo ":: Preparing temporary folders for the installation." -if [ ! -d $ml4w_directory ] ;then - mkdir $ml4w_directory +if [ ! -d "$ml4w_directory" ]; then + mkdir "$ml4w_directory" echo ":: $ml4w_directory folder created." fi -if [ ! -d $ml4w_directory/$version ] ;then - mkdir $ml4w_directory/$version +if [ ! -d "$ml4w_directory"/"$version" ]; then + mkdir "$ml4w_directory"/"$version" echo ":: $ml4w_directory/$version folder created." else echo ":: The folder $ml4w_directory/$version already exists from previous installations." - rm -rf $ml4w_directory/$version - mkdir $ml4w_directory/$version + rm -rf "$ml4w_directory"/"$version" + mkdir "$ml4w_directory"/"$version" echo ":: Clean build prepared for the installation." fi -if [ ! -d $ml4w_directory/library ] ;then - mkdir $ml4w_directory/library +if [ ! -d "$ml4w_directory"/library ]; then + mkdir "$ml4w_directory"/library echo ":: library folder created" fi # Copy files to the destination -rsync -a -I --exclude-from=$install_directory/includes/excludes.txt $share_directory/dotfiles/. $ml4w_directory/$version/ +rsync -a -I --exclude-from="$install_directory"/includes/excludes.txt "$share_directory"/dotfiles/. "$ml4w_directory"/"$version"/ # Check copy success -if [[ $(_isFolderEmpty $ml4w_directory/$version/) == 0 ]] ;then - echo "AN ERROR HAS OCCURED. Preparation of $ml4w_directory/$version/ failed" +if [[ $(_isFolderEmpty "$ml4w_directory"/"$version"/) == 0 ]]; then + echo "AN ERROR HAS OCCURED. Preparation of $ml4w_directory/$version/ failed" echo "Please check that rsync is installad on your system." echo "Execution of rsync -a -I --exclude-from=$install_directory/includes/excludes.txt . $ml4w_directory/$version/ is required." exit @@ -43,59 +43,59 @@ fi echo ":: ML4W Dotfiles $version successfully prepared in $ml4w_directory/$version/" # Copy hook.tpl if hook.sh not exists -if [ ! -f $ml4w_directory/hook.sh ] ;then - cp $template_directory/hook.tpl $ml4w_directory/ +if [ ! -f "$ml4w_directory"/hook.sh ]; then + cp "$template_directory"/hook.tpl "$ml4w_directory"/ echo ":: hook.tpl created" else - chmod +x $ml4w_directory/hook.sh + chmod +x "$ml4w_directory"/hook.sh echo ":: hook.sh already exists" fi # Copy post.tpl if post.sh not exists -if [ ! -f $ml4w_directory/post.sh ] ;then - cp $template_directory/post.tpl $ml4w_directory/ +if [ ! -f "$ml4w_directory"/post.sh ]; then + cp "$template_directory"/post.tpl "$ml4w_directory"/ echo ":: post.tpl created" else - chmod +x $ml4w_directory/post.sh + chmod +x "$ml4w_directory"/post.sh echo ":: post.sh already exists" fi # Copy automation.tpl -cp $template_directory/automation.tpl $ml4w_directory/ +cp "$template_directory"/automation.tpl "$ml4w_directory"/ echo ":: automation.tpl created" # Copy activate.sh -cp $install_directory/activate.sh $ml4w_directory/ -chmod +x $ml4w_directory/activate.sh +cp "$install_directory"/activate.sh "$ml4w_directory"/ +chmod +x "$ml4w_directory"/activate.sh echo ":: activate.sh updated" # Prepare library folder -cp $template_directory/scripts.tpl $ml4w_directory/library/scripts.sh +cp "$template_directory"/scripts.tpl "$ml4w_directory"/library/scripts.sh echo ":: scripts.sh for $version updated in $ml4w_directory/library" # Replace version SEARCH="ML4WVERSION" REPLACE="$version" -sed -i "s/$SEARCH/$REPLACE/g" $ml4w_directory/library/scripts.sh +sed -i "s/$SEARCH/$REPLACE/g" "$ml4w_directory"/library/scripts.sh # Replace ml4w_directory SEARCH="ML4WDIRECTORY" REPLACE="$ml4w_directory" -sed -i "s|$SEARCH|$REPLACE|g" $ml4w_directory/library/scripts.sh +sed -i "s|$SEARCH|$REPLACE|g" "$ml4w_directory"/library/scripts.sh # Replace ml4w_aurhelper SEARCH="ML4WAURHELPER" REPLACE="$aur_helper" -sed -i "s/$SEARCH/$REPLACE/g" $ml4w_directory/library/scripts.sh +sed -i "s/$SEARCH/$REPLACE/g" "$ml4w_directory"/library/scripts.sh -echo "$version" > $ml4w_directory/$version/.config/ml4w/version/name +echo "$version" >"$ml4w_directory"/"$version"/.config/ml4w/version/name echo ":: name updated with $version" -echo "$aur_helper" > $ml4w_directory/$version/.config/ml4w/settings/aur.sh -if [ -f ~/.config/ml4w/settings/aur.sh ] ;then +echo "$aur_helper" >"$ml4w_directory"/"$version"/.config/ml4w/settings/aur.sh +if [ -f ~/.config/ml4w/settings/aur.sh ]; then rm ~/.config/ml4w/settings/aur.sh fi echo ":: AUR Helper updated with $aur_helper" # Write dot folder into settings -echo "$dot_folder" > $ml4w_directory/$version/.config/ml4w/settings/dotfiles-folder.sh \ No newline at end of file +echo "$dot_folder" >"$ml4w_directory"/"$version"/.config/ml4w/settings/dotfiles-folder.sh diff --git a/lib/install/dotfiles/reboot.sh b/lib/install/dotfiles/reboot.sh index 1ae550e6..f9783715 100644 --- a/lib/install/dotfiles/reboot.sh +++ b/lib/install/dotfiles/reboot.sh @@ -7,7 +7,7 @@ figlet -f smslant "Done" echo -e "${NONE}" echo "A reboot of your system is recommended." echo -if gum confirm "Do you want to reboot your system now?" ;then +if gum confirm "Do you want to reboot your system now?"; then gum spin --spinner dot --title "Rebooting now..." -- sleep 3 systemctl reboot elif [ $? -eq 130 ]; then diff --git a/lib/install/dotfiles/restore.sh b/lib/install/dotfiles/restore.sh index 73b0c10b..a0e77917 100755 --- a/lib/install/dotfiles/restore.sh +++ b/lib/install/dotfiles/restore.sh @@ -10,63 +10,63 @@ _showRestoreOptions() { echo "The following configurations can be transferred into the new installation." echo restorelist="" - if [ -d ~/$dot_folder/.config/ml4w/settings ]; then + if [ -d ~/"$dot_folder"/.config/ml4w/settings ]; then restorelist+="~/$dot_folder/.config/ml4w/settings " selectedlist+="~/$dot_folder/.config/ml4w/settings," fi - if [ -f ~/$dot_folder/.config/hypr/hypridle.conf ]; then + if [ -f ~/"$dot_folder"/.config/hypr/hypridle.conf ]; then restorelist+="~/$dot_folder/.config/hypr/hypridle.conf " selectedlist+="~/$dot_folder/.config/hypr/hypridle.conf," fi - if [ -f ~/$dot_folder/.config/hypr/conf/custom.conf ]; then + if [ -f ~/"$dot_folder"/.config/hypr/conf/custom.conf ]; then restorelist+="~/$dot_folder/.config/hypr/conf/custom.conf " selectedlist+="~/$dot_folder/.config/hypr/conf/custom.conf," fi - if [ -f ~/$dot_folder/.config/hypr/conf/keyboard.conf ]; then + if [ -f ~/"$dot_folder"/.config/hypr/conf/keyboard.conf ]; then restorelist+="~/$dot_folder/.config/hypr/conf/keyboard.conf " selectedlist+="~/$dot_folder/.config/hypr/conf/keyboard.conf," fi - if [ -f ~/$dot_folder/.config/hypr/conf/keybinding.conf ] && [ -d ~/$dot_folder/.config/hypr/conf/keybindings/ ]; then + if [ -f ~/"$dot_folder"/.config/hypr/conf/keybinding.conf ] && [ -d ~/"$dot_folder"/.config/hypr/conf/keybindings/ ]; then restorelist+="~/$dot_folder/.config/hypr/conf/keybinding.conf " selectedlist+="~/$dot_folder/.config/hypr/conf/keybinding.conf," fi - if [ -f ~/$dot_folder/.config/hypr/conf/environment.conf ] && [ -d ~/$dot_folder/.config/hypr/conf/environments/ ]; then + if [ -f ~/"$dot_folder"/.config/hypr/conf/environment.conf ] && [ -d ~/"$dot_folder"/.config/hypr/conf/environments/ ]; then restorelist+="~/$dot_folder/.config/hypr/conf/environment.conf " selectedlist+="~/$dot_folder/.config/hypr/conf/environment.conf," fi - if [ -f ~/$dot_folder/.config/hypr/conf/layout.conf ] && [ -d ~$dot_folder/.config/hypr/conf/layouts/ ]; then + if [ -f ~/"$dot_folder"/.config/hypr/conf/layout.conf ] && [ -d ~"$dot_folder"/.config/hypr/conf/layouts/ ]; then restorelist+="~/$dot_folder/.config/hypr/conf/layout.conf " selectedlist+="~/$dot_folder/.config/hypr/conf/layout.conf," fi - if [ -f ~/$dot_folder/.config/hypr/conf/windowrule.conf ] && [ -d ~/$dot_folder/.config/hypr/conf/windowrules/ ]; then + if [ -f ~/"$dot_folder"/.config/hypr/conf/windowrule.conf ] && [ -d ~/"$dot_folder"/.config/hypr/conf/windowrules/ ]; then restorelist+="~/$dot_folder/.config/hypr/conf/windowrule.conf " selectedlist+="~/$dot_folder/.config/hypr/conf/windowrule.conf," fi - if [ -f ~/$dot_folder/.config/hypr/conf/monitor.conf ] && [ -d ~/$dot_folder/.config/hypr/conf/monitors/ ]; then + if [ -f ~/"$dot_folder"/.config/hypr/conf/monitor.conf ] && [ -d ~/"$dot_folder"/.config/hypr/conf/monitors/ ]; then restorelist+="~/$dot_folder/.config/hypr/conf/monitor.conf " selectedlist+="~/$dot_folder/.config/hypr/conf/monitor.conf," fi - if [ -f ~/$dot_folder/.config/hypr/conf/animation.conf ] && [ -d ~/$dot_folder/.config/hypr/conf/animations/ ]; then + if [ -f ~/"$dot_folder"/.config/hypr/conf/animation.conf ] && [ -d ~/"$dot_folder"/.config/hypr/conf/animations/ ]; then restorelist+="~/$dot_folder/.config/hypr/conf/animation.conf " selectedlist+="~/$dot_folder/.config/hypr/conf/animation.conf," fi - if [ -f ~/$dot_folder/.config/hypr/conf/decoration.conf ] && [ -d ~/$dot_folder/.config/hypr/conf/decorations/ ]; then + if [ -f ~/"$dot_folder"/.config/hypr/conf/decoration.conf ] && [ -d ~/"$dot_folder"/.config/hypr/conf/decorations/ ]; then restorelist+="~/$dot_folder/.config/hypr/conf/decoration.conf " selectedlist+="~/$dot_folder/.config/hypr/conf/decoration.conf," fi - if [ -f ~/$dot_folder/.config/hypr/conf/window.conf ] && [ -d ~/$dot_folder/.config/hypr/conf/windows/ ]; then + if [ -f ~/"$dot_folder"/.config/hypr/conf/window.conf ] && [ -d ~/"$dot_folder"/.config/hypr/conf/windows/ ]; then restorelist+="~/$dot_folder/.config/hypr/conf/window.conf " selectedlist+="~/$dot_folder/.config/hypr/conf/window.conf," fi - restoreselect=$(gum choose --no-limit --height 20 --cursor-prefix "( ) " --selected-prefix "(x) " --unselected-prefix "( ) " --selected="$selectedlist" $restorelist) - if [ ! -z "$restoreselect" ] ;then - echo "Selected to restore:" + restoreselect=$(gum choose --no-limit --height 20 --cursor-prefix "( ) " --selected-prefix "(x) " --unselected-prefix "( ) " --selected="$selectedlist" "$restorelist") + if [ ! -z "$restoreselect" ]; then + echo "Selected to restore:" echo "$restoreselect" echo "" confirmrestore=$(gum choose "Start restore" "Change restore" "Skip restore") - if [ "$confirmrestore" == "Start restore" ] ;then + if [ "$confirmrestore" == "Start restore" ]; then _startRestore - elif [ "$confirmrestore" == "Change restore" ]; then + elif [ "$confirmrestore" == "Change restore" ]; then _showRestoreOptions else echo ":: Restore skipped." @@ -75,11 +75,11 @@ _showRestoreOptions() { else echo "No files selected to restore." confirmrestore=$(gum choose "Change restore" "Skip restore") - if [ -z "${confirmrestore}" ] ;then + if [ -z "${confirmrestore}" ]; then echo ":: Installation canceled." exit fi - if [ "$confirmrestore" == "Change restore" ]; then + if [ "$confirmrestore" == "Change restore" ]; then echo "" _showRestoreOptions else @@ -95,133 +95,133 @@ _restore_automation() { } _startRestore() { - if [[ $restoreselect == *"~/$dot_folder/.config/ml4w/settings"* ]] || [[ $restoreselect == *"All"* ]] ; then - if [ -d ~/$dot_folder/.config/ml4w/settings ]; then - rsync -avhp -I ~/$dot_folder/.config/ml4w/settings/ $ml4w_directory/$version/.config/ml4w/settings/ + if [[ $restoreselect == *"~/$dot_folder/.config/ml4w/settings"* ]] || [[ $restoreselect == *"All"* ]]; then + if [ -d ~/"$dot_folder"/.config/ml4w/settings ]; then + rsync -avhp -I ~/"$dot_folder"/.config/ml4w/settings/ "$ml4w_directory"/"$version"/.config/ml4w/settings/ echo ":: settings restored!" fi fi - if [[ $restoreselect == *"~/$dot_folder/.config/hypr/hypridle.conf"* ]] || [[ $restoreselect == *"All"* ]] ; then - if [ -f ~/$dot_folder/.config/hypr/hypridle.conf ]; then - cp ~/$dot_folder/.config/hypr/hypridle.conf $ml4w_directory/$version/.config/hypr/ + if [[ $restoreselect == *"~/$dot_folder/.config/hypr/hypridle.conf"* ]] || [[ $restoreselect == *"All"* ]]; then + if [ -f ~/"$dot_folder"/.config/hypr/hypridle.conf ]; then + cp ~/"$dot_folder"/.config/hypr/hypridle.conf "$ml4w_directory"/"$version"/.config/hypr/ echo ":: Hyprland hypridle.conf restored!" fi fi - if [[ $restoreselect == *"~/$dot_folder/.config/hypr/conf/custom.conf"* ]] || [[ $restoreselect == *"All"* ]] ; then - if [ -f ~/$dot_folder/.config/hypr/conf/custom.conf ]; then - cp ~/$dot_folder/.config/hypr/conf/custom.conf $ml4w_directory/$version/.config/hypr/conf/ + if [[ $restoreselect == *"~/$dot_folder/.config/hypr/conf/custom.conf"* ]] || [[ $restoreselect == *"All"* ]]; then + if [ -f ~/"$dot_folder"/.config/hypr/conf/custom.conf ]; then + cp ~/"$dot_folder"/.config/hypr/conf/custom.conf "$ml4w_directory"/"$version"/.config/hypr/conf/ echo ":: Hyprland custom.conf restored!" fi fi - if [[ $restoreselect == *"~/$dot_folder/.config/hypr/conf/keyboard.conf"* ]] || [[ $restoreselect == *"All"* ]] ; then - if [ -f ~/$dot_folder/.config/hypr/conf/keyboard.conf ]; then - cp ~/$dot_folder/.config/hypr/conf/keyboard.conf $ml4w_directory/$version/.config/hypr/conf/ + if [[ $restoreselect == *"~/$dot_folder/.config/hypr/conf/keyboard.conf"* ]] || [[ $restoreselect == *"All"* ]]; then + if [ -f ~/"$dot_folder"/.config/hypr/conf/keyboard.conf ]; then + cp ~/"$dot_folder"/.config/hypr/conf/keyboard.conf "$ml4w_directory"/"$version"/.config/hypr/conf/ echo ":: Hyprland keyboard.conf restored!" fi - fi - if [[ $restoreselect == *"~/$dot_folder/.config/hypr/conf/monitor.conf"* ]] || [[ $restoreselect == *"All"* ]] ; then - if [ -f ~/$dot_folder/.config/hypr/conf/monitor.conf ]; then - cp ~/$dot_folder/.config/hypr/conf/monitor.conf $ml4w_directory/$version/.config/hypr/conf/ - sed -i -e 's/dotfiles/.config/g' $ml4w_directory/$version/.config/hypr/conf/monitor.conf - echo ":: Hyprland monitor.conf restored!" + fi + if [[ $restoreselect == *"~/$dot_folder/.config/hypr/conf/monitor.conf"* ]] || [[ $restoreselect == *"All"* ]]; then + if [ -f ~/"$dot_folder"/.config/hypr/conf/monitor.conf ]; then + cp ~/"$dot_folder"/.config/hypr/conf/monitor.conf "$ml4w_directory"/"$version"/.config/hypr/conf/ + sed -i -e 's/dotfiles/.config/g' "$ml4w_directory"/"$version"/.config/hypr/conf/monitor.conf + echo ":: Hyprland monitor.conf restored!" fi fi - if [[ $restoreselect == *"~/$dot_folder/.config/hypr/conf/keybinding.conf"* ]] || [[ $restoreselect == *"All"* ]] ; then - if [ -f ~/$dot_folder/.config/hypr/conf/keybinding.conf ]; then - cp ~/$dot_folder/.config/hypr/conf/keybinding.conf $ml4w_directory/$version/.config/hypr/conf/ - sed -i -e 's/dotfiles/.config/g' $ml4w_directory/$version/.config/hypr/conf/keybinding.conf + if [[ $restoreselect == *"~/$dot_folder/.config/hypr/conf/keybinding.conf"* ]] || [[ $restoreselect == *"All"* ]]; then + if [ -f ~/"$dot_folder"/.config/hypr/conf/keybinding.conf ]; then + cp ~/"$dot_folder"/.config/hypr/conf/keybinding.conf "$ml4w_directory"/"$version"/.config/hypr/conf/ + sed -i -e 's/dotfiles/.config/g' "$ml4w_directory"/"$version"/.config/hypr/conf/keybinding.conf echo ":: Hyprland keybinding.conf restored!" fi fi - if [[ $restoreselect == *"~/$dot_folder/.config/hypr/conf/environment.conf"* ]] || [[ $restoreselect == *"All"* ]] ; then - if [ -f ~/$dot_folder/.config/hypr/conf/environment.conf ]; then - cp ~/$dot_folder/.config/hypr/conf/environment.conf $ml4w_directory/$version/.config/hypr/conf/ - sed -i -e 's/dotfiles/.config/g' $ml4w_directory/$version/.config/hypr/conf/environment.conf + if [[ $restoreselect == *"~/$dot_folder/.config/hypr/conf/environment.conf"* ]] || [[ $restoreselect == *"All"* ]]; then + if [ -f ~/"$dot_folder"/.config/hypr/conf/environment.conf ]; then + cp ~/"$dot_folder"/.config/hypr/conf/environment.conf "$ml4w_directory"/"$version"/.config/hypr/conf/ + sed -i -e 's/dotfiles/.config/g' "$ml4w_directory"/"$version"/.config/hypr/conf/environment.conf echo ":: Hyprland environment.conf restored!" fi - fi - if [[ $restoreselect == *"~/$dot_folder/.config/hypr/conf/layout.conf"* ]] || [[ $restoreselect == *"All"* ]] ; then - if [ -f ~/$dot_folder/.config/hypr/conf/layout.conf ]; then - cp ~/$dot_folder/.config/hypr/conf/layout.conf $ml4w_directory/$version/.config/hypr/conf/ - sed -i -e 's/dotfiles/.config/g' $ml4w_directory/$version/.config/hypr/conf/layout.conf + fi + if [[ $restoreselect == *"~/$dot_folder/.config/hypr/conf/layout.conf"* ]] || [[ $restoreselect == *"All"* ]]; then + if [ -f ~/"$dot_folder"/.config/hypr/conf/layout.conf ]; then + cp ~/"$dot_folder"/.config/hypr/conf/layout.conf "$ml4w_directory"/"$version"/.config/hypr/conf/ + sed -i -e 's/dotfiles/.config/g' "$ml4w_directory"/"$version"/.config/hypr/conf/layout.conf echo ":: Hyprland layout.conf restored!" fi - fi - if [[ $restoreselect == *"~/$dot_folder/.config/hypr/conf/windowrule.conf"* ]] || [[ $restoreselect == *"All"* ]] ; then - if [ -f ~/$dot_folder/.config/hypr/conf/windowrule.conf ]; then - cp ~/$dot_folder/.config/hypr/conf/windowrule.conf $ml4w_directory/$version/.config/hypr/conf/ - sed -i -e 's/dotfiles/.config/g' $ml4w_directory/$version/.config/hypr/conf/windowrule.conf + fi + if [[ $restoreselect == *"~/$dot_folder/.config/hypr/conf/windowrule.conf"* ]] || [[ $restoreselect == *"All"* ]]; then + if [ -f ~/"$dot_folder"/.config/hypr/conf/windowrule.conf ]; then + cp ~/"$dot_folder"/.config/hypr/conf/windowrule.conf "$ml4w_directory"/"$version"/.config/hypr/conf/ + sed -i -e 's/dotfiles/.config/g' "$ml4w_directory"/"$version"/.config/hypr/conf/windowrule.conf echo ":: Hyprland windowrule.conf restored!" fi - fi - if [[ $restoreselect == *"~/$dot_folder/.config/hypr/conf/animation.conf"* ]] || [[ $restoreselect == *"All"* ]] ; then - if [ -f ~/$dot_folder/.config/hypr/conf/animation.conf ]; then - cp ~/$dot_folder/.config/hypr/conf/animation.conf $ml4w_directory/$version/.config/hypr/conf/ - sed -i -e 's/dotfiles/.config/g' $ml4w_directory/$version/.config/hypr/conf/animation.conf + fi + if [[ $restoreselect == *"~/$dot_folder/.config/hypr/conf/animation.conf"* ]] || [[ $restoreselect == *"All"* ]]; then + if [ -f ~/"$dot_folder"/.config/hypr/conf/animation.conf ]; then + cp ~/"$dot_folder"/.config/hypr/conf/animation.conf "$ml4w_directory"/"$version"/.config/hypr/conf/ + sed -i -e 's/dotfiles/.config/g' "$ml4w_directory"/"$version"/.config/hypr/conf/animation.conf echo ":: Hyprland animation.conf restored!" fi fi - if [[ $restoreselect == *"~/$dot_folder/.config/hypr/conf/decoration.conf"* ]] || [[ $restoreselect == *"All"* ]] ; then - if [ -f ~/$dot_folder/.config/hypr/conf/decoration.conf ]; then - cp ~/$dot_folder/.config/hypr/conf/decoration.conf $ml4w_directory/$version/.config/hypr/conf/ - sed -i -e 's/dotfiles/.config/g' $ml4w_directory/$version/.config/hypr/conf/decoration.conf + if [[ $restoreselect == *"~/$dot_folder/.config/hypr/conf/decoration.conf"* ]] || [[ $restoreselect == *"All"* ]]; then + if [ -f ~/"$dot_folder"/.config/hypr/conf/decoration.conf ]; then + cp ~/"$dot_folder"/.config/hypr/conf/decoration.conf "$ml4w_directory"/"$version"/.config/hypr/conf/ + sed -i -e 's/dotfiles/.config/g' "$ml4w_directory"/"$version"/.config/hypr/conf/decoration.conf echo ":: Hyprland decoration.conf restored!" fi fi - if [[ $restoreselect == *"~/$dot_folder/.config/hypr/conf/window.conf"* ]] || [[ $restoreselect == *"All"* ]] ; then - if [ -f ~/$dot_folder/.config/hypr/conf/window.conf ]; then - cp ~/$dot_folder/.config/hypr/conf/window.conf $ml4w_directory/$version/.config/hypr/conf/ - sed -i -e 's/dotfiles/.config/g' $ml4w_directory/$version/.config/hypr/conf/window.conf + if [[ $restoreselect == *"~/$dot_folder/.config/hypr/conf/window.conf"* ]] || [[ $restoreselect == *"All"* ]]; then + if [ -f ~/"$dot_folder"/.config/hypr/conf/window.conf ]; then + cp ~/"$dot_folder"/.config/hypr/conf/window.conf "$ml4w_directory"/"$version"/.config/hypr/conf/ + sed -i -e 's/dotfiles/.config/g' "$ml4w_directory"/"$version"/.config/hypr/conf/window.conf echo ":: Hyprland window.conf restored!" fi fi # Check Wallpaper - if [ -f ~/.config/ml4w/cache/blurred_wallpaper.png ] ;then - rm $ml4w_directory/$version/.config/ml4w/cache/blurred_wallpaper.png - elif [ -f ~/.cache/blurred_wallpaper.png ] ;then - cp ~/.cache/blurred_wallpaper.png $ml4w_directory/$version/.config/ml4w/cache/blurred_wallpaper.png + if [ -f ~/.config/ml4w/cache/blurred_wallpaper.png ]; then + rm "$ml4w_directory"/"$version"/.config/ml4w/cache/blurred_wallpaper.png + elif [ -f ~/.cache/blurred_wallpaper.png ]; then + cp ~/.cache/blurred_wallpaper.png "$ml4w_directory"/"$version"/.config/ml4w/cache/blurred_wallpaper.png + fi + + if [ -f ~/.config/ml4w/cache/current_wallpaper ]; then + rm "$ml4w_directory"/"$version"/.config/ml4w/cache/current_wallpaper + elif [ -f ~/.cache/current_wallpaper ]; then + cp ~/.cache/current_wallpaper "$ml4w_directory"/"$version"/.config/ml4w/cache/current_wallpaper + fi + + if [ -f ~/.config/ml4w/cache/current_wallpaper.rasi ]; then + rm "$ml4w_directory"/"$version"/.config/ml4w/cache/current_wallpaper.rasi + elif [ -f ~/.cache/current_wallpaper.rasi ]; then + cp ~/.cache/current_wallpaper.rasi "$ml4w_directory"/"$version"/.config/ml4w/cache/current_wallpaper.rasi fi - if [ -f ~/.config/ml4w/cache/current_wallpaper ] ;then - rm $ml4w_directory/$version/.config/ml4w/cache/current_wallpaper - elif [ -f ~/.cache/current_wallpaper ] ;then - cp ~/.cache/current_wallpaper $ml4w_directory/$version/.config/ml4w/cache/current_wallpaper - fi - - if [ -f ~/.config/ml4w/cache/current_wallpaper.rasi ] ;then - rm $ml4w_directory/$version/.config/ml4w/cache/current_wallpaper.rasi - elif [ -f ~/.cache/current_wallpaper.rasi ] ;then - cp ~/.cache/current_wallpaper.rasi $ml4w_directory/$version/.config/ml4w/cache/current_wallpaper.rasi - fi - - if [ -f ~/.config/ml4w/cache/square_wallpaper.png ] ;then - rm $ml4w_directory/$version/.config/ml4w/cache/square_wallpaper.png - elif [ -f ~/.cache/square_wallpaper.png ] ;then - cp ~/.cache/square_wallpaper.png $ml4w_directory/$version/.config/ml4w/cache/square_wallpaper.png - fi - - if [ -f ~/.config/hypr/hyprpaper.conf ] ;then - rm $ml4w_directory/$version/.config/hypr/hyprpaper.conf + if [ -f ~/.config/ml4w/cache/square_wallpaper.png ]; then + rm "$ml4w_directory"/"$version"/.config/ml4w/cache/square_wallpaper.png + elif [ -f ~/.cache/square_wallpaper.png ]; then + cp ~/.cache/square_wallpaper.png "$ml4w_directory"/"$version"/.config/ml4w/cache/square_wallpaper.png + fi + + if [ -f ~/.config/hypr/hyprpaper.conf ]; then + rm "$ml4w_directory"/"$version"/.config/hypr/hyprpaper.conf fi restored=1 return 0 } -if [ -d ~/$dot_folder ]; then +if [ -d ~/"$dot_folder" ]; then echo -e "${GREEN}" figlet -f smslant "Restore" echo -e "${NONE}" - restored=0 - echo "The script will try to restore existing configurations." - echo "" - if [ -z $automation_restore ] ;then - _showRestoreOptions - else - if [[ "$automation_restore" = true ]] ;then - _restore_automation - fi + restored=0 + echo "The script will try to restore existing configurations." + echo "" + if [ -z "$automation_restore" ]; then + _showRestoreOptions + else + if [[ "$automation_restore" = true ]]; then + _restore_automation fi - echo + fi + echo fi diff --git a/lib/install/dotfiles/settings.sh b/lib/install/dotfiles/settings.sh index 88d95168..de239d1d 100755 --- a/lib/install/dotfiles/settings.sh +++ b/lib/install/dotfiles/settings.sh @@ -3,9 +3,9 @@ # ------------------------------------------------------ if [ "$restored" == "1" ]; then - if [ -f ~/.config/ml4w/settings/settings.json ] ;then + if [ -f ~/.config/ml4w/settings/settings.json ]; then # python restore.py - python $install_directory/dotfiles/restore.py + python "$install_directory"/dotfiles/restore.py rm ~/.config/ml4w/settings/settings.json echo ":: Legacy settings.json removed" fi @@ -14,7 +14,7 @@ fi echo ":: Starting restore settings" # Replace waybar_timeformat and waybar_dateformat -if [ -f ~/.config/ml4w/settings/waybar_timeformat.sh ] ;then +if [ -f ~/.config/ml4w/settings/waybar_timeformat.sh ]; then replace_time=$(cat ~/.config/ml4w/settings/waybar_timeformat.sh) replace_date=$(cat ~/.config/ml4w/settings/waybar_dateformat.sh) search_str="\"format\"" @@ -24,9 +24,9 @@ if [ -f ~/.config/ml4w/settings/waybar_timeformat.sh ] ;then fi # Replace waybar_custom_timedateformat -if [ -f ~/.config/ml4w/settings/waybar_custom_timedateformat.sh ] ;then +if [ -f ~/.config/ml4w/settings/waybar_custom_timedateformat.sh ]; then replace_value=$(cat ~/.config/ml4w/settings/waybar_custom_timedateformat.sh) - if [ ! -z "$replace_value" ] ;then + if [ ! -z "$replace_value" ]; then search_str="\"format\"" replace_str="\ \ \ \ \"format\": \"{:$replace_value}\"," _replaceLineInFileCheckpoint "$search_str" "$replace_str" "clock" "$HOME/.config/waybar/modules.json" @@ -35,7 +35,7 @@ if [ -f ~/.config/ml4w/settings/waybar_custom_timedateformat.sh ] ;then fi # Replace dunst_position -if [ -f ~/.config/ml4w/settings/dunst_position.sh ] ;then +if [ -f ~/.config/ml4w/settings/dunst_position.sh ]; then replace_value=$(cat ~/.config/ml4w/settings/dunst_position.sh) search_str="origin" replace_str="\ \ \ \ origin = $replace_value" @@ -44,7 +44,7 @@ if [ -f ~/.config/ml4w/settings/dunst_position.sh ] ;then fi # Replace waybar_workspaces -if [ -f ~/.config/ml4w/settings/waybar_workspaces.sh ] ;then +if [ -f ~/.config/ml4w/settings/waybar_workspaces.sh ]; then replace_value=$(cat ~/.config/ml4w/settings/waybar_workspaces.sh) search_str="\"*\"" replace_str="\ \ \ \ \ \ \"*\": $replace_value" @@ -53,10 +53,10 @@ if [ -f ~/.config/ml4w/settings/waybar_workspaces.sh ] ;then fi # Replace waybar_taskbar -if [ -f ~/.config/ml4w/settings/waybar_taskbar.sh ] ;then +if [ -f ~/.config/ml4w/settings/waybar_taskbar.sh ]; then replace_value=$(cat ~/.config/ml4w/settings/waybar_taskbar.sh) search_str="taskbar" - if [[ $replace_value == "True" ]] ;then + if [[ $replace_value == "True" ]]; then replace_str="\"wlr\/taskbar\"," else replace_str="\/\/\"wlr\/taskbar\"," @@ -69,10 +69,10 @@ if [ -f ~/.config/ml4w/settings/waybar_taskbar.sh ] ;then fi # Replace waybar_network -if [ -f ~/.config/ml4w/settings/waybar_network.sh ] ;then +if [ -f ~/.config/ml4w/settings/waybar_network.sh ]; then replace_value=$(cat ~/.config/ml4w/settings/waybar_network.sh) search_str="network" - if [[ $replace_value == "True" ]] ;then + if [[ $replace_value == "True" ]]; then replace_str="\"network\"," else replace_str="\/\/\"network\"," @@ -87,10 +87,10 @@ if [ -f ~/.config/ml4w/settings/waybar_network.sh ] ;then fi # Replace waybar_backlight -if [ -f ~/.config/ml4w/settings/waybar_backlight.sh ] ;then +if [ -f ~/.config/ml4w/settings/waybar_backlight.sh ]; then replace_value=$(cat ~/.config/ml4w/settings/waybar_backlight.sh) search_str="backlight" - if [[ $replace_value == "True" ]] ;then + if [[ $replace_value == "True" ]]; then replace_str="\"backlight\"," else replace_str="\/\/\"backlight\"," @@ -105,10 +105,10 @@ if [ -f ~/.config/ml4w/settings/waybar_backlight.sh ] ;then fi # Replace waybar_chatgpt -if [ -f ~/.config/ml4w/settings/waybar_chatgpt.sh ] ;then +if [ -f ~/.config/ml4w/settings/waybar_chatgpt.sh ]; then replace_value=$(cat ~/.config/ml4w/settings/waybar_chatgpt.sh) search_str="chatgpt" - if [[ $replace_value == "True" ]] ;then + if [[ $replace_value == "True" ]]; then replace_str="\ \ \ \ \ \ \"custom\/chatgpt\"," else replace_str="\ \ \ \ \ \ \/\/\"custom\/chatgpt\"," @@ -118,10 +118,10 @@ if [ -f ~/.config/ml4w/settings/waybar_chatgpt.sh ] ;then fi # Replace waybar_systray -if [ -f ~/.config/ml4w/settings/waybar_systray.sh ] ;then +if [ -f ~/.config/ml4w/settings/waybar_systray.sh ]; then replace_value=$(cat ~/.config/ml4w/settings/waybar_systray.sh) search_str="tray" - if [[ $replace_value == "True" ]] ;then + if [[ $replace_value == "True" ]]; then replace_str="\"tray\"," else replace_str="\/\/\"tray\"," @@ -136,10 +136,10 @@ if [ -f ~/.config/ml4w/settings/waybar_systray.sh ] ;then fi # Replace waybar_screenlock -if [ -f ~/.config/ml4w/settings/waybar_screenlock.sh ] ;then +if [ -f ~/.config/ml4w/settings/waybar_screenlock.sh ]; then replace_value=$(cat ~/.config/ml4w/settings/waybar_screenlock.sh) search_str="hypridle" - if [[ $replace_value == "True" ]] ;then + if [[ $replace_value == "True" ]]; then replace_str="\ \ \ \ \ \ \"custom\/hypridle\"," else replace_str="\ \ \ \ \ \ \/\/\"custom\/hypridle\"," @@ -149,10 +149,10 @@ if [ -f ~/.config/ml4w/settings/waybar_screenlock.sh ] ;then fi # Replace waybar_window -if [ -f ~/.config/ml4w/settings/waybar_window.sh ] ;then +if [ -f ~/.config/ml4w/settings/waybar_window.sh ]; then replace_value=$(cat ~/.config/ml4w/settings/waybar_window.sh) search_str="window" - if [[ $replace_value == "True" ]] ;then + if [[ $replace_value == "True" ]]; then replace_str="\"hyprland\/window\"," else replace_str="\/\/\"hyprland\/window\"," @@ -167,10 +167,10 @@ if [ -f ~/.config/ml4w/settings/waybar_window.sh ] ;then fi # Replace waybar_appmenu -if [ -f ~/.config/ml4w/settings/waybar_appmenu.sh ] ;then +if [ -f ~/.config/ml4w/settings/waybar_appmenu.sh ]; then replace_value=$(cat ~/.config/ml4w/settings/waybar_appmenu.sh) search_str="appmenu" - if [[ $replace_value == "True" ]] ;then + if [[ $replace_value == "True" ]]; then replace_str="\"custom\/appmenu\"," else replace_str="\/\/\"custom\/appmenu\"," @@ -184,10 +184,10 @@ if [ -f ~/.config/ml4w/settings/waybar_appmenu.sh ] ;then fi # Replace waybar_appmenuicon -if [ -f ~/.config/ml4w/settings/waybar_appmenu.sh ] ;then +if [ -f ~/.config/ml4w/settings/waybar_appmenu.sh ]; then replace_value=$(cat ~/.config/ml4w/settings/waybar_appmenu.sh) search_str="appmenuicon" - if [[ $replace_value == "True" ]] ;then + if [[ $replace_value == "True" ]]; then replace_str="\"custom\/appmenuicon\"," else replace_str="\/\/\"custom\/appmenuicon\"," @@ -197,7 +197,7 @@ if [ -f ~/.config/ml4w/settings/waybar_appmenu.sh ] ;then fi # Replace hypridle_hyprlock_timeout -if [ -f ~/.config/ml4w/settings/hypridle_hyprlock_timeout.sh ] ;then +if [ -f ~/.config/ml4w/settings/hypridle_hyprlock_timeout.sh ]; then replace_value=$(cat ~/.config/ml4w/settings/hypridle_hyprlock_timeout.sh) search_str="timeout" replace_str="\ \ \ \ timeout = $replace_value" @@ -206,7 +206,7 @@ if [ -f ~/.config/ml4w/settings/hypridle_hyprlock_timeout.sh ] ;then fi # Replace hypridle_dpms_timeout -if [ -f ~/.config/ml4w/settings/hypridle_dpms_timeout.sh ] ;then +if [ -f ~/.config/ml4w/settings/hypridle_dpms_timeout.sh ]; then replace_value=$(cat ~/.config/ml4w/settings/hypridle_dpms_timeout.sh) search_str="timeout" replace_str="\ \ \ \ timeout = $replace_value" @@ -215,7 +215,7 @@ if [ -f ~/.config/ml4w/settings/hypridle_dpms_timeout.sh ] ;then fi # Replace hypridle_suspend_timeout -if [ -f ~/.config/ml4w/settings/hypridle_suspend_timeout.sh ] ;then +if [ -f ~/.config/ml4w/settings/hypridle_suspend_timeout.sh ]; then replace_value=$(cat ~/.config/ml4w/settings/hypridle_suspend_timeout.sh) search_str="timeout" replace_str="\ \ \ \ timeout = $replace_value" diff --git a/lib/install/dotfiles/symlinks.sh b/lib/install/dotfiles/symlinks.sh index fb589160..cf791b22 100644 --- a/lib/install/dotfiles/symlinks.sh +++ b/lib/install/dotfiles/symlinks.sh @@ -4,44 +4,44 @@ echo ":: Creating symlinks" # Check home -files=$(ls -a ~/$dot_folder) +files=$(ls -a ~/"$dot_folder") for f in $files; do if [ ! "$f" == "." ] && [ ! "$f" == ".." ] && [ ! "$f" == ".config" ]; then - if [ -f ~/$dot_folder/$f ] ;then + if [ -f ~/"$dot_folder"/"$f" ]; then echo ":: Checking for file ~/$f" - if [ -L ~/$f ] ;then - rm ~/$f + if [ -L ~/"$f" ]; then + rm ~/"$f" fi - if [ -f ~/$f ] ;then - rm ~/$f + if [ -f ~/"$f" ]; then + rm ~/"$f" fi fi fi done # Check .config -files=$(ls -a ~/$dot_folder/.config) +files=$(ls -a ~/"$dot_folder"/.config) for f in $files; do if [ ! "$f" == "." ] && [ ! "$f" == ".." ]; then - if [ -d ~/$dot_folder/.config/$f ] ;then + if [ -d ~/"$dot_folder"/.config/"$f" ]; then echo ":: Checking for directory ~/.config/$f" - if [ -L ~/.config/$f ] ;then - rm ~/.config/$f + if [ -L ~/.config/"$f" ]; then + rm ~/.config/"$f" fi - if [ -f ~/.config/$f ] ;then - rm ~/.config/$f + if [ -f ~/.config/"$f" ]; then + rm ~/.config/"$f" fi - if [ -d ~/.config/$f ] ;then - rm -rf ~/.config/$f + if [ -d ~/.config/"$f" ]; then + rm -rf ~/.config/"$f" fi fi - if [ -f ~/$dot_folder/.config/$f ] ;then + if [ -f ~/"$dot_folder"/.config/"$f" ]; then echo ":: Checking for file ~/.config/$f" - if [ -L ~/.config/$f ] ;then - rm ~/.config/$f + if [ -L ~/.config/"$f" ]; then + rm ~/.config/"$f" fi - if [ -f ~/.config/$f ] ;then - rm ~/.config/$f + if [ -f ~/.config/"$f" ]; then + rm ~/.config/"$f" fi fi fi diff --git a/lib/install/dotfiles/vm.sh b/lib/install/dotfiles/vm.sh index e6ff59dd..aacf5537 100755 --- a/lib/install/dotfiles/vm.sh +++ b/lib/install/dotfiles/vm.sh @@ -3,42 +3,41 @@ # ------------------------------------------------------ _install_vm() { - if grep -Fxq "kvm.conf" $ml4w_directory/$version/.config/hypr/conf/environment.conf - then + if grep -Fxq "kvm.conf" "$ml4w_directory"/"$version"/.config/hypr/conf/environment.conf; then echo ":: KVM Environment already set." else - if gum confirm "Do you want to install the KVM environment variables?" ;then - echo "source = ~/.config/hypr/conf/environments/kvm.conf" > $ml4w_directory/$version/.config/hypr/conf/environment.conf + if gum confirm "Do you want to install the KVM environment variables?"; then + echo "source = ~/.config/hypr/conf/environments/kvm.conf" >"$ml4w_directory"/"$version"/.config/hypr/conf/environment.conf echo "Environment set to KVM." fi fi if [[ $(_isInstalledPacman "qemu-guest-agent") == 0 ]]; then echo ":: Qemu Guest Agent already installed" else - if gum confirm "Do you want to install the QEMU guest agent?" ;then - _installPackagesPacman "qemu-guest-agent"; + if gum confirm "Do you want to install the QEMU guest agent?"; then + _installPackagesPacman "qemu-guest-agent" fi fi } -if [[ $(_check_update) == "false" ]] ;then - if [ $(_isKVM) == "0" ] ;then +if [[ $(_check_update) == "false" ]]; then + if [ $(_isKVM) == "0" ]; then echo -e "${GREEN}" figlet -f smslant "KVM VM" echo -e "${NONE}" - if [ -z $automation_vm ] ;then + if [ -z "$automation_vm" ]; then echo "The script has detected that you run the installation in a KVM virtual machine." echo _install_vm else - if [[ "$automation_vm" = false ]] ;then + if [[ "$automation_vm" = false ]]; then echo ":: AUTOMATION: VM Support skipped" echo - elif [[ "$automation_vm" = true ]] ;then + elif [[ "$automation_vm" = true ]]; then _install_vm else echo ":: AUTOMATION ERROR: VM Support" - fi + fi fi fi fi diff --git a/lib/install/dotfiles/wallpaper.sh b/lib/install/dotfiles/wallpaper.sh index 3f2d299e..b4bdd841 100755 --- a/lib/install/dotfiles/wallpaper.sh +++ b/lib/install/dotfiles/wallpaper.sh @@ -10,17 +10,17 @@ else echo -e "${NONE}" mkdir ~/wallpaper - cp $wallpaper_directory/* ~/wallpaper/ + cp "$wallpaper_directory"/* ~/wallpaper/ echo ":: Default wallpapers installed successfully." echo echo "You can download and install additional wallpapers from https://github.com/mylinuxforwork/wallpaper/" echo "" - if gum confirm "Do you want to download the repository?" ;then - if [ -d ~/Downloads/wallpaper ] ;then + if gum confirm "Do you want to download the repository?"; then + if [ -d ~/Downloads/wallpaper ]; then rm -rf ~/Downloads/wallpaper fi git clone --depth 1 https://github.com/mylinuxforwork/wallpaper.git ~/Downloads/wallpaper - rsync -a -I --exclude-from=$install_directory/includes/excludes.txt ~/Downloads/wallpaper/. ~/wallpaper/ + rsync -a -I --exclude-from="$install_directory"/includes/excludes.txt ~/Downloads/wallpaper/. ~/wallpaper/ echo "Wallpapers from the repository installed successfully." elif [ $? -eq 130 ]; then exit 130 @@ -39,13 +39,13 @@ cache_file="$HOME/.config/ml4w/cache/current_wallpaper" rasi_file="$HOME/.config/ml4w/cache/current_wallpaper.rasi" # Create cache file if not exists -if [ ! -f $cache_file ] ;then - touch $cache_file - echo "$HOME/wallpaper/default.jpg" > "$cache_file" +if [ ! -f "$cache_file" ]; then + touch "$cache_file" + echo "$HOME/wallpaper/default.jpg" >"$cache_file" fi # Create rasi file if not exists -if [ ! -f $rasi_file ] ;then - touch $rasi_file - echo "* { current-image: url(\"$HOME/wallpaper/default.jpg\", height); }" > "$rasi_file" +if [ ! -f "$rasi_file" ]; then + touch "$rasi_file" + echo "* { current-image: url(\"$HOME/wallpaper/default.jpg\", height); }" >"$rasi_file" fi diff --git a/lib/install/dotfiles/zshrc.sh b/lib/install/dotfiles/zshrc.sh index 2ecab0d6..9e2655fe 100755 --- a/lib/install/dotfiles/zshrc.sh +++ b/lib/install/dotfiles/zshrc.sh @@ -3,21 +3,21 @@ # ------------------------------------------------------ _zshrc_confirm() { - if gum confirm "Do you want to replace your existing .zshrc?" ;then + if gum confirm "Do you want to replace your existing .zshrc?"; then rm ~/.zshrc echo ":: .zshrc will be installed" elif [ $? -eq 130 ]; then - exit 130 + exit 130 else echo ":: Installation of the .zshrc file skipped." fi } _zsh_automation() { - if [[ "$automation_zshrc" = true ]] ;then + if [[ "$automation_zshrc" = true ]]; then echo ":: AUTOMATION: .zshrc will be installed." - elif [[ "$automation_zshrc" = false ]] ;then - rm $ml4w_directory/$version/.zshrc + elif [[ "$automation_zshrc" = false ]]; then + rm "$ml4w_directory"/"$version"/.zshrc echo ":: AUTOMATION: Installation of the .zshrc file skipped." else echo ":: AUTOMATION ERROR: zshrc" @@ -25,15 +25,15 @@ _zsh_automation() { fi } -if [ -f ~/.zshrc ] ;then - if ! test -L ~/.zshrc ;then +if [ -f ~/.zshrc ]; then + if ! test -L ~/.zshrc; then echo -e "${GREEN}" figlet -f smslant ".zshrc" echo -e "${NONE}" echo ":: The script has detected an existing .zshrc file." echo ":: You can replace it with the latest version of ML4W Dotfiles $version (Recommended)." echo - if [ -z $automation_zshrc ] ;then + if [ -z "$automation_zshrc" ]; then _zshrc_confirm else _zsh_automation diff --git a/lib/install/header.sh b/lib/install/header.sh index 3365992f..31f5ded8 100644 --- a/lib/install/header.sh +++ b/lib/install/header.sh @@ -17,10 +17,10 @@ echo "Version: $version" echo "by Stephan Raabe" echo # echo ":: You're running the script in $(pwd)" -if [[ $(_check_update) == "true" ]] ;then +if [[ $(_check_update) == "true" ]]; then echo ":: An existing ML4W Dotfiles installation has been detected." echo ":: This script will guide you through the update process of the ML4W Dotfiles." else echo ":: This script will guide you through the installation process of the ML4W dotfiles." fi -echo \ No newline at end of file +echo diff --git a/lib/install/includes/colors.sh b/lib/install/includes/colors.sh index 08150db5..e40d40c5 100644 --- a/lib/install/includes/colors.sh +++ b/lib/install/includes/colors.sh @@ -1,6 +1,6 @@ #!/bin/bash -RED='\033[0;31m' #'0;31' is Red -GREEN='\033[0;32m' #'0;32' is Green -YELLOW='\033[1;32m' #'1;32' is Yellow +RED='\033[0;31m' #'0;31' is Red +GREEN='\033[0;32m' #'0;32' is Green +YELLOW='\033[1;32m' #'1;32' is Yellow BLUE='\033[0;34m' #'0;34' is Blue NONE='\033[0m' # NO COLOR diff --git a/lib/install/includes/library.sh b/lib/install/includes/library.sh index c6616cf9..d2f5a605 100755 --- a/lib/install/includes/library.sh +++ b/lib/install/includes/library.sh @@ -1,58 +1,58 @@ #!/bin/bash -# _ _ _ -# | | (_) |__ _ __ __ _ _ __ _ _ -# | | | | '_ \| '__/ _` | '__| | | | -# | |___| | |_) | | | (_| | | | |_| | -# |_____|_|_.__/|_| \__,_|_| \__, | -# |___/ -# -# by Stephan Raabe (2023) -# ----------------------------------------------------- +# _ _ _ +# | | (_) |__ _ __ __ _ _ __ _ _ +# | | | | '_ \| '__/ _` | '__| | | | +# | |___| | |_) | | | (_| | | | |_| | +# |_____|_|_.__/|_| \__,_|_| \__, | +# |___/ +# +# by Stephan Raabe (2023) +# ----------------------------------------------------- # ------------------------------------------------------ # Function: Is package installed # ------------------------------------------------------ _isInstalledPacman() { - package="$1"; - check="$(sudo pacman -Qs --color always "${package}" | grep "local" | grep "${package} ")"; - if [ -n "${check}" ] ; then - echo 0; #'0' means 'true' in Bash - return; #true - fi; - echo 1; #'1' means 'false' in Bash - return; #false + package="$1" + check="$(sudo pacman -Qs --color always "${package}" | grep "local" | grep "${package} ")" + if [ -n "${check}" ]; then + echo 0 #'0' means 'true' in Bash + return #true + fi + echo 1 #'1' means 'false' in Bash + return #false } _isInstalledAUR() { - package="$1"; - check="$($aur_helper -Qs --color always "${package}" | grep "local" | grep "\." | grep "${package} ")"; - if [ -n "${check}" ] ; then - echo 0; #'0' means 'true' in Bash - return; #true - fi; - echo 1; #'1' means 'false' in Bash - return; #false + package="$1" + check="$($aur_helper -Qs --color always "${package}" | grep "local" | grep "\." | grep "${package} ")" + if [ -n "${check}" ]; then + echo 0 #'0' means 'true' in Bash + return #true + fi + echo 1 #'1' means 'false' in Bash + return #false } _isInstalledYay() { - _isInstalledAUR $1 + _isInstalledAUR "$1" } _isInstalledFlatpak() { - package="$1"; - check="$(flatpak list --columns="application" | grep "${package} ")"; - if [ -n "${check}" ] ; then - echo 0; #'0' means 'true' in Bash - return; #true - fi; - echo 1; #'1' means 'false' in Bash - return; #false + package="$1" + check="$(flatpak list --columns="application" | grep "${package} ")" + if [ -n "${check}" ]; then + echo 0 #'0' means 'true' in Bash + return #true + fi + echo 1 #'1' means 'false' in Bash + return #false } _isFolderEmpty() { folder="$1" - if [ -d $folder ] ;then - if [ -z "$(ls -A $folder)" ]; then + if [ -d "$folder" ]; then + if [ -z "$(ls -A "$folder")" ]; then echo 0 else echo 1 @@ -66,119 +66,119 @@ _isFolderEmpty() { # Function Install all package if not installed # ------------------------------------------------------ _installPackagesPacman() { - toInstall=(); + toInstall=() for pkg; do if [[ $(_isInstalledPacman "${pkg}") == 0 ]]; then - echo ":: ${pkg} is already installed."; - continue; - fi; - toInstall+=("${pkg}"); - done; + echo ":: ${pkg} is already installed." + continue + fi + toInstall+=("${pkg}") + done - if [[ "${toInstall[@]}" == "" ]] ; then + if [[ "${toInstall[@]}" == "" ]]; then # echo "All pacman packages are already installed."; - return; - fi; + return + fi # printf "Package not installed:\n%s\n" "${toInstall[@]}"; - sudo pacman --noconfirm -S "${toInstall[@]}"; + sudo pacman --noconfirm -S "${toInstall[@]}" } _forcePackagesPacman() { - toInstall=(); + toInstall=() for pkg; do - toInstall+=("${pkg}"); - done; + toInstall+=("${pkg}") + done - if [[ "${toInstall[@]}" == "" ]] ; then + if [[ "${toInstall[@]}" == "" ]]; then # echo "All pacman packages are already installed."; - return; - fi; + return + fi # printf "Package not installed:\n%s\n" "${toInstall[@]}"; - sudo pacman --noconfirm -S "${toInstall[@]}" --ask 4; + sudo pacman --noconfirm -S "${toInstall[@]}" --ask 4 } _installPackagesYay() { - toInstall=(); + toInstall=() for pkg; do if [[ $(_isInstalledYay "${pkg}") == 0 ]]; then - echo ":: ${pkg} is already installed."; - continue; - fi; - toInstall+=("${pkg}"); - done; + echo ":: ${pkg} is already installed." + continue + fi + toInstall+=("${pkg}") + done - if [[ "${toInstall[@]}" == "" ]] ; then + if [[ "${toInstall[@]}" == "" ]]; then # echo "All packages are already installed."; - return; - fi; + return + fi # printf "AUR packags not installed:\n%s\n" "${toInstall[@]}"; - $aur_helper --noconfirm -S "${toInstall[@]}"; + $aur_helper --noconfirm -S "${toInstall[@]}" } _installPackagesAUR() { - toInstall=(); + toInstall=() for pkg; do if [[ $(_isInstalledYay "${pkg}") == 0 ]]; then - echo ":: ${pkg} is already installed."; - continue; - fi; - toInstall+=("${pkg}"); - done; + echo ":: ${pkg} is already installed." + continue + fi + toInstall+=("${pkg}") + done - if [[ "${toInstall[@]}" == "" ]] ; then + if [[ "${toInstall[@]}" == "" ]]; then # echo "All packages are already installed."; - return; - fi; + return + fi # printf "AUR packags not installed:\n%s\n" "${toInstall[@]}"; - $aur_helper --noconfirm -S "${toInstall[@]}"; + $aur_helper --noconfirm -S "${toInstall[@]}" } _forcePackagesAUR() { - toInstall=(); + toInstall=() for pkg; do - toInstall+=("${pkg}"); - done; + toInstall+=("${pkg}") + done - if [[ "${toInstall[@]}" == "" ]] ; then + if [[ "${toInstall[@]}" == "" ]]; then # echo "All packages are already installed."; - return; - fi; + return + fi # printf "AUR packags not installed:\n%s\n" "${toInstall[@]}"; - $aur_helper --noconfirm -S "${toInstall[@]}" --ask 4; + $aur_helper --noconfirm -S "${toInstall[@]}" --ask 4 } _forcePackagesYay() { - toInstall=(); + toInstall=() for pkg; do - toInstall+=("${pkg}"); - done; + toInstall+=("${pkg}") + done - if [[ "${toInstall[@]}" == "" ]] ; then + if [[ "${toInstall[@]}" == "" ]]; then # echo "All packages are already installed."; - return; - fi; + return + fi # printf "AUR packags not installed:\n%s\n" "${toInstall[@]}"; - $aur_helper --noconfirm -S "${toInstall[@]}" --ask 4; + $aur_helper --noconfirm -S "${toInstall[@]}" --ask 4 } _installPackagesFlatpak() { - toInstall=(); + toInstall=() for pkg; do - sudo flatpak install -y flathub "${pkg[@]}"; + sudo flatpak install -y flathub "${pkg[@]}" if [[ $(_isInstalledFlatpak "${pkg}") == 0 ]]; then - echo ":: ${pkg} is installed."; - toInstall+=("${pkg}"); - continue; - fi; - done; + echo ":: ${pkg} is installed." + toInstall+=("${pkg}") + continue + fi + done - sudo flatpak install -y flathub "${toInstall[@]}"; + sudo flatpak install -y flathub "${toInstall[@]}" } # ------------------------------------------------------ @@ -188,39 +188,39 @@ _installPackagesFlatpak() { _move_folder() { source=$1 target=$2 - if [ ! -d $target ] ;then - if [ -d $source ] ;then - mv $source $target + if [ ! -d "$target" ]; then + if [ -d "$source" ]; then + mv "$source" "$target" echo ":: $source moved to $target" fi - fi + fi } _del_folder() { source=$1 - if [ -d $source ] ;then - rm -rf $source + if [ -d "$source" ]; then + rm -rf "$source" echo ":: $source deleted" - fi + fi } _move_file() { source=$1 target=$2 - if [ ! -f $target ] ;then - if [ -f $source ] ;then - mv $source $target + if [ ! -f "$target" ]; then + if [ -f "$source" ]; then + mv "$source" "$target" echo ":: $source moved to $target" fi - fi + fi } _del_file() { source=$1 - if [ -f $source ] ;then - rm $source + if [ -f "$source" ]; then + rm "$source" echo ":: $source deleted" - fi + fi } # ------------------------------------------------------ @@ -228,40 +228,40 @@ _del_file() { # ------------------------------------------------------ _del_symlink() { source=$1 - if [ -L $source ]; then - rm $source + if [ -L "$source" ]; then + rm "$source" echo ":: Symlink $sources deleted" - elif [ -d $source ]; then - rm -rf $source + elif [ -d "$source" ]; then + rm -rf "$source" echo ":: Folder for symlink $sources deleted" - elif [ -f $source ]; then - rm -rf $source + elif [ -f "$source" ]; then + rm -rf "$source" echo ":: File for symlink $sources deleted" fi } _installSymLink() { name="$1" - symlink="$2"; - linksource="$3"; - linktarget="$4"; - + symlink="$2" + linksource="$3" + linktarget="$4" + if [ -L "${symlink}" ]; then - rm ${symlink} - ln -s ${linksource} ${linktarget} + rm "${symlink}" + ln -s "${linksource}" "${linktarget}" echo ":: Symlink ${linksource} -> ${linktarget} created." else - if [ -d ${symlink} ]; then - rm -rf ${symlink}/ - ln -s ${linksource} ${linktarget} + if [ -d "${symlink}" ]; then + rm -rf "${symlink}"/ + ln -s "${linksource}" "${linktarget}" echo ":: Symlink for directory ${linksource} -> ${linktarget} created." else - if [ -f ${symlink} ]; then - rm ${symlink} - ln -s ${linksource} ${linktarget} + if [ -f "${symlink}" ]; then + rm "${symlink}" + ln -s "${linksource}" "${linktarget}" echo ":: Symlink to file ${linksource} -> ${linktarget} created." else - ln -s ${linksource} ${linktarget} + ln -s "${linksource}" "${linktarget}" echo ":: New symlink ${linksource} -> ${linktarget} created." fi fi @@ -273,7 +273,7 @@ _installSymLink() { # ------------------------------------------------------ _isKVM() { iskvm=$(sudo dmesg | grep "Hypervisor detected") - if [[ "$iskvm" =~ "KVM" ]] ;then + if [[ "$iskvm" =~ "KVM" ]]; then echo 0 else echo 1 @@ -295,51 +295,49 @@ _replaceInFile() { start_found=0 end_found=0 - if [ -f $file_path ] ;then + if [ -f "$file_path" ]; then # Detect Start String - while read -r line - do + while read -r line; do ((start_line_counter++)) if [[ $line = *$start_string* ]]; then # echo "Start found in $start_line_counter" start_found=$start_line_counter break - fi - done < "$file_path" + fi + done <"$file_path" # Detect End String - while read -r line - do + while read -r line; do ((end_line_counter++)) if [[ $line = *$end_string* ]]; then # echo "End found in $end_line_counter" end_found=$end_line_counter break - fi - done < "$file_path" + fi + done <"$file_path" # Check that deliminters exists - if [[ "$start_found" == "0" ]] ;then + if [[ "$start_found" == "0" ]]; then echo "ERROR: Start deliminter not found." sleep 2 fi - if [[ "$end_found" == "0" ]] ;then + if [[ "$end_found" == "0" ]]; then echo "ERROR: End deliminter not found." sleep 2 fi # Replace text between delimiters - if [[ ! "$start_found" == "0" ]] && [[ ! "$end_found" == "0" ]] && [ "$start_found" -le "$end_found" ] ;then + if [[ ! "$start_found" == "0" ]] && [[ ! "$end_found" == "0" ]] && [ "$start_found" -le "$end_found" ]; then # Remove the old line ((start_found++)) - if [ ! "$start_found" == "$end_found" ] ;then + if [ ! "$start_found" == "$end_found" ]; then ((end_found--)) - sed -i "$start_found,$end_found d" $file_path + sed -i "$start_found,$end_found d" "$file_path" fi # Add the new line - sed -i "$start_found i $new_string" $file_path + sed -i "$start_found i $new_string" "$file_path" else echo "ERROR: Delimiters syntax." sleep 2 @@ -352,12 +350,12 @@ _replaceInFile() { # replaceTextInFile $customtext $targetFile _replaceTextInFile() { - echo $customtext > $targetFile + echo "$customtext" >"$targetFile" } # replaceLineInFile $findText $customtext $targetFile _replaceLineInFile() { - # Set function parameters + # Set function parameters find_string="$1" new_string="$2" file_path=$3 @@ -366,31 +364,30 @@ _replaceLineInFile() { find_line_counter=0 line_found=0 - if [ -f $file_path ] ;then + if [ -f "$file_path" ]; then # Detect Line - while read -r line - do + while read -r line; do ((find_line_counter++)) if [[ $line = *$find_string* ]]; then # echo "Start found in $start_line_counter" line_found=$find_line_counter break - fi - done < "$file_path" + fi + done <"$file_path" + + if [[ ! "$line_found" == "0" ]]; then - if [[ ! "$line_found" == "0" ]] ;then - #Remove the line - sed -i "$line_found d" $file_path + sed -i "$line_found d" "$file_path" # Add the new line - sed -i "$line_found i $new_string" $file_path + sed -i "$line_found i $new_string" "$file_path" else echo "ERROR: Target line not found for $find_string." sleep 2 - fi + fi else echo "ERROR: Target file not found." @@ -400,7 +397,7 @@ _replaceLineInFile() { # replaceLineInFileCheckpoint $findText $customtext $checkpoint $targetFile _replaceLineInFileCheckpoint() { - # Set function parameters + # Set function parameters find_string="$1" new_string="$2" checkpoint="$3" @@ -412,49 +409,47 @@ _replaceLineInFileCheckpoint() { line_found=0 checkpoint_found=0 - if [ -f $file_path ] ;then + if [ -f "$file_path" ]; then # Detect Checkpoint - while read -r line - do + while read -r line; do ((find_checkpoint_counter++)) if [[ $line = *$checkpoint* ]]; then # echo "Checkpoint found in $find_checkpoint_counter" checkpoint_found=$find_checkpoint_counter break - fi - done < "$file_path" + fi + done <"$file_path" - if [[ ! "$checkpoint_found" == "0" ]] ;then + if [[ ! "$checkpoint_found" == "0" ]]; then # Detect Line - while read -r line - do + while read -r line; do ((find_line_counter++)) - if [ "$find_line_counter" -gt "$checkpoint_found" ] ;then + if [ "$find_line_counter" -gt "$checkpoint_found" ]; then if [[ $line = *$find_string* ]]; then # echo "Line found in $find_line_counter" line_found=$find_line_counter break - fi + fi fi - done < "$file_path" + done <"$file_path" + + if [[ ! "$line_found" == "0" ]]; then - if [[ ! "$line_found" == "0" ]] ;then - #Remove the line - sed -i "$line_found d" $file_path + sed -i "$line_found d" "$file_path" # Add the new line - sed -i "$line_found i $new_string" $file_path + sed -i "$line_found i $new_string" "$file_path" else echo "ERROR: Target line not found." sleep 2 fi - else + else echo "ERROR: Checkpoint not found." - fi + fi else echo "ERROR: Target file not found." @@ -467,8 +462,8 @@ _replaceLineInFileCheckpoint() { # ------------------------------------------------------ _checkCommandExists() { - package="$1"; - if ! type $package > /dev/null 2>&1; then + package="$1" + if ! type "$package" >/dev/null 2>&1; then echo "1" else echo "0" @@ -476,8 +471,8 @@ _checkCommandExists() { } _commandExists() { - package="$1"; - if [[ $(_checkCommandExists $package) == "1" ]]; then + package="$1" + if [[ $(_checkCommandExists "$package") == "1" ]]; then echo ":: ERROR: $package doesn't exists. Please install it manually." else echo ":: OK: $package command found." @@ -485,8 +480,8 @@ _commandExists() { } _folderExists() { - folder="$1"; - if [ ! -d $folder ]; then + folder="$1" + if [ ! -d "$folder" ]; then echo ":: ERROR: $folder doesn't exists. $2" return 0 else diff --git a/lib/install/optional.sh b/lib/install/optional.sh index 1877c888..b2b6caf0 100644 --- a/lib/install/optional.sh +++ b/lib/install/optional.sh @@ -7,8 +7,8 @@ echo -e "${NONE}" aur_helper="$(cat ~/.config/ml4w/settings/aur.sh)" echo "This script will help you to install optional packages." echo "You can set the default applications in the ML4W Settings App." -echo -source $packages_directory/optional.sh +echo +source "$packages_directory"/optional.sh toInstall="" selectedInstall="" @@ -26,7 +26,7 @@ _checkPackages() { _checkPackages -if [[ "${toInstall[@]}" == "" ]] ; then +if [[ "${toInstall[@]}" == "" ]]; then echo ":: All optional packages are already installed." else echo @@ -34,10 +34,10 @@ else echo ":: Please select the packages that you want to install and confirm with ENTER." echo ":: (CTRL+C or deselect all to cancel)" echo - optionalSelect=$(gum choose --no-limit --height 20 --cursor-prefix "( ) " --selected-prefix "(x) " --unselected-prefix "( ) " --selected="$selectedInstall" $toInstall) - if [ ! -z "$optionalSelect" ] ;then - $aur_helper -S $optionalSelect - else + optionalSelect=$(gum choose --no-limit --height 20 --cursor-prefix "( ) " --selected-prefix "(x) " --unselected-prefix "( ) " --selected="$selectedInstall" "$toInstall") + if [ ! -z "$optionalSelect" ]; then + $aur_helper -S "$optionalSelect" + else echo ":: No optional packages selected" fi fi diff --git a/lib/install/packages.sh b/lib/install/packages.sh index 7fdd5d3b..6d7c918b 100755 --- a/lib/install/packages.sh +++ b/lib/install/packages.sh @@ -1,41 +1,41 @@ #!/bin/bash -# ----------------------------------------------------- +# ----------------------------------------------------- # Before start -# ----------------------------------------------------- -source $install_directory/packages/before_start.sh +# ----------------------------------------------------- +source "$install_directory"/packages/before_start.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Confirm start -# ----------------------------------------------------- -source $install_directory/packages/confirm_start.sh +# ----------------------------------------------------- +source "$install_directory"/packages/confirm_start.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Load automation variables -# ----------------------------------------------------- -source $install_directory/packages/automation.sh +# ----------------------------------------------------- +source "$install_directory"/packages/automation.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Install AUR Helper -# ----------------------------------------------------- -source $install_directory/packages/aur.sh +# ----------------------------------------------------- +source "$install_directory"/packages/aur.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Remove not required packages -# ----------------------------------------------------- -source $install_directory/packages/remove.sh +# ----------------------------------------------------- +source "$install_directory"/packages/remove.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Install packages -# ----------------------------------------------------- -source $install_directory/packages/packages.sh +# ----------------------------------------------------- +source "$install_directory"/packages/packages.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Install optional packages -# ----------------------------------------------------- -source $install_directory/packages/optional.sh +# ----------------------------------------------------- +source "$install_directory"/packages/optional.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Check executables of important apps -# ----------------------------------------------------- -source $install_directory/packages/diagnosis.sh +# ----------------------------------------------------- +source "$install_directory"/packages/diagnosis.sh diff --git a/lib/install/packages/aur.sh b/lib/install/packages/aur.sh index 0eb162a0..32a0b576 100644 --- a/lib/install/packages/aur.sh +++ b/lib/install/packages/aur.sh @@ -11,9 +11,9 @@ _installYay() { SCRIPT=$(realpath "$0") temp_path=$(dirname "$SCRIPT") git clone https://aur.archlinux.org/yay.git ~/yay - cd ~/yay + cd ~/yay || exit makepkg -si - cd $temp_path + cd "$temp_path" || exit echo ":: yay has been installed successfully." } @@ -22,9 +22,9 @@ _installParu() { SCRIPT=$(realpath "$0") temp_path=$(dirname "$SCRIPT") git clone https://aur.archlinux.org/paru.git ~/paru - cd ~/paru + cd ~/paru || exit makepkg -si - cd $temp_path + cd "$temp_path" || exit echo ":: paru has been installed successfully." } @@ -32,30 +32,30 @@ _selectAURHelper() { echo ":: Please select your preferred AUR Helper" echo aur_helper=$(gum choose "yay" "paru") - if [ -z $aur_helper ] ;then + if [ -z "$aur_helper" ]; then _selectAURHelper fi } _checkAURHelper() { - if [[ $(_checkCommandExists "yay") == "0" ]];then + if [[ $(_checkCommandExists "yay") == "0" ]]; then echo ":: yay is installed" yay_installed="true" fi - if [[ $(_checkCommandExists "paru") == "0" ]];then + if [[ $(_checkCommandExists "paru") == "0" ]]; then echo ":: paru is installed" paru_installed="true" fi - if [[ $yay_installed == "true" ]] && [[ $paru_installed == "false" ]] ;then + if [[ $yay_installed == "true" ]] && [[ $paru_installed == "false" ]]; then echo ":: Using AUR Helper yay" aur_helper="yay" - elif [[ $yay_installed == "false" ]] && [[ $paru_installed == "true" ]] ;then + elif [[ $yay_installed == "false" ]] && [[ $paru_installed == "true" ]]; then echo ":: Using AUR Helper paru" aur_helper="paru" - elif [[ $yay_installed == "false" ]] && [[ $paru_installed == "false" ]] ;then - if [[ $(_check_update) == "false" ]] ;then + elif [[ $yay_installed == "false" ]] && [[ $paru_installed == "false" ]]; then + if [[ $(_check_update) == "false" ]]; then _selectAURHelper - if [[ $aur_helper == "yay" ]] ;then + if [[ $aur_helper == "yay" ]]; then _installYay else _installParu @@ -66,10 +66,9 @@ _checkAURHelper() { fi } -if [[ $(_check_update) == "false" ]] ;then +if [[ $(_check_update) == "false" ]]; then echo -e "${GREEN}" figlet -f smslant "AUR Helper" echo -e "${NONE}" fi _checkAURHelper - diff --git a/lib/install/packages/automation.sh b/lib/install/packages/automation.sh index 0fb72ea2..01d1609b 100644 --- a/lib/install/packages/automation.sh +++ b/lib/install/packages/automation.sh @@ -2,8 +2,8 @@ # Check for automation.sh # ------------------------------------------------------ -if [ -f $ml4w_directory/automation.sh ] ;then +if [ -f "$ml4w_directory"/automation.sh ]; then echo ":: AUTOMATION: automation.sh found" - source $ml4w_directory/automation.sh + source "$ml4w_directory"/automation.sh echo -fi \ No newline at end of file +fi diff --git a/lib/install/packages/before_start.sh b/lib/install/packages/before_start.sh index 8964aac5..c6c1e784 100755 --- a/lib/install/packages/before_start.sh +++ b/lib/install/packages/before_start.sh @@ -2,11 +2,11 @@ # Before Start # ------------------------------------------------------ -if [ -d ~/dotfiles-versions ] ;then - mv ~/dotfiles-versions $ml4w_directory +if [ -d ~/dotfiles-versions ]; then + mv ~/dotfiles-versions "$ml4w_directory" echo ":: PLEASE NOTE: ~/dotfiles-versions folder renamed to $ml4w_directory" fi -if [ -d ~/.ml4w-dotfiles ] ;then - mv ~/.ml4w-dotfiles $ml4w_directory +if [ -d ~/.ml4w-dotfiles ]; then + mv ~/.ml4w-dotfiles "$ml4w_directory" echo ":: PLEASE NOTE: ~/.ml4w-dotfiles folder renamed to $ml4w_directory" fi diff --git a/lib/install/packages/confirm_start.sh b/lib/install/packages/confirm_start.sh index 4a7d1803..0662023a 100644 --- a/lib/install/packages/confirm_start.sh +++ b/lib/install/packages/confirm_start.sh @@ -2,25 +2,25 @@ # Confirm Start # ------------------------------------------------------ -if [[ $(_check_update) == "true" ]] ;then - if gum confirm "DO YOU WANT TO START THE UPDATE NOW?" ;then +if [[ $(_check_update) == "true" ]]; then + if gum confirm "DO YOU WANT TO START THE UPDATE NOW?"; then echo ":: Update started." elif [ $? -eq 130 ]; then echo ":: Update canceled." exit 130 else echo ":: Update canceled." - exit; + exit fi else - if gum confirm "DO YOU WANT TO INSTALL THE REQUIRED PACKAGES FOR ML4W Dotfiles?" ;then + if gum confirm "DO YOU WANT TO INSTALL THE REQUIRED PACKAGES FOR ML4W Dotfiles?"; then echo ":: Installation started." elif [ $? -eq 130 ]; then echo ":: Installation canceled." exit 130 else echo ":: Installation canceled." - exit; + exit fi fi echo diff --git a/lib/install/packages/diagnosis.sh b/lib/install/packages/diagnosis.sh index 421cd28a..1c0269f2 100755 --- a/lib/install/packages/diagnosis.sh +++ b/lib/install/packages/diagnosis.sh @@ -2,7 +2,7 @@ # Diagnosis # ------------------------------------------------------ -_run_diagnosis(){ +_run_diagnosis() { _commandExists "rofi" "rofi-wayland" _commandExists "dunst" "dunst" _commandExists "waybar" "waybar" @@ -18,18 +18,18 @@ _run_diagnosis(){ _commandExists "waypaper" "waypaper" } -if [[ $(_check_update) == "false" ]] ;then +if [[ $(_check_update) == "false" ]]; then echo -e "${GREEN}" figlet -f smslant "Diagnosis" echo -e "${NONE}" - if [ -z $automation_diagnosis ] ;then + if [ -z "$automation_diagnosis" ]; then echo "The system check will test that essential packages and " echo "execution commands are available now on your system." - echo - if gum confirm "Do you want to run a short system check?" ;then + echo + if gum confirm "Do you want to run a short system check?"; then _run_diagnosis echo - if gum confirm "Do you want to proceed?" ;then + if gum confirm "Do you want to proceed?"; then echo elif [ $? -eq 130 ]; then echo ":: Installation canceled." @@ -44,9 +44,9 @@ if [[ $(_check_update) == "false" ]] ;then echo ":: System check skipped" fi else - if [[ "$automation_diagnosis" = true ]] ;then + if [[ "$automation_diagnosis" = true ]]; then _run_diagnosis fi fi echo -fi \ No newline at end of file +fi diff --git a/lib/install/packages/optional.sh b/lib/install/packages/optional.sh index a7c2c53a..4255aad5 100755 --- a/lib/install/packages/optional.sh +++ b/lib/install/packages/optional.sh @@ -2,9 +2,9 @@ echo -e "${GREEN}" figlet -f smslant "Optional" echo -e "${NONE}" -if [ -z $automation_optional ] || [ $automation_optional == "true" ] ;then +if [ -z "$automation_optional" ] || [ "$automation_optional" == "true" ]; then - source $packages_directory/optional.sh + source "$packages_directory"/optional.sh toInstall="" selectedInstall="" @@ -22,7 +22,7 @@ if [ -z $automation_optional ] || [ $automation_optional == "true" ] ;then _checkPackages - if [[ "${toInstall[@]}" == "" ]] ; then + if [[ "${toInstall[@]}" == "" ]]; then echo ":: All optional packages are already installed." else echo @@ -30,14 +30,14 @@ if [ -z $automation_optional ] || [ $automation_optional == "true" ] ;then echo ":: Please select the packages that you want to install and confirm with ENTER." echo ":: (CTRL+C or deselect all to skip this step)" echo - optionalSelect=$(gum choose --no-limit --height 20 --cursor-prefix "( ) " --selected-prefix "(x) " --unselected-prefix "( ) " --selected="$selectedInstall" $toInstall) - if [ ! -z "$optionalSelect" ] ;then - $aur_helper -S $optionalSelect - else + optionalSelect=$(gum choose --no-limit --height 20 --cursor-prefix "( ) " --selected-prefix "(x) " --unselected-prefix "( ) " --selected="$selectedInstall" "$toInstall") + if [ ! -z "$optionalSelect" ]; then + $aur_helper -S "$optionalSelect" + else echo ":: No optional packages selected" fi fi else echo ":: AUTOMATION: Optional Packages skipped" fi -echo +echo diff --git a/lib/install/packages/packages.sh b/lib/install/packages/packages.sh index 5b69dbe9..b1353672 100644 --- a/lib/install/packages/packages.sh +++ b/lib/install/packages/packages.sh @@ -2,20 +2,20 @@ # Install packages # ------------------------------------------------------ -if [[ $install_mode == "filesystem" ]] ;then +if [[ $install_mode == "filesystem" ]]; then echo -e "${GREEN}" figlet -f smslant "Packages" echo -e "${NONE}" # General packages - source $packages_directory/general.sh - _installPackagesPacman "${packagesPacman[@]}"; - _installPackagesAUR "${packagesAUR[@]}"; + source "$packages_directory"/general.sh + _installPackagesPacman "${packagesPacman[@]}" + _installPackagesAUR "${packagesAUR[@]}" echo -e "${GREEN}" figlet -f smslant "Hyprland" echo -e "${NONE}" - source $packages_directory/hyprland.sh - _installPackagesPacman "${packagesPacman[@]}"; - _installPackagesAUR "${packagesAUR[@]}"; -fi \ No newline at end of file + source "$packages_directory"/hyprland.sh + _installPackagesPacman "${packagesPacman[@]}" + _installPackagesAUR "${packagesAUR[@]}" +fi diff --git a/lib/install/packages/remove.sh b/lib/install/packages/remove.sh index 107542a4..d4314c67 100755 --- a/lib/install/packages/remove.sh +++ b/lib/install/packages/remove.sh @@ -40,19 +40,19 @@ fi # Remove hypridle-bin if [[ $(_isInstalledAUR "hypridle-git") == 0 ]]; then $aur_helper --noconfirm -Rns hypridle-git - if [ -f /usr/lib/debug/usr/bin/hypridle.debug ] ;then + if [ -f /usr/lib/debug/usr/bin/hypridle.debug ]; then sudo rm /usr/lib/debug/usr/bin/hypridle.debug echo ":: /usr/lib/debug/usr/bin/hypridle.debug removed" fi echo ":: hypridle-git uninstalled." echo ":: hypridle can now be installed." - echo + echo fi # Remove hyprlock-bin if [[ $(_isInstalledAUR "hyprlock-git") == 0 ]]; then $aur_helper --noconfirm -Rns hyprlock-git - if [ -f /usr/lib/debug/usr/bin/hyprlock.debug ] ;then + if [ -f /usr/lib/debug/usr/bin/hyprlock.debug ]; then sudo rm /usr/lib/debug/usr/bin/hyprlock.debug echo ":: /usr/lib/debug/usr/bin/hyprlock.debug removed" fi diff --git a/lib/install/uninstall.sh b/lib/install/uninstall.sh index a55b3484..ddd16d7c 100755 --- a/lib/install/uninstall.sh +++ b/lib/install/uninstall.sh @@ -1,4 +1,4 @@ #!/bin/bash clear sleep 1 -com.ml4w.dotfilesuninstaller \ No newline at end of file +com.ml4w.dotfilesuninstaller diff --git a/lib/install/update.sh b/lib/install/update.sh index d7da7a6b..8c844c15 100755 --- a/lib/install/update.sh +++ b/lib/install/update.sh @@ -7,10 +7,10 @@ echo echo ":: Please choose your version:" echo dot_ver=$(gum choose "ml4w-hyprland" "ml4w-hyprland-git" "Cancel") -if [ ! -z $dot_ver ] ;then - if [[ ! $dot_ver == "Cancel" ]] ;then +if [ ! -z "$dot_ver" ]; then + if [[ ! $dot_ver == "Cancel" ]]; then aur_helper="$(cat ~/.config/ml4w/settings/aur.sh)" - $aur_helper --noconfirm -S "$dot_ver"; + $aur_helper --noconfirm -S "$dot_ver" ml4w-hyprland-setup fi else diff --git a/share/dotfiles/.config/hypr/conf/restorevariations.sh b/share/dotfiles/.config/hypr/conf/restorevariations.sh index 10361609..3ad987b9 100755 --- a/share/dotfiles/.config/hypr/conf/restorevariations.sh +++ b/share/dotfiles/.config/hypr/conf/restorevariations.sh @@ -19,33 +19,33 @@ echo "You can restore to the default Hyprland Variations." echo "PLEASE NOTE: You can reactivate to a customized variation or selection in the settings script." echo "Your customized variation will not be overwritten or deleted." -if gum confirm "Do you want to restore all variations to the default values?" ;then - echo +if gum confirm "Do you want to restore all variations to the default values?"; then + echo - echo "source = ~/.config/hypr/conf/keybindings/default.conf" > ~/.config/hypr/conf/keybinding.conf + echo "source = ~/.config/hypr/conf/keybindings/default.conf" >~/.config/hypr/conf/keybinding.conf echo "Hyprland keybinding.conf restored!" - echo "source = ~/.config/hypr/conf/environments/default.conf" > ~/.config/hypr/conf/environment.conf + echo "source = ~/.config/hypr/conf/environments/default.conf" >~/.config/hypr/conf/environment.conf echo "Hyprland environment.conf restored!" - echo "source = ~.config/hypr/conf/windowrules/default.conf" > ~/.config/hypr/conf/windowrule.conf + echo "source = ~.config/hypr/conf/windowrules/default.conf" >~/.config/hypr/conf/windowrule.conf echo "Hyprland windowrule.conf restored!" - echo "source = ~/.config/hypr/conf/animations/default.conf" > ~/.config/hypr/conf/animation.conf + echo "source = ~/.config/hypr/conf/animations/default.conf" >~/.config/hypr/conf/animation.conf echo "Hyprland animation.conf restored!" - echo "source = ~/.config/hypr/conf/decorations/default.conf" > ~/.config/hypr/conf/decoration.conf + echo "source = ~/.config/hypr/conf/decorations/default.conf" >~/.config/hypr/conf/decoration.conf echo "Hyprland decoration.conf restored!" - echo "source = ~/.config/hypr/conf/windows/default.conf" > ~/.config/hypr/conf/window.conf + echo "source = ~/.config/hypr/conf/windows/default.conf" >~/.config/hypr/conf/window.conf echo "Hyprland window.conf restored!" - echo "source = ~/.config/hypr/conf/monitors/default.conf" > ~/.config/hypr/conf/monitor.conf + echo "source = ~/.config/hypr/conf/monitors/default.conf" >~/.config/hypr/conf/monitor.conf echo "Hyprland monitor.conf restored!" - echo + echo echo ":: Restore done!" else echo ":: Restore canceled!" exit -fi \ No newline at end of file +fi diff --git a/share/dotfiles/.config/hypr/scripts/cleanup.sh b/share/dotfiles/.config/hypr/scripts/cleanup.sh index af4196d8..8aaf0d68 100755 --- a/share/dotfiles/.config/hypr/scripts/cleanup.sh +++ b/share/dotfiles/.config/hypr/scripts/cleanup.sh @@ -1,14 +1,14 @@ #!/bin/bash -# ____ _ -# / ___| | ___ __ _ _ __ _ _ _ __ -# | | | |/ _ \/ _` | '_ \| | | | '_ \ +# ____ _ +# / ___| | ___ __ _ _ __ _ _ _ __ +# | | | |/ _ \/ _` | '_ \| | | | '_ \ # | |___| | __/ (_| | | | | |_| | |_) | -# \____|_|\___|\__,_|_| |_|\__,_| .__/ -# |_| -# +# \____|_|\___|\__,_|_| |_|\__,_| .__/ +# |_| +# # Remove gamemode flag -if [ -f ~/.cache/gamemode ] ;then +if [ -f ~/.cache/gamemode ]; then rm ~/.cache/gamemode echo ":: ~/.cache/gamemode removed" -fi \ No newline at end of file +fi diff --git a/share/dotfiles/.config/hypr/scripts/diagnosis.sh b/share/dotfiles/.config/hypr/scripts/diagnosis.sh index 752e4c76..74d64007 100755 --- a/share/dotfiles/.config/hypr/scripts/diagnosis.sh +++ b/share/dotfiles/.config/hypr/scripts/diagnosis.sh @@ -1,11 +1,11 @@ #!/bin/bash -# ____ _ _ -# | _ \(_) __ _ __ _ _ __ ___ ___(_)___ +# ____ _ _ +# | _ \(_) __ _ __ _ _ __ ___ ___(_)___ # | | | | |/ _` |/ _` | '_ \ / _ \/ __| / __| # | |_| | | (_| | (_| | | | | (_) \__ \ \__ \ # |____/|_|\__,_|\__, |_| |_|\___/|___/_|___/ -# |___/ -# +# |___/ +# clear sleep 0.5 @@ -16,8 +16,8 @@ echo "execution commands are available on your system." echo _commandExists() { - package="$1"; - if ! type $package > /dev/null 2>&1; then + package="$1" + if ! type "$package" >/dev/null 2>&1; then echo ":: ERROR: $package doesn't exists. Please install it with yay -S $2" else echo ":: OK: $package found." @@ -25,8 +25,8 @@ _commandExists() { } _folderExists() { - folder="$1"; - if [ ! -d $folder ]; then + folder="$1" + if [ ! -d "$folder" ]; then echo ":: ERROR: $folder doesn't exists." else echo ":: OK: $folder found." @@ -50,4 +50,4 @@ _commandExists "waypaper" "waypaper" echo echo "Press return to exit" -read \ No newline at end of file +read diff --git a/share/dotfiles/.config/hypr/scripts/disabledm.sh b/share/dotfiles/.config/hypr/scripts/disabledm.sh index ee5e612a..860e4cbd 100755 --- a/share/dotfiles/.config/hypr/scripts/disabledm.sh +++ b/share/dotfiles/.config/hypr/scripts/disabledm.sh @@ -8,17 +8,19 @@ echo "-> Do you really want to deactivate the display manager?" while true; do read -p "Do you want to enable the sddm display manager and setup theme? (Yy/Nn): " yn case $yn in - [Yy]* ) - if [ -f /etc/systemd/system/display-manager.service ]; then - sudo rm /etc/systemd/system/display-manager.service - echo "Current display manager removed." - else - echo "No active display manager found." - fi - break;; - [Nn]* ) - exit - break;; - * ) echo "Please answer yes or no.";; + [Yy]*) + if [ -f /etc/systemd/system/display-manager.service ]; then + sudo rm /etc/systemd/system/display-manager.service + echo "Current display manager removed." + else + echo "No active display manager found." + fi + break + ;; + [Nn]*) + exit + break + ;; + *) echo "Please answer yes or no." ;; esac -done \ No newline at end of file +done diff --git a/share/dotfiles/.config/hypr/scripts/gamemode.sh b/share/dotfiles/.config/hypr/scripts/gamemode.sh index 09708fa4..10cd4f79 100755 --- a/share/dotfiles/.config/hypr/scripts/gamemode.sh +++ b/share/dotfiles/.config/hypr/scripts/gamemode.sh @@ -1,13 +1,13 @@ #!/bin/bash -# ____ _ -# / ___| __ _ _ __ ___ ___ _ __ ___ ___ __| | ___ +# ____ _ +# / ___| __ _ _ __ ___ ___ _ __ ___ ___ __| | ___ # | | _ / _` | '_ ` _ \ / _ \ '_ ` _ \ / _ \ / _` |/ _ \ # | |_| | (_| | | | | | | __/ | | | | | (_) | (_| | __/ # \____|\__,_|_| |_| |_|\___|_| |_| |_|\___/ \__,_|\___| # # -if [ -f ~/.cache/gamemode ] ;then +if [ -f ~/.cache/gamemode ]; then hyprctl reload rm ~/.cache/gamemode notify-send "Gamemode deactivated" "Animations and blur enabled" @@ -20,6 +20,6 @@ else keyword general:gaps_out 0;\ keyword general:border_size 1;\ keyword decoration:rounding 0" - touch ~/.cache/gamemode + touch ~/.cache/gamemode notify-send "Gamemode activated" "Animations and blur disabled" fi diff --git a/share/dotfiles/.config/hypr/scripts/gtk.sh b/share/dotfiles/.config/hypr/scripts/gtk.sh index de4e6f8b..fd61d4cb 100755 --- a/share/dotfiles/.config/hypr/scripts/gtk.sh +++ b/share/dotfiles/.config/hypr/scripts/gtk.sh @@ -1,10 +1,10 @@ #!/bin/bash # ____ _____ _ __ # / ___|_ _| |/ / -# | | _ | | | ' / -# | |_| | | | | . \ +# | | _ | | | ' / +# | |_| | | | | . \ # \____| |_| |_|\_\ -# +# # Source: https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland config="$HOME/.config/gtk-3.0/settings.ini" @@ -17,11 +17,11 @@ cursor_theme="$(grep 'gtk-cursor-theme-name' "$config" | sed 's/.*\s*=\s*//')" cursor_size="$(grep 'gtk-cursor-theme-size' "$config" | sed 's/.*\s*=\s*//')" font_name="$(grep 'gtk-font-name' "$config" | sed 's/.*\s*=\s*//')" -echo $gtk_theme -echo $icon_theme -echo $cursor_theme -echo $cursor_size -echo $font_name +echo "$gtk_theme" +echo "$icon_theme" +echo "$cursor_theme" +echo "$cursor_size" +echo "$font_name" gsettings set "$gnome_schema" gtk-theme "$gtk_theme" gsettings set "$gnome_schema" icon-theme "$icon_theme" @@ -29,7 +29,7 @@ gsettings set "$gnome_schema" cursor-theme "$cursor_theme" gsettings set "$gnome_schema" font-name "$font_name" gsettings set "$gnome_schema" color-scheme "prefer-dark" -if [ -f ~/.config/hypr/conf/cursor.conf ] ;then - echo "exec-once = hyprctl setcursor $cursor_theme $cursor_size" > ~/.config/hypr/conf/cursor.conf - hyprctl setcursor $cursor_theme $cursor_size -fi \ No newline at end of file +if [ -f ~/.config/hypr/conf/cursor.conf ]; then + echo "exec-once = hyprctl setcursor $cursor_theme $cursor_size" >~/.config/hypr/conf/cursor.conf + hyprctl setcursor "$cursor_theme" "$cursor_size" +fi diff --git a/share/dotfiles/.config/hypr/scripts/hypridle.sh b/share/dotfiles/.config/hypr/scripts/hypridle.sh index 6296fa0b..51e9e3b7 100755 --- a/share/dotfiles/.config/hypr/scripts/hypridle.sh +++ b/share/dotfiles/.config/hypr/scripts/hypridle.sh @@ -1,23 +1,23 @@ #!/bin/bash -# _ _ _ _ _ -# | | | |_ _ _ __ _ __(_) __| | | ___ +# _ _ _ _ _ +# | | | |_ _ _ __ _ __(_) __| | | ___ # | |_| | | | | '_ \| '__| |/ _` | |/ _ \ # | _ | |_| | |_) | | | | (_| | | __/ # |_| |_|\__, | .__/|_| |_|\__,_|_|\___| -# |___/|_| -# +# |___/|_| +# SERVICE="hypridle" if [[ "$1" == "status" ]]; then sleep 1 - if pgrep -x "$SERVICE" >/dev/null ;then + if pgrep -x "$SERVICE" >/dev/null; then echo '{"text": "RUNNING", "class": "active", "tooltip": "Screen locking active\nLeft: Deactivate\nRight: Lock Screen"}' else echo '{"text": "NOT RUNNING", "class": "notactive", "tooltip": "Screen locking deactivated\nLeft: Activate\nRight: Lock Screen"}' fi fi if [[ "$1" == "toggle" ]]; then - if pgrep -x "$SERVICE" >/dev/null ;then + if pgrep -x "$SERVICE" >/dev/null; then killall hypridle else hypridle diff --git a/share/dotfiles/.config/hypr/scripts/hyprshade.sh b/share/dotfiles/.config/hypr/scripts/hyprshade.sh index 3c358c1a..4c503d7f 100755 --- a/share/dotfiles/.config/hypr/scripts/hyprshade.sh +++ b/share/dotfiles/.config/hypr/scripts/hyprshade.sh @@ -1,43 +1,43 @@ #!/bin/bash -# _ _ _ _ -# | | | |_ _ _ __ _ __ ___| |__ __ _ __| | ___ +# _ _ _ _ +# | | | |_ _ _ __ _ __ ___| |__ __ _ __| | ___ # | |_| | | | | '_ \| '__/ __| '_ \ / _` |/ _` |/ _ \ # | _ | |_| | |_) | | \__ \ | | | (_| | (_| | __/ # |_| |_|\__, | .__/|_| |___/_| |_|\__,_|\__,_|\___| -# |___/|_| -# +# |___/|_| +# if [[ "$1" == "rofi" ]]; then # Open rofi to select the Hyprshade filter for toggle options="$(hyprshade ls)\noff" - + # Open rofi - choice=$(echo -e "$options" | rofi -dmenu -replace -config ~/.config/rofi/config-hyprshade.rasi -i -no-show-icons -l 4 -width 30 -p "Hyprshade") - if [ ! -z $choice ] ;then - echo "hyprshade_filter=\"$choice\"" > ~/.config/ml4w/settings/hyprshade.sh - if [ "$choice" == "off" ] ;then + choice=$(echo -e "$options" | rofi -dmenu -replace -config ~/.config/rofi/config-hyprshade.rasi -i -no-show-icons -l 4 -width 30 -p "Hyprshade") + if [ ! -z "$choice" ]; then + echo "hyprshade_filter=\"$choice\"" >~/.config/ml4w/settings/hyprshade.sh + if [ "$choice" == "off" ]; then hyprshade off notify-send "Hyprshade deactivated" - echo ":: hyprshade turned off" + echo ":: hyprshade turned off" else dunstify "Changing Hyprshade to $choice" "Toggle shader with SUPER+SHIFT+S" fi fi - + else # Toggle Hyprshade based on the selected filter hyprshade_filter="blue-light-filter" # Check if hyprshade.sh settings file exists and load - if [ -f ~/.config/ml4w/settings/hyprshade.sh ] ;then + if [ -f ~/.config/ml4w/settings/hyprshade.sh ]; then source ~/.config/ml4w/settings/hyprshade.sh fi # Toggle Hyprshade - if [ "$hyprshade_filter" != "off" ] ;then - if [ -z $(hyprshade current) ] ;then + if [ "$hyprshade_filter" != "off" ]; then + if [ -z $(hyprshade current) ]; then echo ":: hyprshade is not running" hyprshade on $hyprshade_filter notify-send "Hyprshade activated" "with $(hyprshade current)" diff --git a/share/dotfiles/.config/hypr/scripts/init-wallpaper-engine.sh b/share/dotfiles/.config/hypr/scripts/init-wallpaper-engine.sh index 67511563..bb62a418 100755 --- a/share/dotfiles/.config/hypr/scripts/init-wallpaper-engine.sh +++ b/share/dotfiles/.config/hypr/scripts/init-wallpaper-engine.sh @@ -1,21 +1,21 @@ #!/bin/bash -# __ ______ _____ _ -# \ \ / / _ \ | ____|_ __ __ _(_)_ __ ___ +# __ ______ _____ _ +# \ \ / / _ \ | ____|_ __ __ _(_)_ __ ___ # \ \ /\ / /| |_) | | _| | '_ \ / _` | | '_ \ / _ \ # \ V V / | __/ | |___| | | | (_| | | | | | __/ # \_/\_/ |_| |_____|_| |_|\__, |_|_| |_|\___| -# |___/ -# +# |___/ +# -wallpaper_engine=$(cat $HOME/.config/ml4w/settings/wallpaper-engine.sh) -if [ "$wallpaper_engine" == "swww" ] ;then +wallpaper_engine=$(cat "$HOME"/.config/ml4w/settings/wallpaper-engine.sh) +if [ "$wallpaper_engine" == "swww" ]; then # swww echo ":: Using swww" swww init swww-daemon --format xrgb sleep 0.5 ~/.config/hypr/scripts/wallpaper.sh init -elif [ "$wallpaper_engine" == "hyprpaper" ] ;then +elif [ "$wallpaper_engine" == "hyprpaper" ]; then # hyprpaper echo ":: Using hyprpaper" sleep 0.5 @@ -24,4 +24,3 @@ else echo ":: Wallpaper Engine disabled" ~/.config/hypr/scripts/wallpaper.sh init fi - diff --git a/share/dotfiles/.config/hypr/scripts/keybindings.sh b/share/dotfiles/.config/hypr/scripts/keybindings.sh index d0b9150b..6525ba5f 100755 --- a/share/dotfiles/.config/hypr/scripts/keybindings.sh +++ b/share/dotfiles/.config/hypr/scripts/keybindings.sh @@ -1,47 +1,46 @@ #!/bin/bash -# _ _ _ _ _ -# | | _____ _ _| |__ (_)_ __ __| (_)_ __ __ _ ___ -# | |/ / _ \ | | | '_ \| | '_ \ / _` | | '_ \ / _` / __| -# | < __/ |_| | |_) | | | | | (_| | | | | | (_| \__ \ -# |_|\_\___|\__, |_.__/|_|_| |_|\__,_|_|_| |_|\__, |___/ -# |___/ |___/ +# _ _ _ _ _ +# | | _____ _ _| |__ (_)_ __ __| (_)_ __ __ _ ___ +# | |/ / _ \ | | | '_ \| | '_ \ / _` | | '_ \ / _` / __| +# | < __/ |_| | |_) | | | | | (_| | | | | | (_| \__ \ +# |_|\_\___|\__, |_.__/|_|_| |_|\__,_|_|_| |_|\__, |___/ +# |___/ |___/ # -# ----------------------------------------------------- +# ----------------------------------------------------- # Get keybindings location based on variation -# ----------------------------------------------------- +# ----------------------------------------------------- config_file=$(cat ~/.config/hypr/conf/keybinding.conf) config_file=${config_file/source = ~/} config_file=${config_file/source=~/} -# ----------------------------------------------------- +# ----------------------------------------------------- # Path to keybindings config file -# ----------------------------------------------------- +# ----------------------------------------------------- config_file="/home/$USER$config_file" echo "Reading from: $config_file" keybinds="" # Detect Start String -while read -r line -do +while read -r line; do if [[ "$line" == "bind"* ]]; then line="$(echo "$line" | sed 's/$mainMod/SUPER/g')" line="$(echo "$line" | sed 's/bind = //g')" line="$(echo "$line" | sed 's/bindm = //g')" - IFS='#' - read -a strarr <<<"$line" + IFS='#' + read -a strarr <<<"$line" kb_str=${strarr[0]} cm_str=${strarr[1]} - IFS=',' - read -a kbarr <<<"$kb_str" + IFS=',' + read -a kbarr <<<"$kb_str" item="${kbarr[0]} + ${kbarr[1]}"$'\r'"${cm_str:1}" keybinds=$keybinds$item$'\n' - fi -done < "$config_file" + fi +done <"$config_file" sleep 0.2 -rofi -dmenu -i -markup -eh 2 -replace -p "Keybinds" -config ~/.config/rofi/config-compact.rasi <<< "$keybinds" \ No newline at end of file +rofi -dmenu -i -markup -eh 2 -replace -p "Keybinds" -config ~/.config/rofi/config-compact.rasi <<<"$keybinds" diff --git a/share/dotfiles/.config/hypr/scripts/loadconfig.sh b/share/dotfiles/.config/hypr/scripts/loadconfig.sh index a51ce6da..825fc1b0 100755 --- a/share/dotfiles/.config/hypr/scripts/loadconfig.sh +++ b/share/dotfiles/.config/hypr/scripts/loadconfig.sh @@ -1,2 +1,2 @@ #!/bin/bash -hyprctl reload \ No newline at end of file +hyprctl reload diff --git a/share/dotfiles/.config/hypr/scripts/ml4w-autostart.sh b/share/dotfiles/.config/hypr/scripts/ml4w-autostart.sh index 0566294e..e31c09af 100755 --- a/share/dotfiles/.config/hypr/scripts/ml4w-autostart.sh +++ b/share/dotfiles/.config/hypr/scripts/ml4w-autostart.sh @@ -1,15 +1,15 @@ #!/bin/bash -if [ -f ~/.config/ml4w/version/compare.sh ] ;then - $HOME/.config/ml4w/version/compare.sh +if [ -f ~/.config/ml4w/version/compare.sh ]; then + "$HOME"/.config/ml4w/version/compare.sh fi -if [ ! -f ~/.cache/ml4w-post-install ] ;then - if [ ! -f $HOME/.cache/ml4w-welcome-autostart ] ;then +if [ ! -f ~/.cache/ml4w-post-install ]; then + if [ ! -f "$HOME"/.cache/ml4w-welcome-autostart ]; then echo ":: Autostart of ML4W Welcome App enabled." - if [ -f $HOME/.config/ml4w/apps/ML4W_Welcome-x86_64.AppImage ] ;then + if [ -f "$HOME"/.config/ml4w/apps/ML4W_Welcome-x86_64.AppImage ]; then echo ":: Starting ML4W Welcome App ..." sleep 2 - $HOME/.config/ml4w/apps/ML4W_Welcome-x86_64.AppImage + "$HOME"/.config/ml4w/apps/ML4W_Welcome-x86_64.AppImage else echo ":: ML4W Welcome App not found." fi @@ -21,5 +21,5 @@ else rm ~/.cache/ml4w-post-install terminal=$(cat ~/.config/ml4w/settings/terminal.sh) $terminal --class dotfiles-floating -e ~/.config/ml4w/postinstall.sh - $HOME/.config/ml4w/apps/ML4W_Welcome-x86_64.AppImage + "$HOME"/.config/ml4w/apps/ML4W_Welcome-x86_64.AppImage fi diff --git a/share/dotfiles/.config/hypr/scripts/moveTo.sh b/share/dotfiles/.config/hypr/scripts/moveTo.sh index de2492bb..a42030e9 100755 --- a/share/dotfiles/.config/hypr/scripts/moveTo.sh +++ b/share/dotfiles/.config/hypr/scripts/moveTo.sh @@ -1,10 +1,10 @@ #!/bin/bash -# __ __ _ -# | \/ | _____ _____ | |_ ___ -# | |\/| |/ _ \ \ / / _ \ | __/ _ \ +# __ __ _ +# | \/ | _____ _____ | |_ ___ +# | |\/| |/ _ \ \ / / _ \ | __/ _ \ # | | | | (_) \ V / __/ | || (_) | -# |_| |_|\___/ \_/ \___| \__\___/ -# +# |_| |_|\___/ \_/ \___| \__\___/ +# # Function to log messages (useful for debugging) log_message() { @@ -45,4 +45,4 @@ log_message "Finished moving windows" # Switch to the target workspace hyprctl dispatch workspace "$target_workspace" -log_message "Switched to workspace $target_workspace" \ No newline at end of file +log_message "Switched to workspace $target_workspace" diff --git a/share/dotfiles/.config/hypr/scripts/power.sh b/share/dotfiles/.config/hypr/scripts/power.sh index 8037fbd5..357e75f3 100755 --- a/share/dotfiles/.config/hypr/scripts/power.sh +++ b/share/dotfiles/.config/hypr/scripts/power.sh @@ -1,10 +1,10 @@ #!/bin/bash -# ____ -# | _ \ _____ _____ _ __ +# ____ +# | _ \ _____ _____ _ __ # | |_) / _ \ \ /\ / / _ \ '__| -# | __/ (_) \ V V / __/ | -# |_| \___/ \_/\_/ \___|_| -# +# | __/ (_) \ V V / __/ | +# |_| \___/ \_/\_/ \___|_| +# # Check if eww is open FILE="$HOME/.cache/ml4w_sidebar" @@ -12,23 +12,23 @@ FILE="$HOME/.cache/ml4w_sidebar" if [[ "$1" == "exit" ]]; then echo ":: Exit" if [[ -f "$FILE" ]]; then - rm $FILE + rm "$FILE" fi sleep 0.5 - killall -9 Hyprland + killall -9 Hyprland sleep 2 fi if [[ "$1" == "lock" ]]; then echo ":: Lock" sleep 0.5 - hyprlock + hyprlock fi if [[ "$1" == "reboot" ]]; then echo ":: Reboot" if [[ -f "$FILE" ]]; then - rm $FILE + rm "$FILE" fi sleep 0.5 systemctl reboot @@ -37,7 +37,7 @@ fi if [[ "$1" == "shutdown" ]]; then echo ":: Shutdown" if [[ -f "$FILE" ]]; then - rm $FILE + rm "$FILE" fi sleep 0.5 systemctl poweroff @@ -46,11 +46,11 @@ fi if [[ "$1" == "suspend" ]]; then echo ":: Suspend" sleep 0.5 - systemctl suspend + systemctl suspend fi if [[ "$1" == "hibernate" ]]; then echo ":: Hibernate" - sleep 1; - systemctl hibernate -fi \ No newline at end of file + sleep 1 + systemctl hibernate +fi diff --git a/share/dotfiles/.config/hypr/scripts/restart-hypridle.sh b/share/dotfiles/.config/hypr/scripts/restart-hypridle.sh index fe294617..0fe49fe2 100755 --- a/share/dotfiles/.config/hypr/scripts/restart-hypridle.sh +++ b/share/dotfiles/.config/hypr/scripts/restart-hypridle.sh @@ -2,4 +2,4 @@ killall hypridle sleep 1 hypridle & -notify-send "hypridle has been restarted." \ No newline at end of file +notify-send "hypridle has been restarted." diff --git a/share/dotfiles/.config/hypr/scripts/screenshot.sh b/share/dotfiles/.config/hypr/scripts/screenshot.sh index d08557ac..ac0c9068 100755 --- a/share/dotfiles/.config/hypr/scripts/screenshot.sh +++ b/share/dotfiles/.config/hypr/scripts/screenshot.sh @@ -1,17 +1,17 @@ #!/bin/bash -# ____ _ _ -# / ___| ___ _ __ ___ ___ _ __ ___| |__ ___ | |_ -# \___ \ / __| '__/ _ \/ _ \ '_ \/ __| '_ \ / _ \| __| -# ___) | (__| | | __/ __/ | | \__ \ | | | (_) | |_ -# |____/ \___|_| \___|\___|_| |_|___/_| |_|\___/ \__| -# -# Based on https://github.com/hyprwm/contrib/blob/main/grimblast/screenshot.sh -# ----------------------------------------------------- +# ____ _ _ +# / ___| ___ _ __ ___ ___ _ __ ___| |__ ___ | |_ +# \___ \ / __| '__/ _ \/ _ \ '_ \/ __| '_ \ / _ \| __| +# ___) | (__| | | __/ __/ | | \__ \ | | | (_) | |_ +# |____/ \___|_| \___|\___|_| |_|___/_| |_|\___/ \__| +# +# Based on https://github.com/hyprwm/contrib/blob/main/grimblast/screenshot.sh +# ----------------------------------------------------- # Screenshots will be stored in $HOME by default. # The screenshot will be moved into the screenshot directory -# Add this to ~/.config/user-dirs.dirs to save screenshots in a custom folder: +# Add this to ~/.config/user-dirs.dirs to save screenshots in a custom folder: # XDG_SCREENSHOTS_DIR="$HOME/Screenshots" prompt='Screenshot' @@ -110,7 +110,7 @@ type_screenshot_cmd() { # Ask for confirmation type_screenshot_exit() { - echo -e "$option_capture_1\n$option_capture_2\n$option_capture_3" | type_screenshot_cmd + echo -e "$option_capture_1\n$option_capture_2\n$option_capture_3" | type_screenshot_cmd } # Confirm and execute @@ -181,10 +181,10 @@ timer() { # take shots takescreenshot() { sleep 1 - grimblast --notify "$option_chosen" "$option_type_screenshot" $NAME - if [ -f $HOME/$NAME ] ;then - if [ -d $screenshot_folder ] ;then - mv $HOME/$NAME $screenshot_folder/ + grimblast --notify "$option_chosen" "$option_type_screenshot" "$NAME" + if [ -f "$HOME"/"$NAME" ]; then + if [ -d "$screenshot_folder" ]; then + mv "$HOME"/"$NAME" "$screenshot_folder"/ fi fi } @@ -192,10 +192,10 @@ takescreenshot() { takescreenshot_timer() { sleep 1 timer - grimblast --notify "$option_chosen" "$option_type_screenshot" $NAME - if [ -f $HOME/$NAME ] ;then - if [ -d $screenshot_folder ] ;then - mv $HOME/$NAME $screenshot_folder/ + grimblast --notify "$option_chosen" "$option_type_screenshot" "$NAME" + if [ -f "$HOME"/"$NAME" ]; then + if [ -d "$screenshot_folder" ]; then + mv "$HOME"/"$NAME" "$screenshot_folder"/ fi fi } diff --git a/share/dotfiles/.config/hypr/scripts/toggle-animations.sh b/share/dotfiles/.config/hypr/scripts/toggle-animations.sh index 7eedb1d2..e45b5b03 100755 --- a/share/dotfiles/.config/hypr/scripts/toggle-animations.sh +++ b/share/dotfiles/.config/hypr/scripts/toggle-animations.sh @@ -1,13 +1,13 @@ #!/bin/bash cache_file="$HOME/.cache/toggle_animation" -if [[ $(cat $HOME/.config/hypr/conf/animation.conf) == *"disabled"* ]]; then +if [[ $(cat "$HOME"/.config/hypr/conf/animation.conf) == *"disabled"* ]]; then echo ":: Toggle blocked by disabled.conf variation." else - if [ -f $cache_file ] ;then + if [ -f "$cache_file" ]; then hyprctl keyword animations:enabled true - rm $cache_file + rm "$cache_file" else hyprctl keyword animations:enabled false - touch $cache_file + touch "$cache_file" fi -fi \ No newline at end of file +fi diff --git a/share/dotfiles/.config/hypr/scripts/toggleallfloat.sh b/share/dotfiles/.config/hypr/scripts/toggleallfloat.sh index 3fc12e27..dab23c53 100755 --- a/share/dotfiles/.config/hypr/scripts/toggleallfloat.sh +++ b/share/dotfiles/.config/hypr/scripts/toggleallfloat.sh @@ -1,10 +1,10 @@ #!/bin/bash -# _ _ _ __ _ _ -# / \ | | |/ _| | ___ __ _| |_ -# / _ \ | | | |_| |/ _ \ / _` | __| -# / ___ \| | | _| | (_) | (_| | |_ -# /_/ \_\_|_|_| |_|\___/ \__,_|\__| -# +# _ _ _ __ _ _ +# / \ | | |/ _| | ___ __ _| |_ +# / _ \ | | | |_| |/ _ \ / _` | __| +# / ___ \| | | _| | (_) | (_| | |_ +# /_/ \_\_|_|_| |_|\___/ \__,_|\__| +# hyprctl dispatch workspaceopt allfloat notify-send "Windows on this workspace toggled to floating/tiling" diff --git a/share/dotfiles/.config/hypr/scripts/wallpaper-automation.sh b/share/dotfiles/.config/hypr/scripts/wallpaper-automation.sh index e3d1f1e1..f12310ab 100755 --- a/share/dotfiles/.config/hypr/scripts/wallpaper-automation.sh +++ b/share/dotfiles/.config/hypr/scripts/wallpaper-automation.sh @@ -1,20 +1,20 @@ #!/bin/bash -# _ _ __ ______ -# / \ _ _| |_ ___ \ \ / / _ \ +# _ _ __ ______ +# / \ _ _| |_ ___ \ \ / / _ \ # / _ \| | | | __/ _ \ \ \ /\ / /| |_) | -# / ___ \ |_| | || (_) | \ V V / | __/ -# /_/ \_\__,_|\__\___/ \_/\_/ |_| -# +# / ___ \ |_| | || (_) | \ V V / | __/ +# /_/ \_\__,_|\__\___/ \_/\_/ |_| +# sec=$(cat ~/.config/ml4w/settings/wallpaper-automation.sh) _setWallpaperRandomly() { waypaper --random echo ":: Next wallpaper in 60 seconds..." - sleep $sec + sleep "$sec" _setWallpaperRandomly } -if [ ! -f ~/.config/ml4w/cache/wallpaper-automation ] ;then +if [ ! -f ~/.config/ml4w/cache/wallpaper-automation ]; then touch ~/.config/ml4w/cache/wallpaper-automation echo ":: Start wallpaper automation script" notify-send "Wallpaper automation process started" "Wallpaper will be changed every $sec seconds." @@ -24,5 +24,5 @@ else notify-send "Wallpaper automation process stopped." echo ":: Wallpaper automation script process $wp stopped" wp=$(pgrep -f wallpaper-automation.sh) - kill -KILL $wp -fi \ No newline at end of file + kill -KILL "$wp" +fi diff --git a/share/dotfiles/.config/hypr/scripts/wallpaper-cache.sh b/share/dotfiles/.config/hypr/scripts/wallpaper-cache.sh index 899a06ad..8b12297b 100755 --- a/share/dotfiles/.config/hypr/scripts/wallpaper-cache.sh +++ b/share/dotfiles/.config/hypr/scripts/wallpaper-cache.sh @@ -1,5 +1,5 @@ #!/bin/bash generated_versions="$HOME/.config/ml4w/cache/wallpaper-generated" -rm $generated_versions/* +rm "$generated_versions"/* echo ":: Wallpaper cache cleared" -notify-send "Wallpaper cache cleared" \ No newline at end of file +notify-send "Wallpaper cache cleared" diff --git a/share/dotfiles/.config/hypr/scripts/wallpaper-effects.sh b/share/dotfiles/.config/hypr/scripts/wallpaper-effects.sh index e7481230..9c1f2761 100755 --- a/share/dotfiles/.config/hypr/scripts/wallpaper-effects.sh +++ b/share/dotfiles/.config/hypr/scripts/wallpaper-effects.sh @@ -1,10 +1,10 @@ #!/bin/bash -# __ ______ _____ __ __ _ -# \ \ / / _ \ | ____|/ _|/ _| ___ ___| |_ ___ +# __ ______ _____ __ __ _ +# \ \ / / _ \ | ____|/ _|/ _| ___ ___| |_ ___ # \ \ /\ / /| |_) | | _| | |_| |_ / _ \/ __| __/ __| # \ V V / | __/ | |___| _| _| __/ (__| |_\__ \ # \_/\_/ |_| |_____|_| |_| \___|\___|\__|___/ -# +# # Get current wallpaper cache_file="$HOME/.config/ml4w/cache/current_wallpaper" @@ -13,9 +13,9 @@ cache_file="$HOME/.config/ml4w/cache/current_wallpaper" options="$(ls ~/.config/hypr/effects/wallpaper/)\noff" # Open rofi -choice=$(echo -e "$options" | rofi -dmenu -replace -config ~/.config/rofi/config-themes.rasi -i -no-show-icons -l 5 -width 30 -p "Hyprshade") -if [ ! -z $choice ] ;then - echo "$choice" > ~/.config/ml4w/settings/wallpaper-effect.sh +choice=$(echo -e "$options" | rofi -dmenu -replace -config ~/.config/rofi/config-themes.rasi -i -no-show-icons -l 5 -width 30 -p "Hyprshade") +if [ ! -z "$choice" ]; then + echo "$choice" >~/.config/ml4w/settings/wallpaper-effect.sh dunstify "Changing Wallpaper Effect to " "$choice" - waypaper --wallpaper $(cat $cache_file) -fi \ No newline at end of file + waypaper --wallpaper $(cat "$cache_file") +fi diff --git a/share/dotfiles/.config/hypr/scripts/wallpaper.sh b/share/dotfiles/.config/hypr/scripts/wallpaper.sh index c6e0288b..c55c30a8 100755 --- a/share/dotfiles/.config/hypr/scripts/wallpaper.sh +++ b/share/dotfiles/.config/hypr/scripts/wallpaper.sh @@ -1,29 +1,29 @@ #!/bin/bash -# _ _ -# __ ____ _| | |_ __ __ _ _ __ ___ _ __ -# \ \ /\ / / _` | | | '_ \ / _` | '_ \ / _ \ '__| -# \ V V / (_| | | | |_) | (_| | |_) | __/ | -# \_/\_/ \__,_|_|_| .__/ \__,_| .__/ \___|_| -# |_| |_| -# -# ----------------------------------------------------- +# _ _ +# __ ____ _| | |_ __ __ _ _ __ ___ _ __ +# \ \ /\ / / _` | | | '_ \ / _` | '_ \ / _ \ '__| +# \ V V / (_| | | | |_) | (_| | |_) | __/ | +# \_/\_/ \__,_|_|_| .__/ \__,_| .__/ \___|_| +# |_| |_| +# +# ----------------------------------------------------- # Check to use wallpaper cache -# ----------------------------------------------------- +# ----------------------------------------------------- use_cache=0 -if [ -f ~/.config/ml4w/settings/wallpaper_cache ] ;then +if [ -f ~/.config/ml4w/settings/wallpaper_cache ]; then use_cache=1 fi -if [ "$use_cache" == "1" ] ;then +if [ "$use_cache" == "1" ]; then echo ":: Using Wallpaper Cache" else echo ":: Wallpaper Cache disabled" fi -# ----------------------------------------------------- +# ----------------------------------------------------- # Set defaults -# ----------------------------------------------------- +# ----------------------------------------------------- force_generate=0 generated_versions="$HOME/.config/ml4w/cache/wallpaper-generated" @@ -36,27 +36,27 @@ blur_file="$HOME/.config/ml4w/settings/blur.sh" default_wallpaper="$HOME/wallpaper/default.jpg" wallpaper_effect="$HOME/.config/ml4w/settings/wallpaper-effect.sh" blur="50x30" -blur=$(cat $blur_file) +blur=$(cat "$blur_file") -if [ -f $waypaper_running ] ;then - rm $waypaper_running +if [ -f "$waypaper_running" ]; then + rm "$waypaper_running" exit else - touch $waypaper_running + touch "$waypaper_running" fi # Create folder with generated versions of wallpaper if not exists -if [ ! -d $generated_versions ] ;then - mkdir $generated_versions +if [ ! -d "$generated_versions" ]; then + mkdir "$generated_versions" fi -# ----------------------------------------------------- +# ----------------------------------------------------- # Get selected wallpaper -# ----------------------------------------------------- +# ----------------------------------------------------- -if [ -z $1 ] ;then - if [ -f $cache_file ] ;then - wallpaper=$(cat $cache_file) +if [ -z "$1" ]; then + if [ -f "$cache_file" ]; then + wallpaper=$(cat "$cache_file") else wallpaper=$default_wallpaper fi @@ -67,91 +67,91 @@ used_wallpaper=$wallpaper echo ":: Setting wallpaper with original image $wallpaper" tmp_wallpaper=$wallpaper -# ----------------------------------------------------- +# ----------------------------------------------------- # Copy path of current wallpaper to cache file -# ----------------------------------------------------- +# ----------------------------------------------------- -if [ ! -f $cache_file ] ;then - touch $cache_file +if [ ! -f "$cache_file" ]; then + touch "$cache_file" fi -echo "$wallpaper" > $cache_file +echo "$wallpaper" >"$cache_file" echo ":: Path of current wallpaper copied to $cache_file" -# ----------------------------------------------------- +# ----------------------------------------------------- # Get wallpaper filename -# ----------------------------------------------------- -wallpaper_filename=$(basename $wallpaper) +# ----------------------------------------------------- +wallpaper_filename=$(basename "$wallpaper") echo ":: Wallpaper Filename: $wallpaper_filename" -# ----------------------------------------------------- +# ----------------------------------------------------- # Wallpaper Effects # ----------------------------------------------------- -if [ -f $wallpaper_effect ] ;then - effect=$(cat $wallpaper_effect) - if [ ! "$effect" == "off" ] ;then +if [ -f "$wallpaper_effect" ]; then + effect=$(cat "$wallpaper_effect") + if [ ! "$effect" == "off" ]; then used_wallpaper=$generated_versions/$effect-$wallpaper_filename - if [ -f $generated_versions/$effect-$wallpaper_filename ] && [ "$force_generate" == "0" ] && [ "$use_cache" == "1" ] ;then + if [ -f "$generated_versions"/"$effect"-"$wallpaper_filename" ] && [ "$force_generate" == "0" ] && [ "$use_cache" == "1" ]; then echo ":: Use cached wallpaper $effect-$wallpaper_filename" else echo ":: Generate new cached wallpaper $effect-$wallpaper_filename with effect $effect" dunstify "Using wallpaper effect $effect..." "with image $wallpaper_filename" -h int:value:10 -h string:x-dunst-stack-tag:wallpaper - source $HOME/.config/hypr/effects/wallpaper/$effect + source "$HOME"/.config/hypr/effects/wallpaper/"$effect" fi echo ":: Loading wallpaper $generated_versions/$effect-$wallpaper_filename with effect $effect" echo ":: Setting wallpaper with $used_wallpaper" - waypaper --wallpaper $used_wallpaper + waypaper --wallpaper "$used_wallpaper" else echo ":: Wallpaper effect is set to off" fi fi -# ----------------------------------------------------- +# ----------------------------------------------------- # Execute pywal -# ----------------------------------------------------- +# ----------------------------------------------------- echo ":: Execute pywal with $used_wallpaper" -wal -q -i $used_wallpaper +wal -q -i "$used_wallpaper" source "$HOME/.cache/wal/colors.sh" -# ----------------------------------------------------- +# ----------------------------------------------------- # Reload Waybar # ----------------------------------------------------- ~/.config/waybar/launch.sh -# ----------------------------------------------------- +# ----------------------------------------------------- # Reload AGS # ----------------------------------------------------- killall ags ags & -# ----------------------------------------------------- +# ----------------------------------------------------- # Created blurred wallpaper # ----------------------------------------------------- echo ":: Generate new cached wallpaper blur-$blur-$wallpaper_filename with blur $blur" -magick $used_wallpaper -resize 75% $blurred_wallpaper +magick "$used_wallpaper" -resize 75% "$blurred_wallpaper" echo ":: Resized to 75%" -if [ ! "$blur" == "0x0" ] ;then - magick $blurred_wallpaper -blur $blur $blurred_wallpaper - cp $blurred_wallpaper $generated_versions/blur-$blur-$wallpaper_filename.png +if [ ! "$blur" == "0x0" ]; then + magick "$blurred_wallpaper" -blur "$blur" "$blurred_wallpaper" + cp "$blurred_wallpaper" "$generated_versions"/blur-"$blur"-"$wallpaper_filename".png echo ":: Blurred" fi -cp $generated_versions/blur-$blur-$wallpaper_filename.png $blurred_wallpaper +cp "$generated_versions"/blur-"$blur"-"$wallpaper_filename".png "$blurred_wallpaper" -# ----------------------------------------------------- +# ----------------------------------------------------- # Create rasi file -# ----------------------------------------------------- +# ----------------------------------------------------- -if [ ! -f $rasi_file ] ;then - touch $rasi_file +if [ ! -f "$rasi_file" ]; then + touch "$rasi_file" fi -echo "* { current-image: url(\"$blurred_wallpaper\", height); }" > "$rasi_file" +echo "* { current-image: url(\"$blurred_wallpaper\", height); }" >"$rasi_file" -# ----------------------------------------------------- +# ----------------------------------------------------- # Created square wallpaper # ----------------------------------------------------- echo ":: Generate new cached wallpaper square-$wallpaper_filename" -magick $tmp_wallpaper -gravity Center -extent 1:1 $square_wallpaper -cp $square_wallpaper $generated_versions/square-$wallpaper_filename.png +magick "$tmp_wallpaper" -gravity Center -extent 1:1 "$square_wallpaper" +cp "$square_wallpaper" "$generated_versions"/square-"$wallpaper_filename".png diff --git a/share/dotfiles/.config/hypr/scripts/xdg.sh b/share/dotfiles/.config/hypr/scripts/xdg.sh index 562fee48..49bdd9ed 100755 --- a/share/dotfiles/.config/hypr/scripts/xdg.sh +++ b/share/dotfiles/.config/hypr/scripts/xdg.sh @@ -1,10 +1,10 @@ #!/bin/bash -# __ ______ ____ +# __ ______ ____ # \ \/ / _ \ / ___| -# \ /| | | | | _ +# \ /| | | | | _ # / \| |_| | |_| | # /_/\_\____/ \____| -# +# sleep 1 diff --git a/share/dotfiles/.config/ml4w/postinstall.sh b/share/dotfiles/.config/ml4w/postinstall.sh index 06993d12..1f5135fc 100755 --- a/share/dotfiles/.config/ml4w/postinstall.sh +++ b/share/dotfiles/.config/ml4w/postinstall.sh @@ -1,39 +1,39 @@ #!/bin/bash sleep 2 clear -if ! type "pacman" > /dev/null 2>&1; then +if ! type "pacman" >/dev/null 2>&1; then echo ":: You're not on an Arch based distro" exit fi _installPackagesPacman() { - toInstall=(); + toInstall=() for pkg; do if [[ $(_isInstalledPacman "${pkg}") == 0 ]]; then - echo ":: ${pkg} is already installed."; - continue; - fi; - toInstall+=("${pkg}"); - done; + echo ":: ${pkg} is already installed." + continue + fi + toInstall+=("${pkg}") + done - if [[ "${toInstall[@]}" == "" ]] ; then + if [[ "${toInstall[@]}" == "" ]]; then # echo "All pacman packages are already installed."; - return; - fi; + return + fi # printf "Package not installed:\n%s\n" "${toInstall[@]}"; - sudo pacman --noconfirm -S "${toInstall[@]}"; + sudo pacman --noconfirm -S "${toInstall[@]}" } _isInstalledPacman() { - package="$1"; - check="$(sudo pacman -Qs --color always "${package}" | grep "local" | grep "${package} ")"; - if [ -n "${check}" ] ; then - echo 0; #'0' means 'true' in Bash - return; #true - fi; - echo 1; #'1' means 'false' in Bash - return; #false + package="$1" + check="$(sudo pacman -Qs --color always "${package}" | grep "local" | grep "${package} ")" + if [ -n "${check}" ]; then + echo 0 #'0' means 'true' in Bash + return #true + fi + echo 1 #'1' means 'false' in Bash + return #false } echo -e "${GREEN}" @@ -50,10 +50,10 @@ else echo -e "${GREEN}" figlet -f smslant "Portal GTK" echo -e "${NONE}" - echo "xdg-desktop-portal-gtk is required to use dark mode in GTK4 Apps." + echo "xdg-desktop-portal-gtk is required to use dark mode in GTK4 Apps." echo if gum confirm "Do you want to install xdg-desktop-portal-gtk?"; then - _installPackagesPacman "xdg-desktop-portal-gtk"; + _installPackagesPacman "xdg-desktop-portal-gtk" reboot=1 elif [ $? -eq 130 ]; then echo ":: Installation canceled." @@ -74,7 +74,7 @@ figlet -f smslant "Reboot" echo -e "${NONE}" echo "A reboot of your system is recommended." echo -if gum confirm "Do you want to reboot your system now?" ;then +if gum confirm "Do you want to reboot your system now?"; then gum spin --spinner dot --title "Rebooting now..." -- sleep 3 systemctl reboot elif [ $? -eq 130 ]; then diff --git a/share/dotfiles/.config/ml4w/scripts/checkpostinstall.sh b/share/dotfiles/.config/ml4w/scripts/checkpostinstall.sh index 76962b42..4cf67cee 100755 --- a/share/dotfiles/.config/ml4w/scripts/checkpostinstall.sh +++ b/share/dotfiles/.config/ml4w/scripts/checkpostinstall.sh @@ -1,4 +1,4 @@ -if [ -f ~/.cache/ml4w-post-install ] ;then +if [ -f ~/.cache/ml4w-post-install ]; then terminal=$(cat ~/.config/ml4w/settings/terminal.sh) $terminal -e ~/.config/ml4w/postinstall.sh rm ~/.cache/ml4w-post-install diff --git a/share/dotfiles/.config/ml4w/scripts/cliphist.sh b/share/dotfiles/.config/ml4w/scripts/cliphist.sh index b9a2acc4..d67a5b37 100755 --- a/share/dotfiles/.config/ml4w/scripts/cliphist.sh +++ b/share/dotfiles/.config/ml4w/scripts/cliphist.sh @@ -1,21 +1,24 @@ #!/bin/bash -# ____ _ _ _ _ _ -# / ___| (_)_ __ | |__ (_)___| |_ -# | | | | | '_ \| '_ \| / __| __| -# | |___| | | |_) | | | | \__ \ |_ -# \____|_|_| .__/|_| |_|_|___/\__| -# |_| -# +# ____ _ _ _ _ _ +# / ___| (_)_ __ | |__ (_)___| |_ +# | | | | | '_ \| '_ \| / __| __| +# | |___| | | |_) | | | | \__ \ |_ +# \____|_|_| .__/|_| |_|_|___/\__| +# |_| +# case $1 in - d) cliphist list | rofi -dmenu -replace -config ~/.config/rofi/config-cliphist.rasi | cliphist delete - ;; +d) + cliphist list | rofi -dmenu -replace -config ~/.config/rofi/config-cliphist.rasi | cliphist delete + ;; - w) if [ `echo -e "Clear\nCancel" | rofi -dmenu -config ~/.config/rofi/config-short.rasi` == "Clear" ] ; then - cliphist wipe - fi - ;; +w) + if [ $(echo -e "Clear\nCancel" | rofi -dmenu -config ~/.config/rofi/config-short.rasi) == "Clear" ]; then + cliphist wipe + fi + ;; - *) cliphist list | rofi -dmenu -replace -config ~/.config/rofi/config-cliphist.rasi | cliphist decode | wl-copy - ;; +*) + cliphist list | rofi -dmenu -replace -config ~/.config/rofi/config-cliphist.rasi | cliphist decode | wl-copy + ;; esac diff --git a/share/dotfiles/.config/ml4w/scripts/figlet.sh b/share/dotfiles/.config/ml4w/scripts/figlet.sh index 7a5ff4ea..c936bd43 100755 --- a/share/dotfiles/.config/ml4w/scripts/figlet.sh +++ b/share/dotfiles/.config/ml4w/scripts/figlet.sh @@ -1,6 +1,6 @@ #!/bin/bash figlet -f smslant "Figlet" -echo +echo # ------------------------------------------------ # Script to create ascii font based header on user input # and copy the result to the clipboard @@ -12,12 +12,12 @@ if [ -f ~/figlet.txt ]; then touch ~/figlet.txt fi -echo "cat <<\"EOF\"" > ~/figlet.txt -figlet -f smslant "$mytext" >> ~/figlet.txt -echo "" >> ~/figlet.txt -echo "EOF" >> ~/figlet.txt +echo "cat <<\"EOF\"" >~/figlet.txt +figlet -f smslant "$mytext" >>~/figlet.txt +echo "" >>~/figlet.txt +echo "EOF" >>~/figlet.txt -lines=$( cat ~/figlet.txt ) +lines=$(cat ~/figlet.txt) wl-copy "$lines" xclip -sel clip ~/figlet.txt diff --git a/share/dotfiles/.config/ml4w/scripts/installprinters.sh b/share/dotfiles/.config/ml4w/scripts/installprinters.sh index 67812c81..557143eb 100755 --- a/share/dotfiles/.config/ml4w/scripts/installprinters.sh +++ b/share/dotfiles/.config/ml4w/scripts/installprinters.sh @@ -5,8 +5,8 @@ # | ___/ '__| | '_ \| __/ _ \ '__| | | / _ \| '_ \| _| # | | | | | | | | | || __/ | | |___| (_) | | | | | # |_| |_| |_|_| |_|\__\___|_| \_____\___/|_| |_|_| -# -# By @krystalsavage +# +# By @krystalsavage sleep 1 clear @@ -16,19 +16,19 @@ figlet -f smslant "Printers" # Confirm Start # ------------------------------------------------------ -if gum confirm "DO YOU WANT TO START TO INSTALL PRINTER SYSTEM NOW?" ;then +if gum confirm "DO YOU WANT TO START TO INSTALL PRINTER SYSTEM NOW?"; then echo echo ":: Install started." elif [ $? -eq 130 ]; then - exit 130 + exit 130 else echo echo ":: Install canceled." - exit; + exit fi -if [[ $(_isInstalledYay "timeshift") == "0" ]] ;then - if gum confirm "DO YOU WANT TO CREATE A SNAPSHOT?" ;then +if [[ $(_isInstalledYay "timeshift") == "0" ]]; then + if gum confirm "DO YOU WANT TO CREATE A SNAPSHOT?"; then echo c=$(gum input --placeholder "Enter a comment for the snapshot...") sudo timeshift --create --comments "$c" @@ -52,15 +52,15 @@ echo echo ":: Installing printer system complete" sleep 2 -if [ -f ~/.config/ml4w/settings/printer-drivers.sh ] ;then - if gum confirm "DO YOU WANT TO INSTALL PRINTER DRIVERS NOW?" ;then - echo - echo ":: Install started." +if [ -f ~/.config/ml4w/settings/printer-drivers.sh ]; then + if gum confirm "DO YOU WANT TO INSTALL PRINTER DRIVERS NOW?"; then + echo + echo ":: Install started." elif [ $? -eq 130 ]; then exit 130 else echo echo ":: Install cancelled." - exit; + exit fi fi diff --git a/share/dotfiles/.config/ml4w/scripts/installtimeshift.sh b/share/dotfiles/.config/ml4w/scripts/installtimeshift.sh index 06265ad2..a3b42f90 100755 --- a/share/dotfiles/.config/ml4w/scripts/installtimeshift.sh +++ b/share/dotfiles/.config/ml4w/scripts/installtimeshift.sh @@ -1,10 +1,10 @@ #!/bin/bash -# _____ _ _ _ __ _ -# |_ _(_)_ __ ___ ___ ___| |__ (_)/ _| |_ +# _____ _ _ _ __ _ +# |_ _(_)_ __ ___ ___ ___| |__ (_)/ _| |_ # | | | | '_ ` _ \ / _ \/ __| '_ \| | |_| __| -# | | | | | | | | | __/\__ \ | | | | _| |_ +# | | | | | | | | | __/\__ \ | | | | _| |_ # |_| |_|_| |_| |_|\___||___/_| |_|_|_| \__| -# +# sleep 1 clear @@ -12,31 +12,31 @@ figlet -f smslant "Timeshift" aur_helper="$(cat ~/.config/ml4w/settings/aur.sh)" _isInstalledAUR() { - package="$1"; - check="$($aur_helper -Qs --color always "${package}" | grep "local" | grep "${package} ")"; - if [ -n "${check}" ] ; then - echo 0; #'0' means 'true' in Bash - return; #true - fi; - echo 1; #'1' means 'false' in Bash - return; #false + package="$1" + check="$($aur_helper -Qs --color always "${package}" | grep "local" | grep "${package} ")" + if [ -n "${check}" ]; then + echo 0 #'0' means 'true' in Bash + return #true + fi + echo 1 #'1' means 'false' in Bash + return #false } timeshift_installed=$(_isInstalledAUR "timeshift") grubbtrfs_installed=$(_isInstalledAUR "grub-btrfs") -if [[ $timeshift_installed == "0" ]] ;then +if [[ $timeshift_installed == "0" ]]; then echo ":: Timeshift is already installed" else - if gum confirm "DO YOU WANT TO INSTALL Timeshift now?" ;then + if gum confirm "DO YOU WANT TO INSTALL Timeshift now?"; then $aur_helper -S timeshift fi fi -if [[ -d /boot/grub ]] && [[ $grubbtrfs_installed == "0" ]] ;then +if [[ -d /boot/grub ]] && [[ $grubbtrfs_installed == "0" ]]; then echo ":: grub-btrfs is already installed" else echo ":: grub-btrfs is required to select a snapshot on grub bootloader." - if gum confirm "DO YOU WANT TO INSTALL grub-btrfs now?" ;then + if gum confirm "DO YOU WANT TO INSTALL grub-btrfs now?"; then $aur_helper -S grub-btrfs fi fi diff --git a/share/dotfiles/.config/ml4w/scripts/installupdates.sh b/share/dotfiles/.config/ml4w/scripts/installupdates.sh index dce817c8..369f3ba4 100755 --- a/share/dotfiles/.config/ml4w/scripts/installupdates.sh +++ b/share/dotfiles/.config/ml4w/scripts/installupdates.sh @@ -1,10 +1,10 @@ #!/bin/bash -# ___ _ _ _ _ _ _ _ -# |_ _|_ __ ___| |_ __ _| | | | | | |_ __ __| | __ _| |_ ___ ___ -# | || '_ \/ __| __/ _` | | | | | | | '_ \ / _` |/ _` | __/ _ \/ __| -# | || | | \__ \ || (_| | | | | |_| | |_) | (_| | (_| | || __/\__ \ -# |___|_| |_|___/\__\__,_|_|_| \___/| .__/ \__,_|\__,_|\__\___||___/ -# |_| +# ___ _ _ _ _ _ _ _ +# |_ _|_ __ ___| |_ __ _| | | | | | |_ __ __| | __ _| |_ ___ ___ +# | || '_ \/ __| __/ _` | | | | | | | '_ \ / _` |/ _` | __/ _ \/ __| +# | || | | \__ \ || (_| | | | | |_| | |_) | (_| | (_| | || __/\__ \ +# |___|_| |_|___/\__\__,_|_|_| \___/| .__/ \__,_|\__,_|\__\___||___/ +# |_| sleep 1 clear @@ -12,33 +12,33 @@ aur_helper="$(cat ~/.config/ml4w/settings/aur.sh)" figlet -f smslant "Updates" echo _isInstalledAUR() { - package="$1"; - check="$($aur_helper -Qs --color always "${package}" | grep "local" | grep "${package} ")"; - if [ -n "${check}" ] ; then - echo 0; #'0' means 'true' in Bash - return; #true - fi; - echo 1; #'1' means 'false' in Bash - return; #false + package="$1" + check="$($aur_helper -Qs --color always "${package}" | grep "local" | grep "${package} ")" + if [ -n "${check}" ]; then + echo 0 #'0' means 'true' in Bash + return #true + fi + echo 1 #'1' means 'false' in Bash + return #false } # ------------------------------------------------------ # Confirm Start # ------------------------------------------------------ -if gum confirm "DO YOU WANT TO START THE UPDATE NOW?" ;then - echo +if gum confirm "DO YOU WANT TO START THE UPDATE NOW?"; then + echo echo ":: Update started." elif [ $? -eq 130 ]; then - exit 130 + exit 130 else echo echo ":: Update canceled." - exit; + exit fi -if [[ $(_isInstalledAUR "timeshift") == "0" ]] ;then - if gum confirm "DO YOU WANT TO CREATE A SNAPSHOT?" ;then +if [[ $(_isInstalledAUR "timeshift") == "0" ]]; then + if gum confirm "DO YOU WANT TO CREATE A SNAPSHOT?"; then echo c=$(gum input --placeholder "Enter a comment for the snapshot...") sudo timeshift --create --comments "$c" @@ -57,15 +57,15 @@ fi $aur_helper -if [[ $(_isInstalledAUR "flatpak") == "0" ]] ;then +if [[ $(_isInstalledAUR "flatpak") == "0" ]]; then flatpak upgrade fi notify-send "Update complete" -echo +echo echo ":: Update complete" -echo -echo +echo +echo echo "Press [ENTER] to close." read diff --git a/share/dotfiles/.config/ml4w/scripts/lid-improvements.sh b/share/dotfiles/.config/ml4w/scripts/lid-improvements.sh index 2ffad611..11ded196 100755 --- a/share/dotfiles/.config/ml4w/scripts/lid-improvements.sh +++ b/share/dotfiles/.config/ml4w/scripts/lid-improvements.sh @@ -3,10 +3,10 @@ while IFS= read -r line; do # If the line starts with # and the next line is not the lines to be added if [[ $line == \#HandleLidSwitchDocked=ignore ]]; then # Add the new lines - echo "HandleLidSwitchDocked=ignore" | sudo tee -a /etc/systemd/logind.conf > /dev/null + echo "HandleLidSwitchDocked=ignore" | sudo tee -a /etc/systemd/logind.conf >/dev/null fi if [[ $line == \#HoldoffTimeoutSec=5s ]]; then # Add the new lines - echo "HoldoffTimeoutSec=5s" | sudo tee -a /etc/systemd/logind.conf > /dev/null + echo "HoldoffTimeoutSec=5s" | sudo tee -a /etc/systemd/logind.conf >/dev/null fi -done < /etc/systemd/logind.conf \ No newline at end of file +done ~/.config/xfce4/helpers.rc + echo "TerminalEmulator=$terminal" >~/.config/xfce4/helpers.rc echo ":: $terminal defined as Thunar Terminal Emulator." else echo "ERROR: ~/.config/xfce4 not found. Please open Thunar once to create it." diff --git a/share/dotfiles/.config/ml4w/scripts/unlock-pacman.sh b/share/dotfiles/.config/ml4w/scripts/unlock-pacman.sh index 33b7de0c..a3e2b72d 100755 --- a/share/dotfiles/.config/ml4w/scripts/unlock-pacman.sh +++ b/share/dotfiles/.config/ml4w/scripts/unlock-pacman.sh @@ -6,4 +6,4 @@ if [ -f /var/lib/pacman/db.lck ]; then else echo ":: Pacman database is not locked" fi -sleep 3 \ No newline at end of file +sleep 3 diff --git a/share/dotfiles/.config/ml4w/scripts/updates.sh b/share/dotfiles/.config/ml4w/scripts/updates.sh index 646d854a..df583978 100755 --- a/share/dotfiles/.config/ml4w/scripts/updates.sh +++ b/share/dotfiles/.config/ml4w/scripts/updates.sh @@ -1,26 +1,26 @@ #!/bin/bash -# _ _ _ _ -# | | | |_ __ __| | __ _| |_ ___ ___ -# | | | | '_ \ / _` |/ _` | __/ _ \/ __| -# | |_| | |_) | (_| | (_| | || __/\__ \ -# \___/| .__/ \__,_|\__,_|\__\___||___/ -# |_| -# - -# ----------------------------------------------------- +# _ _ _ _ +# | | | |_ __ __| | __ _| |_ ___ ___ +# | | | | '_ \ / _` |/ _` | __/ _ \/ __| +# | |_| | |_) | (_| | (_| | || __/\__ \ +# \___/| .__/ \__,_|\__,_|\__\___||___/ +# |_| +# + +# ----------------------------------------------------- # Define threshholds for color indicators -# ----------------------------------------------------- +# ----------------------------------------------------- threshhold_green=0 threshhold_yellow=25 threshhold_red=100 aur_helper="$(cat ~/.config/ml4w/settings/aur.sh)" -# ----------------------------------------------------- +# ----------------------------------------------------- # Calculate available updates -# ----------------------------------------------------- +# ----------------------------------------------------- -if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then +if ! updates_arch=$(checkupdates 2>/dev/null | wc -l); then updates_arch=0 fi @@ -32,9 +32,9 @@ fi updates=$(("$updates_arch" + "$updates_aur")) -# ----------------------------------------------------- +# ----------------------------------------------------- # Output in JSON format for Waybar Module custom-updates -# ----------------------------------------------------- +# ----------------------------------------------------- css_class="green" diff --git a/share/dotfiles/.config/ml4w/sddm/scripts/disable.sh b/share/dotfiles/.config/ml4w/sddm/scripts/disable.sh index 8585eb24..288030d0 100755 --- a/share/dotfiles/.config/ml4w/sddm/scripts/disable.sh +++ b/share/dotfiles/.config/ml4w/sddm/scripts/disable.sh @@ -1,9 +1,9 @@ #!/bin/bash figlet -f smslant "Disable SDDM" if [ -f /etc/systemd/system/display-manager.service ]; then - if gum confirm "Do you want to disable the current display manager?" ;then + if gum confirm "Do you want to disable the current display manager?"; then sudo rm /etc/systemd/system/display-manager.service - echo ":: Current display manager removed." + echo ":: Current display manager removed." echo ":: Please reboot your system." fi else diff --git a/share/dotfiles/.config/ml4w/sddm/scripts/enable.sh b/share/dotfiles/.config/ml4w/sddm/scripts/enable.sh index e3fdb8f7..c1d22d0e 100755 --- a/share/dotfiles/.config/ml4w/sddm/scripts/enable.sh +++ b/share/dotfiles/.config/ml4w/sddm/scripts/enable.sh @@ -3,9 +3,9 @@ figlet -f smslant "Enable SDDM" if [ -f /etc/systemd/system/display-manager.service ]; then echo ":: Display Manager is already enabled." else - if gum confirm "Do you want to enable SDDM as your display manager?" ;then + if gum confirm "Do you want to enable SDDM as your display manager?"; then sudo systemctl enable sddm.service - echo ":: Display manager SDDM has been enabled." + echo ":: Display manager SDDM has been enabled." echo ":: Please reboot your system!" fi fi diff --git a/share/dotfiles/.config/ml4w/sddm/scripts/wallpaper.sh b/share/dotfiles/.config/ml4w/sddm/scripts/wallpaper.sh index 0a1e15ec..90e5a7a7 100755 --- a/share/dotfiles/.config/ml4w/sddm/scripts/wallpaper.sh +++ b/share/dotfiles/.config/ml4w/sddm/scripts/wallpaper.sh @@ -1,13 +1,13 @@ #!/bin/bash -# _ _ _ _ _ _ -# | | | |_ __ __| | __ _| |_ ___ ___ __| | __| |_ __ ___ -# | | | | '_ \ / _` |/ _` | __/ _ \ / __|/ _` |/ _` | '_ ` _ \ -# | |_| | |_) | (_| | (_| | || __/ \__ \ (_| | (_| | | | | | | -# \___/| .__/ \__,_|\__,_|\__\___| |___/\__,_|\__,_|_| |_| |_| -# |_| -# -# by Stephan Raabe (2024) -# ----------------------------------------------------- +# _ _ _ _ _ _ +# | | | |_ __ __| | __ _| |_ ___ ___ __| | __| |_ __ ___ +# | | | | '_ \ / _` |/ _` | __/ _ \ / __|/ _` |/ _` | '_ ` _ \ +# | |_| | |_) | (_| | (_| | || __/ \__ \ (_| | (_| | | | | | | +# \___/| .__/ \__,_|\__,_|\__\___| |___/\__,_|\__,_|_| |_| |_| +# |_| +# +# by Stephan Raabe (2024) +# ----------------------------------------------------- cache_file="$HOME/.config/ml4w/cache/current_wallpaper" sleep 1 clear @@ -20,16 +20,16 @@ if [ ! -d /etc/sddm.conf.d/ ]; then echo "Folder /etc/sddm.conf.d created." fi -sudo cp $HOME/.config/ml4w/sddm/sddm.conf /etc/sddm.conf.d/ +sudo cp "$HOME"/.config/ml4w/sddm/sddm.conf /etc/sddm.conf.d/ echo "File /etc/sddm.conf.d/sddm.conf updated." current_wallpaper=$(cat "$cache_file") extension="${current_wallpaper##*.}" -sudo cp $current_wallpaper /usr/share/sddm/themes/sugar-candy/Backgrounds/current_wallpaper.$extension +sudo cp "$current_wallpaper" /usr/share/sddm/themes/sugar-candy/Backgrounds/current_wallpaper."$extension" echo "Current wallpaper copied into /usr/share/sddm/themes/sugar-candy/Backgrounds/" -new_wall=$(echo $current_wallpaper | sed "s|$HOME/wallpaper/||g") -sudo cp $HOME/.config/ml4w/sddm/theme.conf /usr/share/sddm/themes/sugar-candy/ +new_wall=$(echo "$current_wallpaper" | sed "s|$HOME/wallpaper/||g") +sudo cp "$HOME"/.config/ml4w/sddm/theme.conf /usr/share/sddm/themes/sugar-candy/ sudo sed -i 's/CURRENTWALLPAPER/'"current_wallpaper.$extension"'/' /usr/share/sddm/themes/sugar-candy/theme.conf echo "File theme.conf updated in /usr/share/sddm/themes/sugar-candy/" diff --git a/share/dotfiles/.config/ml4w/settings/ai.sh b/share/dotfiles/.config/ml4w/settings/ai.sh index 74e24998..89cd1819 100755 --- a/share/dotfiles/.config/ml4w/settings/ai.sh +++ b/share/dotfiles/.config/ml4w/settings/ai.sh @@ -1 +1 @@ -$(cat ~/.config/ml4w/settings/browser.sh) --new-window https://chat.openai.com \ No newline at end of file +$(cat ~/.config/ml4w/settings/browser.sh) --new-window https://chat.openai.com diff --git a/share/dotfiles/.config/ml4w/settings/aur.sh b/share/dotfiles/.config/ml4w/settings/aur.sh index fc0e7cbd..8435ed0f 100644 --- a/share/dotfiles/.config/ml4w/settings/aur.sh +++ b/share/dotfiles/.config/ml4w/settings/aur.sh @@ -1 +1 @@ -yay \ No newline at end of file +yay diff --git a/share/dotfiles/.config/ml4w/settings/blur.sh b/share/dotfiles/.config/ml4w/settings/blur.sh index 4ffc9661..4b9a1dc1 100644 --- a/share/dotfiles/.config/ml4w/settings/blur.sh +++ b/share/dotfiles/.config/ml4w/settings/blur.sh @@ -1 +1 @@ -50x30 \ No newline at end of file +50x30 diff --git a/share/dotfiles/.config/ml4w/settings/calculator.sh b/share/dotfiles/.config/ml4w/settings/calculator.sh index 7321b2ef..088af963 100755 --- a/share/dotfiles/.config/ml4w/settings/calculator.sh +++ b/share/dotfiles/.config/ml4w/settings/calculator.sh @@ -1 +1 @@ -gnome-calculator \ No newline at end of file +gnome-calculator diff --git a/share/dotfiles/.config/ml4w/settings/dotfiles-folder.sh b/share/dotfiles/.config/ml4w/settings/dotfiles-folder.sh index 18e16501..25be2ebb 100644 --- a/share/dotfiles/.config/ml4w/settings/dotfiles-folder.sh +++ b/share/dotfiles/.config/ml4w/settings/dotfiles-folder.sh @@ -1 +1 @@ -dotfiles \ No newline at end of file +dotfiles diff --git a/share/dotfiles/.config/ml4w/settings/dunst_position.sh b/share/dotfiles/.config/ml4w/settings/dunst_position.sh index 181d3ca3..600cd503 100644 --- a/share/dotfiles/.config/ml4w/settings/dunst_position.sh +++ b/share/dotfiles/.config/ml4w/settings/dunst_position.sh @@ -1 +1 @@ -top-center \ No newline at end of file +top-center diff --git a/share/dotfiles/.config/ml4w/settings/editor.sh b/share/dotfiles/.config/ml4w/settings/editor.sh index 4bb243e5..a3163dcb 100755 --- a/share/dotfiles/.config/ml4w/settings/editor.sh +++ b/share/dotfiles/.config/ml4w/settings/editor.sh @@ -1 +1 @@ -gnome-text-editor \ No newline at end of file +gnome-text-editor diff --git a/share/dotfiles/.config/ml4w/settings/emojipicker.sh b/share/dotfiles/.config/ml4w/settings/emojipicker.sh index 36d697f0..0bf212f8 100755 --- a/share/dotfiles/.config/ml4w/settings/emojipicker.sh +++ b/share/dotfiles/.config/ml4w/settings/emojipicker.sh @@ -1 +1 @@ -smile \ No newline at end of file +smile diff --git a/share/dotfiles/.config/ml4w/settings/eww-monitor.sh b/share/dotfiles/.config/ml4w/settings/eww-monitor.sh index 4d18c3e5..865faf10 100755 --- a/share/dotfiles/.config/ml4w/settings/eww-monitor.sh +++ b/share/dotfiles/.config/ml4w/settings/eww-monitor.sh @@ -1 +1 @@ -auto \ No newline at end of file +auto diff --git a/share/dotfiles/.config/ml4w/settings/filemanager.sh b/share/dotfiles/.config/ml4w/settings/filemanager.sh index 9f0175d6..87a2487f 100755 --- a/share/dotfiles/.config/ml4w/settings/filemanager.sh +++ b/share/dotfiles/.config/ml4w/settings/filemanager.sh @@ -1 +1 @@ -nautilus \ No newline at end of file +nautilus diff --git a/share/dotfiles/.config/ml4w/settings/hypridle_dpms_timeout.sh b/share/dotfiles/.config/ml4w/settings/hypridle_dpms_timeout.sh index 9ecf2719..e250077b 100644 --- a/share/dotfiles/.config/ml4w/settings/hypridle_dpms_timeout.sh +++ b/share/dotfiles/.config/ml4w/settings/hypridle_dpms_timeout.sh @@ -1 +1 @@ -660 \ No newline at end of file +660 diff --git a/share/dotfiles/.config/ml4w/settings/hypridle_hyprlock_timeout.sh b/share/dotfiles/.config/ml4w/settings/hypridle_hyprlock_timeout.sh index 73623d10..e9f960cf 100644 --- a/share/dotfiles/.config/ml4w/settings/hypridle_hyprlock_timeout.sh +++ b/share/dotfiles/.config/ml4w/settings/hypridle_hyprlock_timeout.sh @@ -1 +1 @@ -600 \ No newline at end of file +600 diff --git a/share/dotfiles/.config/ml4w/settings/hypridle_suspend_timeout.sh b/share/dotfiles/.config/ml4w/settings/hypridle_suspend_timeout.sh index 2974009f..bb08106d 100644 --- a/share/dotfiles/.config/ml4w/settings/hypridle_suspend_timeout.sh +++ b/share/dotfiles/.config/ml4w/settings/hypridle_suspend_timeout.sh @@ -1 +1 @@ -1800 \ No newline at end of file +1800 diff --git a/share/dotfiles/.config/ml4w/settings/hyprshade.sh b/share/dotfiles/.config/ml4w/settings/hyprshade.sh index c0cdbd81..5356fc8f 100644 --- a/share/dotfiles/.config/ml4w/settings/hyprshade.sh +++ b/share/dotfiles/.config/ml4w/settings/hyprshade.sh @@ -1 +1 @@ -hyprshade_filter="blue-light-filter" \ No newline at end of file +hyprshade_filter="blue-light-filter" diff --git a/share/dotfiles/.config/ml4w/settings/networkmanager.sh b/share/dotfiles/.config/ml4w/settings/networkmanager.sh index f3d88046..46435239 100755 --- a/share/dotfiles/.config/ml4w/settings/networkmanager.sh +++ b/share/dotfiles/.config/ml4w/settings/networkmanager.sh @@ -1 +1 @@ -nm-connection-editor \ No newline at end of file +nm-connection-editor diff --git a/share/dotfiles/.config/ml4w/settings/printer-drivers.sh b/share/dotfiles/.config/ml4w/settings/printer-drivers.sh index 444839f5..5e6e92d4 100644 --- a/share/dotfiles/.config/ml4w/settings/printer-drivers.sh +++ b/share/dotfiles/.config/ml4w/settings/printer-drivers.sh @@ -1,4 +1,4 @@ # Installation of Printer Drivers # Please add your drivers to the package list -# Example: -# yay -S brother-hll2360dw-lpr-bin brother-hll2360dw-cups-bin brother-mfc-l3770cdw brscan-skey brscan4 skanpage \ No newline at end of file +# Example: +# yay -S brother-hll2360dw-lpr-bin brother-hll2360dw-cups-bin brother-mfc-l3770cdw brscan-skey brscan4 skanpage diff --git a/share/dotfiles/.config/ml4w/settings/rofi_bordersize.sh b/share/dotfiles/.config/ml4w/settings/rofi_bordersize.sh index e440e5c8..00750edc 100644 --- a/share/dotfiles/.config/ml4w/settings/rofi_bordersize.sh +++ b/share/dotfiles/.config/ml4w/settings/rofi_bordersize.sh @@ -1 +1 @@ -3 \ No newline at end of file +3 diff --git a/share/dotfiles/.config/ml4w/settings/screenshot-editor.sh b/share/dotfiles/.config/ml4w/settings/screenshot-editor.sh index 5f0900f7..2c6baaf4 100644 --- a/share/dotfiles/.config/ml4w/settings/screenshot-editor.sh +++ b/share/dotfiles/.config/ml4w/settings/screenshot-editor.sh @@ -1 +1 @@ -pinta \ No newline at end of file +pinta diff --git a/share/dotfiles/.config/ml4w/settings/screenshot-filename.sh b/share/dotfiles/.config/ml4w/settings/screenshot-filename.sh index f81ad3c9..631032b7 100644 --- a/share/dotfiles/.config/ml4w/settings/screenshot-filename.sh +++ b/share/dotfiles/.config/ml4w/settings/screenshot-filename.sh @@ -1 +1 @@ -NAME="screenshot_$(date +%d%m%Y_%H%M%S).jpg" \ No newline at end of file +NAME="screenshot_$(date +%d%m%Y_%H%M%S).jpg" diff --git a/share/dotfiles/.config/ml4w/settings/screenshot-folder.sh b/share/dotfiles/.config/ml4w/settings/screenshot-folder.sh index a1bf8219..b0ad84c4 100644 --- a/share/dotfiles/.config/ml4w/settings/screenshot-folder.sh +++ b/share/dotfiles/.config/ml4w/settings/screenshot-folder.sh @@ -1 +1 @@ -screenshot_folder="$HOME/Pictures" \ No newline at end of file +screenshot_folder="$HOME/Pictures" diff --git a/share/dotfiles/.config/ml4w/settings/software.sh b/share/dotfiles/.config/ml4w/settings/software.sh index d10bc376..8ebf8cfb 100755 --- a/share/dotfiles/.config/ml4w/settings/software.sh +++ b/share/dotfiles/.config/ml4w/settings/software.sh @@ -1 +1 @@ -$(cat ~/.config/ml4w/settings/terminal.sh) --class dotfiles-floating -e pacseek \ No newline at end of file +$(cat ~/.config/ml4w/settings/terminal.sh) --class dotfiles-floating -e pacseek diff --git a/share/dotfiles/.config/ml4w/settings/systeminfo.sh b/share/dotfiles/.config/ml4w/settings/systeminfo.sh index b3100a6a..5d8864cc 100755 --- a/share/dotfiles/.config/ml4w/settings/systeminfo.sh +++ b/share/dotfiles/.config/ml4w/settings/systeminfo.sh @@ -1 +1 @@ -missioncenter \ No newline at end of file +missioncenter diff --git a/share/dotfiles/.config/ml4w/settings/terminal.sh b/share/dotfiles/.config/ml4w/settings/terminal.sh index f681b820..7997ddcf 100755 --- a/share/dotfiles/.config/ml4w/settings/terminal.sh +++ b/share/dotfiles/.config/ml4w/settings/terminal.sh @@ -1 +1 @@ -alacritty \ No newline at end of file +alacritty diff --git a/share/dotfiles/.config/ml4w/settings/wallpaper-automation.sh b/share/dotfiles/.config/ml4w/settings/wallpaper-automation.sh index 2b82dfea..abdfb053 100644 --- a/share/dotfiles/.config/ml4w/settings/wallpaper-automation.sh +++ b/share/dotfiles/.config/ml4w/settings/wallpaper-automation.sh @@ -1 +1 @@ -60 \ No newline at end of file +60 diff --git a/share/dotfiles/.config/ml4w/settings/wallpaper-engine.sh b/share/dotfiles/.config/ml4w/settings/wallpaper-engine.sh index b6923b69..a125327d 100644 --- a/share/dotfiles/.config/ml4w/settings/wallpaper-engine.sh +++ b/share/dotfiles/.config/ml4w/settings/wallpaper-engine.sh @@ -1 +1 @@ -hyprpaper \ No newline at end of file +hyprpaper diff --git a/share/dotfiles/.config/ml4w/settings/wallpaper-folder.sh b/share/dotfiles/.config/ml4w/settings/wallpaper-folder.sh index 8d138d11..c3c69706 100644 --- a/share/dotfiles/.config/ml4w/settings/wallpaper-folder.sh +++ b/share/dotfiles/.config/ml4w/settings/wallpaper-folder.sh @@ -1,2 +1,2 @@ # Enter the path to the folder that includes your wallpapers -wallpaper_folder=$HOME/wallpaper \ No newline at end of file +wallpaper_folder=$HOME/wallpaper diff --git a/share/dotfiles/.config/ml4w/settings/waybar_appmenu.sh b/share/dotfiles/.config/ml4w/settings/waybar_appmenu.sh index 4791ed55..0ca95142 100644 --- a/share/dotfiles/.config/ml4w/settings/waybar_appmenu.sh +++ b/share/dotfiles/.config/ml4w/settings/waybar_appmenu.sh @@ -1 +1 @@ -True \ No newline at end of file +True diff --git a/share/dotfiles/.config/ml4w/settings/waybar_backlight.sh b/share/dotfiles/.config/ml4w/settings/waybar_backlight.sh index c1f22fbc..bc59c12a 100644 --- a/share/dotfiles/.config/ml4w/settings/waybar_backlight.sh +++ b/share/dotfiles/.config/ml4w/settings/waybar_backlight.sh @@ -1 +1 @@ -False \ No newline at end of file +False diff --git a/share/dotfiles/.config/ml4w/settings/waybar_chatgpt.sh b/share/dotfiles/.config/ml4w/settings/waybar_chatgpt.sh index 4791ed55..0ca95142 100644 --- a/share/dotfiles/.config/ml4w/settings/waybar_chatgpt.sh +++ b/share/dotfiles/.config/ml4w/settings/waybar_chatgpt.sh @@ -1 +1 @@ -True \ No newline at end of file +True diff --git a/share/dotfiles/.config/ml4w/settings/waybar_custom_timedateformat.sh b/share/dotfiles/.config/ml4w/settings/waybar_custom_timedateformat.sh index e69de29b..8b137891 100644 --- a/share/dotfiles/.config/ml4w/settings/waybar_custom_timedateformat.sh +++ b/share/dotfiles/.config/ml4w/settings/waybar_custom_timedateformat.sh @@ -0,0 +1 @@ + diff --git a/share/dotfiles/.config/ml4w/settings/waybar_dateformat.sh b/share/dotfiles/.config/ml4w/settings/waybar_dateformat.sh index 05696faf..4370a318 100644 --- a/share/dotfiles/.config/ml4w/settings/waybar_dateformat.sh +++ b/share/dotfiles/.config/ml4w/settings/waybar_dateformat.sh @@ -1 +1 @@ -%a \ No newline at end of file +%a diff --git a/share/dotfiles/.config/ml4w/settings/waybar_network.sh b/share/dotfiles/.config/ml4w/settings/waybar_network.sh index 4791ed55..0ca95142 100644 --- a/share/dotfiles/.config/ml4w/settings/waybar_network.sh +++ b/share/dotfiles/.config/ml4w/settings/waybar_network.sh @@ -1 +1 @@ -True \ No newline at end of file +True diff --git a/share/dotfiles/.config/ml4w/settings/waybar_quicklinks.sh b/share/dotfiles/.config/ml4w/settings/waybar_quicklinks.sh index 4791ed55..0ca95142 100644 --- a/share/dotfiles/.config/ml4w/settings/waybar_quicklinks.sh +++ b/share/dotfiles/.config/ml4w/settings/waybar_quicklinks.sh @@ -1 +1 @@ -True \ No newline at end of file +True diff --git a/share/dotfiles/.config/ml4w/settings/waybar_screenlock.sh b/share/dotfiles/.config/ml4w/settings/waybar_screenlock.sh index 4791ed55..0ca95142 100644 --- a/share/dotfiles/.config/ml4w/settings/waybar_screenlock.sh +++ b/share/dotfiles/.config/ml4w/settings/waybar_screenlock.sh @@ -1 +1 @@ -True \ No newline at end of file +True diff --git a/share/dotfiles/.config/ml4w/settings/waybar_systray.sh b/share/dotfiles/.config/ml4w/settings/waybar_systray.sh index 4791ed55..0ca95142 100644 --- a/share/dotfiles/.config/ml4w/settings/waybar_systray.sh +++ b/share/dotfiles/.config/ml4w/settings/waybar_systray.sh @@ -1 +1 @@ -True \ No newline at end of file +True diff --git a/share/dotfiles/.config/ml4w/settings/waybar_taskbar.sh b/share/dotfiles/.config/ml4w/settings/waybar_taskbar.sh index c1f22fbc..bc59c12a 100644 --- a/share/dotfiles/.config/ml4w/settings/waybar_taskbar.sh +++ b/share/dotfiles/.config/ml4w/settings/waybar_taskbar.sh @@ -1 +1 @@ -False \ No newline at end of file +False diff --git a/share/dotfiles/.config/ml4w/settings/waybar_timeformat.sh b/share/dotfiles/.config/ml4w/settings/waybar_timeformat.sh index 3d87f122..e2c888b0 100644 --- a/share/dotfiles/.config/ml4w/settings/waybar_timeformat.sh +++ b/share/dotfiles/.config/ml4w/settings/waybar_timeformat.sh @@ -1 +1 @@ -%H:%M \ No newline at end of file +%H:%M diff --git a/share/dotfiles/.config/ml4w/settings/waybar_toggle.sh b/share/dotfiles/.config/ml4w/settings/waybar_toggle.sh index 4791ed55..0ca95142 100644 --- a/share/dotfiles/.config/ml4w/settings/waybar_toggle.sh +++ b/share/dotfiles/.config/ml4w/settings/waybar_toggle.sh @@ -1 +1 @@ -True \ No newline at end of file +True diff --git a/share/dotfiles/.config/ml4w/settings/waybar_window.sh b/share/dotfiles/.config/ml4w/settings/waybar_window.sh index 4791ed55..0ca95142 100644 --- a/share/dotfiles/.config/ml4w/settings/waybar_window.sh +++ b/share/dotfiles/.config/ml4w/settings/waybar_window.sh @@ -1 +1 @@ -True \ No newline at end of file +True diff --git a/share/dotfiles/.config/ml4w/settings/waybar_workspaces.sh b/share/dotfiles/.config/ml4w/settings/waybar_workspaces.sh index 7813681f..7ed6ff82 100644 --- a/share/dotfiles/.config/ml4w/settings/waybar_workspaces.sh +++ b/share/dotfiles/.config/ml4w/settings/waybar_workspaces.sh @@ -1 +1 @@ -5 \ No newline at end of file +5 diff --git a/share/dotfiles/.config/ml4w/version/compare.sh b/share/dotfiles/.config/ml4w/version/compare.sh index 1b18b984..8a7cd535 100755 --- a/share/dotfiles/.config/ml4w/version/compare.sh +++ b/share/dotfiles/.config/ml4w/version/compare.sh @@ -5,10 +5,10 @@ source ~/.config/ml4w/version/library.sh -if [ -f /usr/share/ml4w-hyprland/dotfiles/.config/ml4w/version/name ] ;then +if [ -f /usr/share/ml4w-hyprland/dotfiles/.config/ml4w/version/name ]; then installed_version=$(cat /usr/share/ml4w-hyprland/dotfiles/.config/ml4w/version/name) used_version=$(cat ~/.config/ml4w/version/name) - if [[ $(testvercomp $used_version $installed_version "<") == "0" ]] ;then - notify-send "Please run ml4w-hyprland-setup" "Installed version is newer then the version you're currently using." + if [[ $(testvercomp "$used_version" "$installed_version" "<") == "0" ]]; then + notify-send "Please run ml4w-hyprland-setup" "Installed version is newer then the version you're currently using." fi fi diff --git a/share/dotfiles/.config/ml4w/version/library.sh b/share/dotfiles/.config/ml4w/version/library.sh index 94e5fbee..415fa7cf 100644 --- a/share/dotfiles/.config/ml4w/version/library.sh +++ b/share/dotfiles/.config/ml4w/version/library.sh @@ -1,42 +1,36 @@ -vercomp () { - if [[ $1 == $2 ]] - then +vercomp() { + if [[ $1 == $2 ]]; then return 0 fi local IFS=. local i ver1=($1) ver2=($2) # fill empty fields in ver1 with zeros - for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)) - do + for ((i = ${#ver1[@]}; i < ${#ver2[@]}; i++)); do ver1[i]=0 done - for ((i=0; i<${#ver1[@]}; i++)) - do - if ((10#${ver1[i]:=0} > 10#${ver2[i]:=0})) - then + for ((i = 0; i < ${#ver1[@]}; i++)); do + if ((10#${ver1[i]:=0} > 10#${ver2[i]:=0})); then return 1 fi - if ((10#${ver1[i]} < 10#${ver2[i]})) - then + if ((10#${ver1[i]} < 10#${ver2[i]})); then return 2 fi done return 0 } -testvercomp () { - vercomp $1 $2 +testvercomp() { + vercomp "$1" "$2" case $? in - 0) op='=';; - 1) op='>';; - 2) op='<';; + 0) op='=' ;; + 1) op='>' ;; + 2) op='<' ;; esac - if [[ $op != $3 ]] - then + if [[ $op != $3 ]]; then # No update available echo "1" else # Update available echo "0" fi -} \ No newline at end of file +} diff --git a/share/dotfiles/.config/ml4w/version/update.sh b/share/dotfiles/.config/ml4w/version/update.sh index efe94039..a5dfb93a 100755 --- a/share/dotfiles/.config/ml4w/version/update.sh +++ b/share/dotfiles/.config/ml4w/version/update.sh @@ -8,8 +8,8 @@ source ~/.config/ml4w/version/library.sh # Get latest tag from GitHub get_latest_release() { v_online=$(curl --silent "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=ml4w-hyprland") - v_full_online=$(grep -m 1 'pkgver' <<< $v_online | sed 's/^$/pkgver/') - echo ${v_full_online/pkgver=/} + v_full_online=$(grep -m 1 'pkgver' <<<"$v_online" | sed 's/^$/pkgver/') + echo "${v_full_online/pkgver=/}" } # Check for internet connection @@ -17,9 +17,9 @@ if ping -q -c 1 -W 1 google.com >/dev/null; then version=$(cat ~/.config/ml4w/version/name) online=$(get_latest_release "mylinuxforwork/hyprland-dotfiles") - echo $version "<" $online - testvercomp $version $online "<" + echo "$version" "<" "$online" + testvercomp "$version" "$online" "<" else # Network is down echo "1" -fi \ No newline at end of file +fi diff --git a/share/dotfiles/.config/waybar/launch.sh b/share/dotfiles/.config/waybar/launch.sh index b6d5e052..3a787d45 100755 --- a/share/dotfiles/.config/waybar/launch.sh +++ b/share/dotfiles/.config/waybar/launch.sh @@ -1,61 +1,61 @@ #!/bin/bash -# ____ _ _ __ __ _ -# / ___|| |_ __ _ _ __| |_ \ \ / /_ _ _ _| |__ __ _ _ __ -# \___ \| __/ _` | '__| __| \ \ /\ / / _` | | | | '_ \ / _` | '__| -# ___) | || (_| | | | |_ \ V V / (_| | |_| | |_) | (_| | | -# |____/ \__\__,_|_| \__| \_/\_/ \__,_|\__, |_.__/ \__,_|_| -# |___/ -# by Stephan Raabe (2023) -# ----------------------------------------------------- +# ____ _ _ __ __ _ +# / ___|| |_ __ _ _ __| |_ \ \ / /_ _ _ _| |__ __ _ _ __ +# \___ \| __/ _` | '__| __| \ \ /\ / / _` | | | | '_ \ / _` | '__| +# ___) | || (_| | | | |_ \ V V / (_| | |_| | |_) | (_| | | +# |____/ \__\__,_|_| \__| \_/\_/ \__,_|\__, |_.__/ \__,_|_| +# |___/ +# by Stephan Raabe (2023) +# ----------------------------------------------------- # Check if waybar-disabled file exists -if [ -f $HOME/.cache/waybar-disabled ] ;then +if [ -f "$HOME"/.cache/waybar-disabled ]; then killall waybar pkill waybar - exit 1 + exit 1 fi -# ----------------------------------------------------- +# ----------------------------------------------------- # Quit all running waybar instances -# ----------------------------------------------------- +# ----------------------------------------------------- killall waybar pkill waybar sleep 0.5 -# ----------------------------------------------------- +# ----------------------------------------------------- # Default theme: /THEMEFOLDER;/VARIATION -# ----------------------------------------------------- +# ----------------------------------------------------- themestyle="/ml4w-blur;/ml4w-blur/white" -# ----------------------------------------------------- +# ----------------------------------------------------- # Get current theme information from ~/.config/ml4w/settings/waybar-theme.sh -# ----------------------------------------------------- +# ----------------------------------------------------- if [ -f ~/.config/ml4w/settings/waybar-theme.sh ]; then themestyle=$(cat ~/.config/ml4w/settings/waybar-theme.sh) else touch ~/.config/ml4w/settings/waybar-theme.sh - echo "$themestyle" > ~/.config/ml4w/settings/waybar-theme.sh + echo "$themestyle" >~/.config/ml4w/settings/waybar-theme.sh fi -IFS=';' read -ra arrThemes <<< "$themestyle" +IFS=';' read -ra arrThemes <<<"$themestyle" echo ":: Theme: ${arrThemes[0]}" -if [ ! -f ~/.config/waybar/themes${arrThemes[1]}/style.css ]; then +if [ ! -f ~/.config/waybar/themes"${arrThemes[1]}"/style.css ]; then themestyle="/ml4w;/ml4w/light" fi -# ----------------------------------------------------- +# ----------------------------------------------------- # Loading the configuration -# ----------------------------------------------------- +# ----------------------------------------------------- config_file="config" style_file="style.css" # Standard files can be overwritten with an existing config-custom or style-custom.css -if [ -f ~/.config/waybar/themes${arrThemes[0]}/config-custom ] ;then +if [ -f ~/.config/waybar/themes"${arrThemes[0]}"/config-custom ]; then config_file="config-custom" fi -if [ -f ~/.config/waybar/themes${arrThemes[1]}/style-custom.css ] ;then +if [ -f ~/.config/waybar/themes"${arrThemes[1]}"/style-custom.css ]; then style_file="style-custom.css" fi -waybar -c ~/.config/waybar/themes${arrThemes[0]}/$config_file -s ~/.config/waybar/themes${arrThemes[1]}/$style_file & +waybar -c ~/.config/waybar/themes"${arrThemes[0]}"/$config_file -s ~/.config/waybar/themes"${arrThemes[1]}"/$style_file & diff --git a/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/black/config.sh b/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/black/config.sh index cea609a5..a803bf87 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/black/config.sh +++ b/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/black/config.sh @@ -1,2 +1,2 @@ #!/bin/bash -theme_name="ML4W Blur Bottom Black" \ No newline at end of file +theme_name="ML4W Blur Bottom Black" diff --git a/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/colored/config.sh b/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/colored/config.sh index 7f55337e..27dfe8ab 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/colored/config.sh +++ b/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/colored/config.sh @@ -1,2 +1,2 @@ #!/bin/bash -theme_name="ML4W Blur Bottom Colored" \ No newline at end of file +theme_name="ML4W Blur Bottom Colored" diff --git a/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/dark/config.sh b/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/dark/config.sh index df6f8c24..f6670411 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/dark/config.sh +++ b/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/dark/config.sh @@ -1,2 +1,2 @@ #!/bin/bash -theme_name="ML4W Blur Bottom Dark" \ No newline at end of file +theme_name="ML4W Blur Bottom Dark" diff --git a/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/mixed/config.sh b/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/mixed/config.sh index dea299a5..d0c2d85c 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/mixed/config.sh +++ b/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/mixed/config.sh @@ -1,2 +1,2 @@ #!/bin/bash -theme_name="ML4W Blur Bottom Mixed" \ No newline at end of file +theme_name="ML4W Blur Bottom Mixed" diff --git a/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/white/config.sh b/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/white/config.sh index 15926540..9d10b474 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/white/config.sh +++ b/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/white/config.sh @@ -1,2 +1,2 @@ #!/bin/bash -theme_name="ML4W Blur Bottom White" \ No newline at end of file +theme_name="ML4W Blur Bottom White" diff --git a/share/dotfiles/.config/waybar/themes/ml4w-blur/black/config.sh b/share/dotfiles/.config/waybar/themes/ml4w-blur/black/config.sh index 5c6fb05d..03a3259d 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w-blur/black/config.sh +++ b/share/dotfiles/.config/waybar/themes/ml4w-blur/black/config.sh @@ -1,2 +1,2 @@ #!/bin/bash -theme_name="ML4W Blur Black" \ No newline at end of file +theme_name="ML4W Blur Black" diff --git a/share/dotfiles/.config/waybar/themes/ml4w-blur/colored/config.sh b/share/dotfiles/.config/waybar/themes/ml4w-blur/colored/config.sh index 7338fefa..2d91607e 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w-blur/colored/config.sh +++ b/share/dotfiles/.config/waybar/themes/ml4w-blur/colored/config.sh @@ -1,2 +1,2 @@ #!/bin/bash -theme_name="ML4W Blur Colored" \ No newline at end of file +theme_name="ML4W Blur Colored" diff --git a/share/dotfiles/.config/waybar/themes/ml4w-blur/dark/config.sh b/share/dotfiles/.config/waybar/themes/ml4w-blur/dark/config.sh index a3b9e884..08706be6 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w-blur/dark/config.sh +++ b/share/dotfiles/.config/waybar/themes/ml4w-blur/dark/config.sh @@ -1,2 +1,2 @@ #!/bin/bash -theme_name="ML4W Blur Dark" \ No newline at end of file +theme_name="ML4W Blur Dark" diff --git a/share/dotfiles/.config/waybar/themes/ml4w-blur/mixed/config.sh b/share/dotfiles/.config/waybar/themes/ml4w-blur/mixed/config.sh index eb698ad2..1b8d9e57 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w-blur/mixed/config.sh +++ b/share/dotfiles/.config/waybar/themes/ml4w-blur/mixed/config.sh @@ -1,2 +1,2 @@ #!/bin/bash -theme_name="ML4W Blur Mixed" \ No newline at end of file +theme_name="ML4W Blur Mixed" diff --git a/share/dotfiles/.config/waybar/themes/ml4w-blur/white/config.sh b/share/dotfiles/.config/waybar/themes/ml4w-blur/white/config.sh index e458b191..69c38b69 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w-blur/white/config.sh +++ b/share/dotfiles/.config/waybar/themes/ml4w-blur/white/config.sh @@ -1,2 +1,2 @@ #!/bin/bash -theme_name="ML4W Blur White" \ No newline at end of file +theme_name="ML4W Blur White" diff --git a/share/dotfiles/.config/waybar/themes/ml4w-bottom/black/config.sh b/share/dotfiles/.config/waybar/themes/ml4w-bottom/black/config.sh index 5837eb62..0b29e4d2 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w-bottom/black/config.sh +++ b/share/dotfiles/.config/waybar/themes/ml4w-bottom/black/config.sh @@ -1,2 +1,2 @@ #!/bin/bash -theme_name="ML4W Black Bottom" \ No newline at end of file +theme_name="ML4W Black Bottom" diff --git a/share/dotfiles/.config/waybar/themes/ml4w-bottom/colored/config.sh b/share/dotfiles/.config/waybar/themes/ml4w-bottom/colored/config.sh index 0a31bac4..2cb45d7c 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w-bottom/colored/config.sh +++ b/share/dotfiles/.config/waybar/themes/ml4w-bottom/colored/config.sh @@ -1,2 +1,2 @@ #!/bin/bash -theme_name="ML4W Colored Bottom" \ No newline at end of file +theme_name="ML4W Colored Bottom" diff --git a/share/dotfiles/.config/waybar/themes/ml4w-bottom/dark/config.sh b/share/dotfiles/.config/waybar/themes/ml4w-bottom/dark/config.sh index a6fe8ff9..710d701a 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w-bottom/dark/config.sh +++ b/share/dotfiles/.config/waybar/themes/ml4w-bottom/dark/config.sh @@ -1,2 +1,2 @@ #!/bin/bash -theme_name="ML4W Dark Bottom" \ No newline at end of file +theme_name="ML4W Dark Bottom" diff --git a/share/dotfiles/.config/waybar/themes/ml4w-bottom/light/config.sh b/share/dotfiles/.config/waybar/themes/ml4w-bottom/light/config.sh index e016502f..660d324f 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w-bottom/light/config.sh +++ b/share/dotfiles/.config/waybar/themes/ml4w-bottom/light/config.sh @@ -1,2 +1,2 @@ #!/bin/bash -theme_name="ML4W Light Bottom" \ No newline at end of file +theme_name="ML4W Light Bottom" diff --git a/share/dotfiles/.config/waybar/themes/ml4w-bottom/mixed/config.sh b/share/dotfiles/.config/waybar/themes/ml4w-bottom/mixed/config.sh index e5bc67e5..b5b1e5e0 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w-bottom/mixed/config.sh +++ b/share/dotfiles/.config/waybar/themes/ml4w-bottom/mixed/config.sh @@ -1,2 +1,2 @@ #!/bin/bash -theme_name="ML4W Mixed Bottom" \ No newline at end of file +theme_name="ML4W Mixed Bottom" diff --git a/share/dotfiles/.config/waybar/themes/ml4w-bottom/white/config.sh b/share/dotfiles/.config/waybar/themes/ml4w-bottom/white/config.sh index 71dd9f56..7123a8ae 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w-bottom/white/config.sh +++ b/share/dotfiles/.config/waybar/themes/ml4w-bottom/white/config.sh @@ -1,2 +1,2 @@ #!/bin/bash -theme_name="ML4W White Bottom" \ No newline at end of file +theme_name="ML4W White Bottom" diff --git a/share/dotfiles/.config/waybar/themes/ml4w/black/config.sh b/share/dotfiles/.config/waybar/themes/ml4w/black/config.sh index 39e19cb2..6b8344d8 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w/black/config.sh +++ b/share/dotfiles/.config/waybar/themes/ml4w/black/config.sh @@ -1,2 +1,2 @@ #!/bin/bash -theme_name="ML4W Black" \ No newline at end of file +theme_name="ML4W Black" diff --git a/share/dotfiles/.config/waybar/themes/ml4w/colored/config.sh b/share/dotfiles/.config/waybar/themes/ml4w/colored/config.sh index 25dbee71..3dc144c9 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w/colored/config.sh +++ b/share/dotfiles/.config/waybar/themes/ml4w/colored/config.sh @@ -1,2 +1,2 @@ #!/bin/bash -theme_name="ML4W Colored" \ No newline at end of file +theme_name="ML4W Colored" diff --git a/share/dotfiles/.config/waybar/themes/ml4w/dark/config.sh b/share/dotfiles/.config/waybar/themes/ml4w/dark/config.sh index 6c2cf9f6..3015b37f 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w/dark/config.sh +++ b/share/dotfiles/.config/waybar/themes/ml4w/dark/config.sh @@ -1,2 +1,2 @@ #!/bin/bash -theme_name="ML4W Dark" \ No newline at end of file +theme_name="ML4W Dark" diff --git a/share/dotfiles/.config/waybar/themes/ml4w/mixed/config.sh b/share/dotfiles/.config/waybar/themes/ml4w/mixed/config.sh index c00e2317..14b339bb 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w/mixed/config.sh +++ b/share/dotfiles/.config/waybar/themes/ml4w/mixed/config.sh @@ -1,2 +1,2 @@ #!/bin/bash -theme_name="ML4W Mixed" \ No newline at end of file +theme_name="ML4W Mixed" diff --git a/share/dotfiles/.config/waybar/themes/ml4w/white/config.sh b/share/dotfiles/.config/waybar/themes/ml4w/white/config.sh index 685088fb..b688e46c 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w/white/config.sh +++ b/share/dotfiles/.config/waybar/themes/ml4w/white/config.sh @@ -1,2 +1,2 @@ #!/bin/bash -theme_name="ML4W White" \ No newline at end of file +theme_name="ML4W White" diff --git a/share/dotfiles/.config/waybar/themeswitcher.sh b/share/dotfiles/.config/waybar/themeswitcher.sh index f3e47349..dd90f01c 100755 --- a/share/dotfiles/.config/waybar/themeswitcher.sh +++ b/share/dotfiles/.config/waybar/themeswitcher.sh @@ -1,40 +1,39 @@ #!/bin/bash -# _____ _ _ _ _ -# |_ _| |__ ___ _ __ ___ ___ _____ _(_) |_ ___| |__ ___ _ __ -# | | | '_ \ / _ \ '_ ` _ \ / _ \/ __\ \ /\ / / | __/ __| '_ \ / _ \ '__| -# | | | | | | __/ | | | | | __/\__ \\ V V /| | || (__| | | | __/ | -# |_| |_| |_|\___|_| |_| |_|\___||___/ \_/\_/ |_|\__\___|_| |_|\___|_| -# -# by Stephan Raabe (2024) -# ----------------------------------------------------- +# _____ _ _ _ _ +# |_ _| |__ ___ _ __ ___ ___ _____ _(_) |_ ___| |__ ___ _ __ +# | | | '_ \ / _ \ '_ ` _ \ / _ \/ __\ \ /\ / / | __/ __| '_ \ / _ \ '__| +# | | | | | | __/ | | | | | __/\__ \\ V V /| | || (__| | | | __/ | +# |_| |_| |_|\___|_| |_| |_|\___||___/ \_/\_/ |_|\__\___|_| |_|\___|_| +# +# by Stephan Raabe (2024) +# ----------------------------------------------------- -# ----------------------------------------------------- +# ----------------------------------------------------- # Default theme folder -# ----------------------------------------------------- +# ----------------------------------------------------- themes_path="$HOME/.config/waybar/themes" -# ----------------------------------------------------- +# ----------------------------------------------------- # Initialize arrays -# ----------------------------------------------------- +# ----------------------------------------------------- listThemes="" listNames="" listNames2="" -# ----------------------------------------------------- +# ----------------------------------------------------- # Read theme folder # ----------------------------------------------------- -sleep 0.2 -options=$(find $themes_path -maxdepth 2 -type d) -for value in $options -do - if [ ! $value == "$HOME/.config/waybar/themes/assets" ]; then - if [ ! $value == "$themes_path" ]; then - if [ $(find $value -maxdepth 1 -type d | wc -l) = 1 ]; then - result=$(echo $value | sed "s#$HOME/.config/waybar/themes/#/#g") - IFS='/' read -ra arrThemes <<< "$result" +sleep 0.2 +options=$(find "$themes_path" -maxdepth 2 -type d) +for value in $options; do + if [ ! "$value" == "$HOME/.config/waybar/themes/assets" ]; then + if [ ! "$value" == "$themes_path" ]; then + if [ $(find "$value" -maxdepth 1 -type d | wc -l) = 1 ]; then + result=$(echo "$value" | sed "s#$HOME/.config/waybar/themes/#/#g") + IFS='/' read -ra arrThemes <<<"$result" listThemes[${#listThemes[@]}]="/${arrThemes[1]};$result" - if [ -f $themes_path$result/config.sh ]; then - source $themes_path$result/config.sh + if [ -f "$themes_path""$result"/config.sh ]; then + source "$themes_path""$result"/config.sh listNames+="$theme_name\n" listNames2+="$theme_name~" else @@ -46,21 +45,21 @@ do fi done -# ----------------------------------------------------- +# ----------------------------------------------------- # Show rofi dialog -# ----------------------------------------------------- +# ----------------------------------------------------- listNames=${listNames::-2} choice=$(echo -e "$listNames" | rofi -dmenu -replace -i -config ~/.config/rofi/config-themes.rasi -no-show-icons -width 30 -p "Themes" -format i) IFS="~" input=$listNames2 -read -ra array <<< "$input" +read -ra array <<<"$input" -# ----------------------------------------------------- +# ----------------------------------------------------- # Set new theme by writing the theme information to ~/.config/ml4w/settings/waybar-theme.sh -# ----------------------------------------------------- +# ----------------------------------------------------- if [ "$choice" ]; then echo "Loading waybar theme..." - echo "${listThemes[$choice+1]}" > ~/.config/ml4w/settings/waybar-theme.sh + echo "${listThemes[$choice + 1]}" >~/.config/ml4w/settings/waybar-theme.sh ~/.config/waybar/launch.sh notify-send "Waybar Theme changed" "to ${array[$choice]}" fi diff --git a/share/dotfiles/.config/waybar/toggle.sh b/share/dotfiles/.config/waybar/toggle.sh index 0d49a4ec..93227f15 100755 --- a/share/dotfiles/.config/waybar/toggle.sh +++ b/share/dotfiles/.config/waybar/toggle.sh @@ -1,13 +1,13 @@ #!/bin/bash -# _____ _ __ __ _ -# |_ _|__ __ _ __ _| | ___ \ \ / /_ _ _ _| |__ __ _ _ __ +# _____ _ __ __ _ +# |_ _|__ __ _ __ _| | ___ \ \ / /_ _ _ _| |__ __ _ _ __ # | |/ _ \ / _` |/ _` | |/ _ \ \ \ /\ / / _` | | | | '_ \ / _` | '__| -# | | (_) | (_| | (_| | | __/ \ V V / (_| | |_| | |_) | (_| | | -# |_|\___/ \__, |\__, |_|\___| \_/\_/ \__,_|\__, |_.__/ \__,_|_| -# |___/ |___/ |___/ +# | | (_) | (_| | (_| | | __/ \ V V / (_| | |_| | |_) | (_| | | +# |_|\___/ \__, |\__, |_|\___| \_/\_/ \__,_|\__, |_.__/ \__,_|_| +# |___/ |___/ |___/ # -if [ -f ~/.cache/waybar-disabled ] ;then +if [ -f ~/.cache/waybar-disabled ]; then rm ~/.cache/waybar-disabled else touch ~/.cache/waybar-disabled diff --git a/share/packages/general.sh b/share/packages/general.sh index 4f4c3ca2..207a029d 100644 --- a/share/packages/general.sh +++ b/share/packages/general.sh @@ -8,22 +8,22 @@ packagesPacman=( "neovim" "wget" "unzip" - "alacritty" - "dunst" + "alacritty" + "dunst" "starship" - "noto-fonts" - "otf-font-awesome" - "ttf-fira-sans" - "ttf-fira-code" - "ttf-firacode-nerd" - "figlet" - "vlc" - "eza" - "python-pip" + "noto-fonts" + "otf-font-awesome" + "ttf-fira-sans" + "ttf-fira-code" + "ttf-firacode-nerd" + "figlet" + "vlc" + "eza" + "python-pip" "python-pywal" "python-gobject" - "pavucontrol" - "tumbler" + "pavucontrol" + "tumbler" "papirus-icon-theme" "polkit-gnome" "brightnessctl" @@ -55,8 +55,8 @@ packagesPacman=( "fzf" "htop" "zsh-completions" -); +) packagesAUR=( - "bibata-cursor-theme" -); + "bibata-cursor-theme" +) diff --git a/share/packages/hyprland.sh b/share/packages/hyprland.sh index e16c62c3..f66ecc27 100644 --- a/share/packages/hyprland.sh +++ b/share/packages/hyprland.sh @@ -3,13 +3,13 @@ packagesPacman=( "hyprpaper" "hyprlock" "hypridle" - "xdg-desktop-portal-hyprland" - "waybar" - "grim" + "xdg-desktop-portal-hyprland" + "waybar" + "grim" "slurp" "cliphist" "nwg-look" -); +) packagesAUR=( "wlogout" @@ -17,4 +17,4 @@ packagesAUR=( "waypaper" "grimblast-git" "aylurs-gtk-shell" -); +) diff --git a/share/packages/optional.sh b/share/packages/optional.sh index 8a48cce3..1f765eb4 100755 --- a/share/packages/optional.sh +++ b/share/packages/optional.sh @@ -5,7 +5,7 @@ optdepends=( "smile" "breeze" "breeze-icons" - "mpv" + "mpv" "mission-center" "pacseek" -); \ No newline at end of file +) diff --git a/share/templates/autostart.sh b/share/templates/autostart.sh index a1851fcd..19684410 100755 --- a/share/templates/autostart.sh +++ b/share/templates/autostart.sh @@ -1,18 +1,18 @@ #!/bin/bash -# ___ _____ ___ _ _____ ____ _ _ -# / _ \_ _|_ _| | | ____| / ___|| |_ __ _ _ __| |_ -# | | | || | | || | | _| \___ \| __/ _` | '__| __| -# | |_| || | | || |___| |___ ___) | || (_| | | | |_ -# \__\_\|_| |___|_____|_____| |____/ \__\__,_|_| \__| -# -# -# by Stephan Raabe (2023) -# ----------------------------------------------------- +# ___ _____ ___ _ _____ ____ _ _ +# / _ \_ _|_ _| | | ____| / ___|| |_ __ _ _ __| |_ +# | | | || | | || | | _| \___ \| __/ _` | '__| __| +# | |_| || | | || |___| |___ ___) | || (_| | | | |_ +# \__\_\|_| |___|_____|_____| |____/ \__\__,_|_| \__| +# +# +# by Stephan Raabe (2023) +# ----------------------------------------------------- # My screen resolution # xrandr --rate 120 -# For Virtual Machine +# For Virtual Machine # xrandr --output Virtual-1 --mode 1920x1080 # Keyboard layout