#!/usr/bin/env bash # The apps the installer offers, a page each. Every page can take any number of them, or None. # A line is: package|name|the commands that mean it is here|its desktop id, for the dock. # `*` before a package marks the recommended one, ticked when that kind has nothing here yet. # `@` means it is not a package: it comes from a release on Astar Hub. APP_PAGES=(terminal files editor browser discord music extras) declare -A APP_TITLE=( [terminal]="Terminal" [files]="File manager" [editor]="Text editor" [browser]="Browser" [discord]="Discord" [music]="Music" [extras]="Extras" ) app_list() { case "$1" in terminal) cat <<'L' *kitty|kitty|kitty|kitty foot|foot|foot|foot alacritty|Alacritty|alacritty|Alacritty ghostty|Ghostty|ghostty|com.mitchellh.ghostty wezterm|WezTerm|wezterm|org.wezfurlong.wezterm konsole|Konsole|konsole|org.kde.konsole gnome-terminal|GNOME Terminal|gnome-terminal|org.gnome.Terminal L ;; files) cat <<'L' *thunar|Thunar|thunar|thunar dolphin|Dolphin|dolphin|org.kde.dolphin nautilus|Nautilus|nautilus|org.gnome.Nautilus nemo|Nemo|nemo|nemo pcmanfm-gtk3|PCManFM|pcmanfm|pcmanfm yazi|yazi|yazi|yazi L ;; editor) cat <<'L' *gnome-text-editor|GNOME Text Editor|gnome-text-editor|org.gnome.TextEditor kate|Kate|kate|org.kde.kate mousepad|Mousepad|mousepad|org.xfce.mousepad neovim|Neovim|nvim|nvim micro|micro|micro|micro helix|Helix|helix hx|Helix zed|Zed|zed zeditor|dev.zed.Zed code|Code - OSS|code|code-oss visual-studio-code-bin|Visual Studio Code|code|code sublime-text-4|Sublime Text|subl|sublime_text L ;; browser) cat <<'L' *ungoogled-chromium-bin|Ungoogled Chromium|ungoogled-chromium chromium|ungoogled-chromium brave-bin|Brave|brave|brave-browser firefox|Firefox|firefox|firefox opera|Opera|opera|opera zen-browser-bin|Zen Browser|zen-browser|zen vivaldi|Vivaldi|vivaldi vivaldi-stable|vivaldi-stable chromium|Chromium|chromium|chromium google-chrome|Google Chrome|google-chrome-stable|google-chrome @nacre|Nacre|nacre|nacre L ;; discord) cat <<'L' equibop-bin|Equibop|equibop|equibop vesktop-bin|Vesktop|vesktop|vesktop discord|Discord|discord|discord legcord-bin|Legcord|legcord|legcord webcord|WebCord|webcord|webcord L ;; music) cat <<'L' @mulberry|Mulberry|mulberry|mulberry spotify|Spotify|spotify|spotify strawberry|Strawberry|strawberry|org.strawberrymusicplayer.strawberry tauon-music-box|Tauon|tauon|tauonmb rhythmbox|Rhythmbox|rhythmbox|org.gnome.Rhythmbox3 vlc|VLC|vlc|vlc mpv|mpv|mpv|mpv L ;; extras) cat <<'L' steam|Steam|steam|steam heroic-games-launcher-bin|Heroic Games Launcher|heroic|heroic lutris|Lutris|lutris|net.lutris.Lutris prismlauncher|Prism Launcher|prismlauncher|org.prismlauncher.PrismLauncher obs-studio|OBS Studio|obs|com.obsproject.Studio gimp|GIMP|gimp|gimp krita|Krita|krita|org.kde.krita libreoffice-fresh|LibreOffice|libreoffice soffice|libreoffice-startcenter onlyoffice-bin|ONLYOFFICE|onlyoffice-desktopeditors|onlyoffice-desktopeditors qbittorrent|qBittorrent|qbittorrent|org.qbittorrent.qBittorrent telegram-desktop|Telegram|telegram-desktop Telegram|org.telegram.desktop signal-desktop|Signal|signal-desktop|signal-desktop thunderbird|Thunderbird|thunderbird|thunderbird obsidian|Obsidian|obsidian|obsidian bitwarden|Bitwarden|bitwarden|bitwarden keepassxc|KeePassXC|keepassxc|org.keepassxc.KeePassXC btop|btop|btop|btop L ;; esac } HUB_URL=https://archlinux.tail7c4f5e.ts.net/git/astar76 own_url() { case "$1" in @mulberry) echo "$HUB_URL/Mulberry/releases/download/v2.0.3/Mulberry-2.0.3-Linux-x86_64.tar.gz" ;; @nacre) echo "$HUB_URL/Nacre-rust/releases/download/v0.3.0/Nacre-0.3.0-linux-x86_64.tar.gz" ;; esac } # Downloads a release into ~/.local/lib and puts it on the menu. install_own() { local name="${1#@}" url dir url="$(own_url "$1")" dir="$(mktemp -d)" curl -fsSL --max-time 300 "$url" | tar -xz -C "$dir" || { rm -rf "$dir"; return 1; } local top top="$(find "$dir" -mindepth 1 -maxdepth 1 -type d | head -1)" local lib="$HOME/.local/lib/$name" data="${XDG_DATA_HOME:-$HOME/.local/share}" mkdir -p "$HOME/.local/lib" "$HOME/.local/bin" "$data/applications" "$data/icons/hicolor/scalable/apps" "$data/icons/hicolor/256x256/apps" rm -rf "$lib" mv "$top" "$lib" rm -rf "$dir" local exe="$lib/$name" [[ -x "$exe" ]] || exe="$lib/$name-rust" ln -sf "$exe" "$HOME/.local/bin/$name" if [[ -f "$lib/$name.desktop" ]]; then sed "s|^Exec=[^ ]*|Exec=$HOME/.local/bin/$name|" "$lib/$name.desktop" >"$data/applications/$name.desktop" fi [[ -f "$lib/$name.svg" ]] && cp "$lib/$name.svg" "$data/icons/hicolor/scalable/apps/" [[ -f "$lib/$name.png" ]] && cp "$lib/$name.png" "$data/icons/hicolor/256x256/apps/" return 0 } # Whether one of these commands is here. app_present() { local c for c in $1; do command -v "$c" >/dev/null 2>&1 && return 0 done return 1 }