username := env_var('USER')

# Displays this message
default:
  @just --list --justfile {{justfile()}}

# Installs the paru AUR helper
setup-aur:
  rustup install stable
  rm -rf /tmp/paru
  git clone https://aur.archlinux.org/paru.git /tmp/paru
  cd /tmp/paru; makepkg -si
  rm -rf /tmp/paru

# Installs Code - OSS extensions
setup-code:
  code-oss --install-extension davidanson.vscode-markdownlint
  code-oss --install-extension enkia.tokyo-night
  code-oss --install-extension irongeek.vscode-env
  code-oss --install-extension kokakiwi.vscode-just
  code-oss --install-extension ms-python.python
  code-oss --install-extension ms-vscode.live-server
  code-oss --install-extension naumovs.color-highlight
  code-oss --install-extension pkief.material-icon-theme
  code-oss --install-extension redhat.vscode-yaml
  code-oss --install-extension rust-lang.rust-analyzer
  code-oss --install-extension serayuzgur.crates
  code-oss --install-extension spgoding.datapack-language-server
  code-oss --install-extension tamasfe.even-better-toml
  code-oss --install-extension tonybaloney.vscode-pets
  code-oss --install-extension usernamehw.errorlens
  code-oss --install-extension vscodevim.vim

# Installs mpv scripts
setup-mpv:
  mkdir -p ~/.config/mpv/scripts
  curl https://raw.githubusercontent.com/mpv-player/mpv/master/TOOLS/lua/autodeint.lua -o ~/.config/mpv/scripts/autodeint.lua
  curl https://raw.githubusercontent.com/po5/thumbfast/master/thumbfast.lua -o ~/.config/mpv/scripts/thumbfast.lua
  curl -fsSL https://raw.githubusercontent.com/tomasklaen/uosc/HEAD/installers/unix.sh | bash

# Installs AUR packages for my WM setup
setup-river:
  paru -S --noprovides bemoji lswt river-git swaylock-effects-git wlogout wlopm wlr-randr-git
  bemoji

# Set ZSH as default shell and install plugins
setup-shell:
  chsh -s /usr/bin/zsh
  curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh | sh
  git clone https://github.com/hlissner/zsh-autopair ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autopair
  git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
  git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search
  git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

# Enable and authenticate with Tailscale
setup-tailscale:
  sudo systemctl enable --now tailscaled
  sudo tailscale up --operator={{username}} --ssh=true

# Installs Waydroid with GAPPS
setup-waydroid:
  paru -S binder_linux-dkms waydroid
  sudo waydroid init -s GAPPS
  sudo systemctl enable --now waydroid-container
  waydroid session start &

# Installs the Wii cursor
setup-wii-cursor:
  curl https://files.primm.gay/extras/cursors/Wii/Linux%20Cursors.7z -o ~/.local/share/icons/wii-cursors-linux.7z
  cd ~/.local/share/icons; 7z x wii-cursors-linux.7z
  mv ~/.local/share/icons/Linux\ Cursor/Wii-Pointer-P* ~/.local/share/icons/
  rm -r ~/.local/share/icons/Linux\ Cursor/
  rm ~/.local/share/icons/wii-cursors-linux.7z

# Stows all dotfiles into the correct locations
stow:
  stow btop
  stow code
  stow fuzzel
  stow gtk
  stow kanshi
  stow kitty
  stow lf
  stow mako
  stow mangohud
  stow mpv
  stow river
  stow swaylock
  stow waybar
  stow wlogout
  stow zsh