#!/usr/bin/env fish argparse -n 'install.fish' -X 0 \ h/help \ noconfirm \ spotify \ 'vscode=?!contains -- "$_flag_value" codium code' \ discord \ zen \ 'aur-helper=!contains -- "$_flag_value" yay paru' \ -- $argv or exit # Print help if set -q _flag_h echo 'usage: ./install.sh [-h] [--noconfirm] [--spotify] [--vscode] [--discord] [--aur-helper]' echo echo 'options:' echo ' -h, --help show this help message and exit' echo ' --noconfirm do not confirm package installation' echo ' --spotify install Spotify (Spicetify)' echo ' --vscode=[codium|code] install VSCodium (or VSCode)' echo ' --discord install Discord (OpenAsar + Equicord)' echo ' --zen install Zen browser' echo ' --aur-helper=[yay|paru] the AUR helper to use' exit end # Helper funcs function _out -a colour text set_color $colour # Pass arguments other than text to echo echo $argv[3..] -- ":: $text" set_color normal end function log -a text _out cyan $text $argv[2..] end function input -a text _out blue $text $argv[2..] end function sh-read sh -c 'read a && echo -n "$a"' || exit 1 end function confirm-overwrite -a path if test -e $path -o -L $path # No prompt if noconfirm if set -q noconfirm input "$path already exists. Overwrite? [Y/n]" log 'Removing...' rm -rf $path else # Prompt user input "$path already exists. Overwrite? [Y/n] " -n set -l confirm (sh-read) if test "$confirm" = n -o "$confirm" = N log 'Skipping...' return 1 else log 'Removing...' rm -rf $path end end end return 0 end # Variables set -q _flag_noconfirm && set noconfirm --noconfirm set -q _flag_aur_helper && set -l aur_helper $_flag_aur_helper || set -l aur_helper paru set -q XDG_CONFIG_HOME && set -l config $XDG_CONFIG_HOME || set -l config $HOME/.config set -q XDG_STATE_HOME && set -l state $XDG_STATE_HOME || set -l state $HOME/.local/state # Startup prompt set_color magenta echo '╭─────────────────────────────────────────────────╮' echo '│ ______ __ __ _ │' echo '│ / ____/___ ____ / /__ _____/ /_(_)___ _ │' echo '│ / / / __ `/ _ \/ / _ \/ ___/ __/ / __ `/ │' echo '│ / /___/ /_/ / __/ / __(__ ) /_/ / /_/ / │' echo '│ \____/\__,_/\___/_/\___/____/\__/_/\__,_/ │' echo '│ │' echo '╰─────────────────────────────────────────────────╯' set_color normal log 'Welcome to the Caelestia dotfiles installer!' log 'Before continuing, please ensure you have made a backup of your config directory.' # Prompt for backup if ! set -q _flag_noconfirm log '[1] Two steps ahead of you! [2] Make one for me please!' input '=> ' -n set -l choice (sh-read) if contains -- "$choice" 1 2 if test $choice = 2 log "Backing up $config..." if test -e $config.bak -o -L $config.bak input 'Backup already exists. Overwrite? [Y/n] ' -n set -l overwrite (sh-read) if test "$overwrite" = n -o "$overwrite" = N log 'Skipping...' else rm -rf $config.bak cp -r $config $config.bak end else cp -r $config $config.bak end end else log 'No choice selected. Exiting...' exit 1 end end # Cd into dir cd (dirname (status filename)) || exit 1 # Install metapackage for deps log 'Installing metapackage...' sudo eselect repository add ceres-ebuilds git https://git.ceressees.dev/ceres-sees-all/ceres-ebuilds.git sudo emaint sync -r ceres-ebuilds sudo emerge -av caelestia-meta # Install hypr* configs if confirm-overwrite $config/hypr log 'Installing hypr* configs...' ln -s (realpath hypr) $config/hypr hyprctl reload end # Starship if confirm-overwrite $config/starship.toml log 'Installing starship config...' ln -s (realpath starship.toml) $config/starship.toml end # Foot if confirm-overwrite $config/foot log 'Installing foot config...' ln -s (realpath foot) $config/foot end # Fish if confirm-overwrite $config/fish log 'Installing fish config...' ln -s (realpath fish) $config/fish end # Uwsm if confirm-overwrite $config/uwsm log 'Installing uwsm config...' ln -s (realpath uwsm) $config/uwsm end # Btop if confirm-overwrite $config/btop log 'Installing btop config...' ln -s (realpath btop) $config/btop end # Glafetch if confirm-overwrite $config/glafetch log 'Installing glafetch config...' ln -s (realpath glafetch) $config/glafetch end # Ghostty if confirm-overwrite $config/ghostty log 'Installing ghostty config...' ln -s (realpath ghostty) $config/ghostty end # Helix if confirm-overwrite $config/helix log 'Installing btop config...' ln -s (realpath helix) $config/helix end # Yazi if confirm-overwrite $config/yazi log 'Installing yazi config...' ln -s (realpath yazi) $config/yazi end # Lazygit if confirm-overwrite $config/lazygit log 'Installing lazygit config...' ln -s (realpath lazygit) $config/lazygit end # Wallpapers if confirm-overwrite $HOME/Pictures/Wallpapers log 'Installing yazi wallpapers...' mkdir -p $HOME/Pictures/Wallpapers ln -s (realpath wallpapers) $HOME/Pictures/Wallpapers end # Install zen if set -q _flag_zen # Install userChrome css set -l chrome $HOME/.zen/*/chrome if confirm-overwrite $chrome/userChrome.css log 'Installing zen userChrome...' ln -s (realpath zen/userContent.css) $chrome/userContent.css ln -s (realpath zen/zen-logo-mocha.svg) $chrome/zen-logo-mocha.svg ln -s $HOME/.local/state/caelestia/theme/zen.css $chrome/userChrome.css end # Install native app set -l hosts $HOME/.mozilla/native-messaging-hosts set -l lib $HOME/.local/lib/caelestia if confirm-overwrite $hosts/caelestiafox.json log 'Installing zen native app manifest...' mkdir -p $hosts cp zen/native_app/manifest.json $hosts/caelestiafox.json sed -i "s|{{ \$lib }}|$lib|g" $hosts/caelestiafox.json end if confirm-overwrite $lib/caelestiafox log 'Installing zen native app...' mkdir -p $lib ln -s (realpath zen/native_app/app.fish) $lib/caelestiafox end # Prompt user to install extension log 'Please install the CaelestiaFox extension from https://addons.mozilla.org/en-US/firefox/addon/caelestiafox if you have not already done so.' end # Generate scheme stuff if needed if ! test -f $state/caelestia/scheme.json caelestia scheme set -n shadotheme sleep .5 hyprctl reload end # Start the shell caelestia shell -d >/dev/null log 'Done!'