scripts/installs/hyprpanel.sh
2025-04-14 09:22:15 +02:00

97 lines
2.7 KiB
Bash

#!/bin/sh -c
# ─< ANSI color codes >───────────────────────────────────────────────────────────────────
RED='\033[0;31m'
CYAN='\033[0;36m'
YELLOW='\033[0;33m'
LIGHT_GREEN='\033[0;92m'
BOLD='\033[1m'
NC='\033[0m' # No Color
echo_error() {
printf "${BOLD}${RED}ERROR: ${NC}${RED}%s${NC}\n" "$1" >&2
}
echo_info() {
printf "${BOLD}${CYAN}INFO: ${NC}${CYAN}%s${NC}\n" "$1"
}
echo_warning() {
printf "${BOLD}${YELLOW}WARNING: ${NC}${YELLOW}%s${NC}\n" "$1"
}
echo_note() {
printf "${BOLD}${LIGHT_GREEN}NOTE: ${NC}${LIGHT_GREEN}%s${NC}\n" "$1"
}
# ─< Check if the given command exists silently >─────────────────────────────────────────
command_exists() {
command -v "$@" >/dev/null 2>&1
}
# ─< Check if the user is root and set sudo variable if necessary >───────────────────────
check_root() {
if [ "$(id -u)" -ne 0 ]; then
if command_exists sudo; then
echo_info "User is not root. Using sudo for privileged operations."
_sudo="sudo"
else
echo_error "No sudo found and you're not root! Can't install packages."
return 1
fi
else
echo_info "Root access confirmed."
_sudo=""
fi
}
inst_arch() {
dependencies="aylurs-gtk-shell grimblast hyprpicker"
if command_exists curl; then
if [ ! -d "$HOME/.bun" ]; then
echo_info "Downloading bun and linking it.."
curl -fsSL https://bun.sh/install | bash && $_sudo ln -s $HOME/.bun/bin/bun /usr/local/bin/bun
else
echo_note "Bun is already installed"
fi
$_sudo pacman -S pipewire libgtop bluez bluez-utils btop networkmanager dart-sass wl-clipboard brightnessctl swww python gnome-bluetooth-3.0 pacman-contrib power-profiles-daemon gvfs --noconfirm
if command_exists yay; then
echo_info "Using yay to install $dependencies"
yay -S --noconfirm $dependencies
elif command_exists paru; then
echo_info "Using paru to install $dependencies"
paru -S --noconfirm $dependencies
else
echo_error "No aur helper found.. Cannot continue!"
exit 1
fi
else
echo_warning "No curl was found, cannot continue!"
exit 1
fi
}
clone_to_ags() {
if [ ! -d "$HOME/.config/ags" ]; then
if command_exists git; then
git clone --depth=1 https://github.com/Jas-SinghFSU/HyprPanel "$HOME/.config/ags"
else
echo_error "There was no git found, cannot continue!"
exit 1
fi
else
echo_note "ags is already present, try running 'ags' in your terminal"
fi
}
main() {
if check_root; then
inst_arch
clone_to_ags
fi
}
main