mirror of
https://github.com/alrayyes/dotfiles/
synced 2023-11-14 15:56:30 +00:00
166 lines
4.8 KiB
Fish
Executable File
166 lines
4.8 KiB
Fish
Executable File
#!/usr/bin/env fish
|
|
|
|
# Prerequisite & inistalled apps
|
|
set prerequisiteApps bat bmon broot brave caffeine-ng exa fslint fzf graphviz isync imagemagick lightdm-gtk-greeter mailcap neofetch npm pandoc-bin pamixer playerctl pulseaudio pulsemixer python pywal ripgrep stow sxiv tldr trayer udisks2 unclutter xbanish xwallpaper yarn xprop zathura
|
|
set prerequisiteFonts ttf-linux-libertine noto-fonts noto-fonts-emoji ttf-liberation nerd-fonts-hack
|
|
set prerequisiteLibraries libxft-bgra
|
|
set configuredApps alacritty bspwm castero emacs firejail git gnupg gtk lf dunst mpd mpv mpv-mpris ncmpcpp neomutt neovim picom redshift sxhkd tmux tuir weechat
|
|
set locales aspell-en hunspell-en_GB hunspell-en_US hunspell-nl
|
|
set golang go golangci-lint-bin
|
|
set shell shfmt shellcheck
|
|
set screenlock xsecurelock xss-lock
|
|
|
|
function mkdir_if_not_exist
|
|
if [ ! -d "$argv" ]
|
|
echo "Creating directory $argv"
|
|
mkdir -p "$argv"
|
|
end
|
|
end
|
|
|
|
function install_omf_package_if_not_exist
|
|
if test (omf list | grep -c "$argv") -eq 0
|
|
echo "Installing omf package $argv"
|
|
omf install "$argv"
|
|
end
|
|
end
|
|
|
|
function install_yarn_package_if_not_exist
|
|
if ! yarn global list lighthouse >/dev/null 2>&1
|
|
echo "Installing yarn package $argv"
|
|
yarn global add "$argv"
|
|
end
|
|
end
|
|
|
|
function install_app_if_not_exist
|
|
if test (pacman -Q | grep -c "$argv") -eq 0
|
|
echo "Installing missing package $argv"
|
|
yay -S --noconfirm "$argv"
|
|
end
|
|
end
|
|
|
|
for app in $prerequisiteApps
|
|
install_app_if_not_exist "$app"
|
|
end
|
|
|
|
for font in $prerequisiteFonts
|
|
install_app_if_not_exist "$font"
|
|
end
|
|
|
|
for library in $prerequisiteLibraries
|
|
install_app_if_not_exist "$library"
|
|
end
|
|
|
|
for app in $configuredApps
|
|
install_app_if_not_exist "$app"
|
|
end
|
|
|
|
for locale in $locales
|
|
install_app_if_not_exist "$locale"
|
|
end
|
|
|
|
for go in $golang
|
|
install_app_if_not_exist "$go"
|
|
end
|
|
|
|
for sh in $shell
|
|
install_app_if_not_exist "$sh"
|
|
end
|
|
|
|
for lock in $screenlock
|
|
install_app_if_not_exist "$lock"
|
|
end
|
|
|
|
# Create directories that need to exist
|
|
mkdir_if_not_exist ~/.cache/mpd
|
|
mkdir_if_not_exist ~/.config/alacritty
|
|
mkdir_if_not_exist ~/.config/nvim
|
|
mkdir_if_not_exist ~/.config/fish
|
|
mkdir_if_not_exist ~/.config/git
|
|
mkdir_if_not_exist ~/.config/msmtp
|
|
mkdir_if_not_exist ~/.config/omf
|
|
mkdir_if_not_exist ~/.config/polybar/bin
|
|
mkdir_if_not_exist ~/.config/mpd
|
|
mkdir_if_not_exist ~/.config/systemd/user
|
|
mkdir_if_not_exist ~/.config/wal
|
|
mkdir_if_not_exist ~/.config/weechat
|
|
mkdir_if_not_exist ~/.config/X11
|
|
mkdir_if_not_exist ~/.gnupg
|
|
mkdir_if_not_exist ~/.config/mpv/scripts
|
|
mkdir_if_not_exist ~/.config/coc/extensions
|
|
mkdir_if_not_exist ~/.config/dmenu-frecency
|
|
mkdir_if_not_exist ~/.config/doom
|
|
mkdir_if_not_exist ~/.config/sxhkd
|
|
mkdir_if_not_exist ~/.local/share/applications
|
|
|
|
|
|
# Link mpv plugins if they don't exist
|
|
if [ ! -h ~/.config/mpv/scripts/mpris.so ]
|
|
echo "Linking mpris.so"
|
|
ln -s /usr/lib/mpv/mpris.so ~/.config/mpv/scripts/mpris.so
|
|
end
|
|
|
|
for d in (find -- */ -maxdepth 0 -type d | grep -v node_modules | cut -f1 -d '/')
|
|
echo "Linking $d..."
|
|
stow -t "$HOME" "$d"
|
|
end
|
|
|
|
# Refresh xgd
|
|
if test (grep -c 'x-scheme-handler/org-protocol=org-protocol.desktop' ~/.config/mimeapps.list) -eq 0
|
|
echo "Refreshing xgd to handle org-protocol"
|
|
update-desktop-database ~/.local/share/applications/
|
|
xdg-mime default org-protocol.desktop x-scheme-handler/org-protocol
|
|
end
|
|
|
|
# Install oh-my-fish if it isn't installed
|
|
if [ ! -d ~/.local/share/omf ]
|
|
curl -L https://get.oh-my.fish | fish
|
|
end
|
|
|
|
# Install oh-my-fish plugins
|
|
install_omf_package_if_not_exist spacefish
|
|
install_omf_package_if_not_exist colored-man-pages
|
|
install_omf_package_if_not_exist extract
|
|
install_omf_package_if_not_exist fzf
|
|
install_omf_package_if_not_exist gi
|
|
install_omf_package_if_not_exist git-flow
|
|
install_omf_package_if_not_exist wttr
|
|
|
|
# Install vim plugins & requirements
|
|
if test (pip list --user | grep -c 'pynvim') -ne 1
|
|
pip install --user pynvim
|
|
end
|
|
|
|
# Install plug package manager if it doesn't exist
|
|
if [ ! -d ~/.config/nvim/plugged ]
|
|
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
|
|
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
|
end
|
|
|
|
# Install Neovim plugins
|
|
nvim +PlugInstall +qall
|
|
|
|
# Install Neovim coc extensions
|
|
yarn --cwd ~/.config/coc/extensions install
|
|
|
|
# Install yarn packages
|
|
install_yarn_package_if_not_exist lighthouse
|
|
|
|
# Setup broot if not done already
|
|
if [ ! -d ~/.local/share/broot ]
|
|
broot --install
|
|
end
|
|
|
|
# Polybar scripts if not installed already
|
|
if [ ! -d ~/.local/share/polybar-scripts ]
|
|
git clone https://github.com/polybar/polybar-scripts ~/.local/share/polybar-scripts
|
|
end
|
|
|
|
# Update fish completions (auto generated from man pages)
|
|
fish_update_completions
|
|
|
|
# Notify user to manually symlink files
|
|
if [ -n "$argv[1]" ]
|
|
printf "\n\nDon't forget to symlink these files:\n\n"
|
|
find ~ \( -type l -o -type f \) -name "*.$argv[1]" -exec ls -al {} \;
|
|
end
|