Files
blacklayer/install.sh
T
2026-01-28 14:46:10 +03:00

115 lines
2.7 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
set -e
echo "[blacklayer] installing..."
# -------------------------
# Detect package manager & install jq
# -------------------------
install_jq() {
if command -v jq >/dev/null 2>&1 \
&& ldconfig -p 2>/dev/null | grep -q libgtk-3 \
&& ldconfig -p 2>/dev/null | grep -q gdk_pixbuf \
&& ldconfig -p 2>/dev/null | grep -q gtk-layer-shell; then
echo "[blacklayer] all runtime dependencies already installed"
return
fi
echo "[blacklayer] missing dependencies, installing..."
if command -v pacman >/dev/null 2>&1; then
sudo pacman -Sy --noconfirm gtk3 gdk-pixbuf2 gtk-layer-shell jq
elif command -v apt >/dev/null 2>&1; then
sudo apt update
sudo apt install -y \
libgtk-3-0 \
libgdk-pixbuf-2.0-0 \
libgtk-layer-shell0 \
jq
elif command -v dnf >/dev/null 2>&1; then
sudo dnf install -y \
gtk3 \
gdk-pixbuf2 \
gtk-layer-shell \
jq
else
echo "[blacklayer] unsupported distro please install jq manually"
exit 1
fi
}
install_jq
# -------------------------
# Paths
# -------------------------
BASE_DIR="$HOME/.config/blacklayer"
# -------------------------
# Create directory
# -------------------------
mkdir -p "$BASE_DIR"
# -------------------------
# Copy files
# -------------------------
echo "[blacklayer] copying files to $BASE_DIR"
cp blacklayer event-driven.sh blacklayer.conf blacklayer-worker.sh call-blacklayer.sh start-waybars.sh generate-waybar-configs.sh idle-lock.sh idle-sleep.sh idle-resume.sh "$BASE_DIR/" 2>/dev/null
# -------------------------
# Permissions
# -------------------------
echo "[blacklayer] setting permissions"
sudo chown -R bob:bob "$BASE_DIR"
chmod 700 "$BASE_DIR"
chmod +x "$BASE_DIR"/*.sh 2>/dev/null || true
chmod 600 "$BASE_DIR"/*.conf 2>/dev/null || true
[ -f "$BASE_DIR/blacklayer" ] && chmod +x "$BASE_DIR/blacklayer"
echo "What is yours status bar?"
echo "1 - Waybar"
echo
read -rp "Seçim (1): " CHOICE
case "$CHOICE" in
1)
echo "[+] Waybar yapılandırması hazırlanıyor"
cd "$HOME/.config/blacklayer/" || {
echo "HATA: ~/.config/blacklayer bulunamadı"
exit 1
}
sudo chown -R "$USER:$USER" "$HOME/.config/waybar"
chmod 700 "$HOME/.config/waybar"
./generate-waybar-configs.sh
;;
*)
echo "Geçersiz seçim"
exit 1
;;
esac
# -------------------------
# Done
# -------------------------
echo
echo "[blacklayer] installation complete"
echo
echo "Run with:"
echo " $BASE_DIR/call-blacklayer.sh"
echo "Stop with:"
echo " $BASE_DIR/call-blacklayer.sh"
echo