also addet hyprpanel (only for arch though)

This commit is contained in:
pika 2025-05-11 17:16:32 +02:00
parent cb60aca38a
commit 62b3c73d20

View file

@ -1,97 +1,58 @@
#!/usr/bin/env sh #!/usr/bin/env bash
# ─< 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 >───────────────────────────────────────── # ─< Check if the given command exists silently >─────────────────────────────────────────
command_exists() { command_exists() {
command -v "$@" >/dev/null 2>&1 command -v "$@" >/dev/null 2>&1
} }
# ─< Check if the user is root and set sudo variable if necessary >─────────────────────── # WHY:
check_root() { # This import will give you the following variables:
if [ "$(id -u)" -ne 0 ]; then # _sudo="sudo -E" <- only if non root user
if command_exists sudo; then # distro = <distro name, like 'arch', 'debian', 'fedora'..>
echo_info "User is not root. Using sudo for privileged operations." # arch = bool
_sudo="sudo" # fedora = bool
else # opensuse = bool....
echo_error "No sudo found and you're not root! Can't install packages." # You can then use it for, `if $arch; then`
return 1 # Also this gives you the _install command, which installs a package pased on the packagemanager/distro used.
fi # CAUTION:
else # This only wokrs for generic package names, like neovim, or vim, or tmux etc..
echo_info "Root access confirmed." # not every package packagemanager has the same packagenames for their packages..
_sudo="" getImports() {
fi i="https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh"
} import="$(mktemp)"
inst_arch() {
dependencies="aylurs-gtk-shell grimblast hyprpicker"
if command_exists curl; then if command_exists curl; then
if [ ! -d "$HOME/.bun" ]; then curl -fsSL $i -o $import
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 else
echo_warning "No curl was found, cannot continue!" echo "curl is required, but missing.."
exit 1 exit 1
fi fi
source "$import"
sleep 0.3
rm "$import"
echo_warning "cleaned $import"
} }
clone_to_ags() { if getImports; then
if [ ! -d "$HOME/.config/ags" ]; then case "$1" in
if command_exists git; then --silent | -s)
git clone --depth=1 https://github.com/Jas-SinghFSU/HyprPanel "$HOME/.config/ags" silent=true
else echo_warning "Running the script silently.."
echo_error "There was no git found, cannot continue!" ;;
exit 1 *)
fi silent=false
else ;;
echo_note "ags is already present, try running 'ags' in your terminal" esac
fi fi
}
main() { main() {
if check_root; then case "$distro" in
inst_arch arch) _install ags-hyprpanel-git ;;
clone_to_ags *)
fi echo_error "$distro is not supported by this script. Exiting now!"
return 69
;;
esac
clone_to_ags
} }
main main