also addet hyprpanel (only for arch though)
This commit is contained in:
parent
cb60aca38a
commit
62b3c73d20
1 changed files with 41 additions and 80 deletions
117
hyprpanel.sh
117
hyprpanel.sh
|
@ -1,97 +1,58 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
# ─< 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"
|
||||
}
|
||||
|
||||
#!/usr/bin/env bash
|
||||
# ─< 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"
|
||||
# WHY:
|
||||
# This import will give you the following variables:
|
||||
# _sudo="sudo -E" <- only if non root user
|
||||
# distro = <distro name, like 'arch', 'debian', 'fedora'..>
|
||||
# arch = bool
|
||||
# fedora = bool
|
||||
# opensuse = bool....
|
||||
# You can then use it for, `if $arch; then`
|
||||
# Also this gives you the _install command, which installs a package pased on the packagemanager/distro used.
|
||||
# CAUTION:
|
||||
# This only wokrs for generic package names, like neovim, or vim, or tmux etc..
|
||||
# not every package packagemanager has the same packagenames for their packages..
|
||||
getImports() {
|
||||
i="https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh"
|
||||
import="$(mktemp)"
|
||||
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
|
||||
curl -fsSL $i -o $import
|
||||
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!"
|
||||
echo "curl is required, but missing.."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source "$import"
|
||||
sleep 0.3
|
||||
rm "$import"
|
||||
echo_warning "cleaned $import"
|
||||
}
|
||||
|
||||
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
|
||||
if getImports; then
|
||||
case "$1" in
|
||||
--silent | -s)
|
||||
silent=true
|
||||
echo_warning "Running the script silently.."
|
||||
;;
|
||||
*)
|
||||
silent=false
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
echo_note "ags is already present, try running 'ags' in your terminal"
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
if check_root; then
|
||||
inst_arch
|
||||
case "$distro" in
|
||||
arch) _install ags-hyprpanel-git ;;
|
||||
*)
|
||||
echo_error "$distro is not supported by this script. Exiting now!"
|
||||
return 69
|
||||
;;
|
||||
esac
|
||||
clone_to_ags
|
||||
fi
|
||||
}
|
||||
|
||||
main
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue