#!/usr/bin/env bash # Omarchy Dojo installer. # # One-liner (clones into ~/.local/share/omarchy-dojo, then installs): # curl -fsSL https://raw.githubusercontent.com/anthonywkchan/omarchy-dojo/main/install.sh | bash # # From a checkout: # ./install.sh install the launcher + app-menu entry # ./install.sh --autostart also open the Dojo on every login # ./install.sh --update pull the latest version and reinstall # ./install.sh --uninstall remove launcher, menu entry and autostart (keeps progress) set -euo pipefail REPO="${OMARCHY_DOJO_REPO:-https://github.com/anthonywkchan/omarchy-dojo}" DEST="${OMARCHY_DOJO_HOME:-${XDG_DATA_HOME:-$HOME/.local/share}/omarchy-dojo}" bin_dir="$HOME/.local/bin" apps_dir="${XDG_DATA_HOME:-$HOME/.local/share}/applications" autostart="$HOME/.config/hypr/autostart.lua" marker="-- omarchy-dojo" say() { printf '\033[1;36m==>\033[0m %s\n' "$*"; } die() { printf '\033[1;31merror:\033[0m %s\n' "$*" >&2; exit 1; } # Where is the source tree? A checkout when run from one, otherwise clone it. here="" if [[ -n ${BASH_SOURCE[0]:-} && -f "$(dirname "${BASH_SOURCE[0]}")/bin/omarchy-dojo" ]]; then here="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)" fi uninstall() { rm -f "$bin_dir/omarchy-dojo" "$apps_dir/omarchy-dojo.desktop" if [[ -f $autostart ]] && grep -q "$marker" "$autostart"; then sed -i "/$marker/d" "$autostart" say "removed autostart line from $autostart" fi say "uninstalled. Progress kept in ~/.local/state/omarchy-dojo; source left in ${here:-$DEST}" } case "${1:-}" in --uninstall) uninstall; exit 0 ;; -h | --help) sed -n '2,12p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;; esac command -v python3 >/dev/null || die "python3 is required (sudo pacman -S python)" python3 -c 'import sys; sys.exit(sys.version_info < (3, 11))' || die "Python 3.11 or newer is required" command -v hyprctl >/dev/null || say "warning: hyprctl not found; the Dojo only runs inside Hyprland" if [[ -z $here ]]; then command -v git >/dev/null || die "git is required for the one-line install" if [[ -d $DEST/.git ]]; then say "updating $DEST" git -C "$DEST" pull --ff-only -q else say "cloning $REPO into $DEST" git clone -q "$REPO" "$DEST" fi here="$DEST" elif [[ ${1:-} == --update ]]; then say "updating $here" git -C "$here" pull --ff-only -q fi mkdir -p "$bin_dir" "$apps_dir" ln -sf "$here/bin/omarchy-dojo" "$bin_dir/omarchy-dojo" sed "s|@EXEC@|$bin_dir/omarchy-dojo|" "$here/omarchy-dojo.desktop" > "$apps_dir/omarchy-dojo.desktop" say "installed $bin_dir/omarchy-dojo and an app-menu entry" if [[ ${1:-} == --autostart ]]; then mkdir -p "$(dirname "$autostart")" touch "$autostart" if ! grep -q "$marker" "$autostart"; then printf '\no.launch_on_start("%s") %s\n' "$bin_dir/omarchy-dojo" "$marker" >> "$autostart" say "the Dojo will open on every login (remove with --uninstall)" fi fi case ":$PATH:" in *":$bin_dir:"*) ;; *) say "note: $bin_dir is not on your PATH yet; log out and back in, or run $bin_dir/omarchy-dojo" ;; esac if [[ -n ${HYPRLAND_INSTANCE_SIGNATURE:-} && -t 0 ]]; then say "starting the Dojo" "$bin_dir/omarchy-dojo" || true else say "run: omarchy-dojo" fi