159 lines
4.0 KiB
Bash
159 lines
4.0 KiB
Bash
#!/usr/bin/env bash
|
|
set -Eeuo pipefail
|
|
|
|
# Configuration Script for Fedora Hyprland Installer
|
|
|
|
echo "=== Configuring Hyprland Desktop Environment ==="
|
|
|
|
HYPR_DIR="${HOME}/.config/hypr"
|
|
HYPR_CONF="${HYPR_DIR}/hyprland.conf"
|
|
|
|
mkdir -p "${HYPR_DIR}"
|
|
|
|
# 1. Detect Terminal — find which terminal is actually available
|
|
TERMINAL_BIN=""
|
|
if command -v kitty &>/dev/null; then
|
|
TERMINAL_BIN="kitty"
|
|
elif command -v alacritty &>/dev/null; then
|
|
TERMINAL_BIN="alacritty"
|
|
elif command -v foot &>/dev/null; then
|
|
TERMINAL_BIN="foot"
|
|
elif command -v gnome-terminal &>/dev/null; then
|
|
TERMINAL_BIN="gnome-terminal"
|
|
fi
|
|
|
|
if [ -z "$TERMINAL_BIN" ]; then
|
|
echo "[!] Warning: No supported terminal emulator detected. Defaulting to kitty."
|
|
TERMINAL_BIN="kitty"
|
|
fi
|
|
|
|
# 2. Detect Launcher
|
|
LAUNCHER_BIN=""
|
|
if command -v wofi &>/dev/null; then
|
|
LAUNCHER_BIN="wofi --show drun"
|
|
elif command -v rofi &>/dev/null; then
|
|
LAUNCHER_BIN="rofi -show drun"
|
|
fi
|
|
|
|
if [ -z "$LAUNCHER_BIN" ]; then
|
|
echo "[!] Warning: No supported application launcher detected. Defaulting to wofi."
|
|
LAUNCHER_BIN="wofi --show drun"
|
|
fi
|
|
|
|
# 3. Detect GPU Environment Variables
|
|
GPU_CONFIG=""
|
|
if command -v lspci &>/dev/null && lspci -nnk 2>/dev/null | grep -iq "nvidia"; then
|
|
echo "[i] NVIDIA GPU detected. Adding conservative NVIDIA compatibility settings."
|
|
GPU_CONFIG=$(cat <<'ENVEOF'
|
|
|
|
# NVIDIA compatibility
|
|
env = LIBVA_DRIVER_NAME,nvidia
|
|
env = GBM_BACKEND,nvidia-drm
|
|
env = __GLX_VENDOR_LIBRARY_NAME,nvidia
|
|
env = NVD_BACKEND,direct
|
|
cursor {
|
|
no_hardware_cursors = true
|
|
}
|
|
ENVEOF
|
|
)
|
|
fi
|
|
|
|
# 4. Generate hyprland.conf if missing
|
|
if [ ! -f "${HYPR_CONF}" ]; then
|
|
echo "[+] Creating clean ${HYPR_CONF}"
|
|
cat <<EOF > "${HYPR_CONF}"
|
|
# Fedora Hyprland Default Configuration
|
|
# Generated by hyprfedora — Antigravity Fedora Hyprland Installer Skill
|
|
|
|
# Monitor setup (auto detect resolution & position)
|
|
monitor=,preferred,auto,1
|
|
|
|
# Input config
|
|
input {
|
|
kb_layout = us
|
|
follow_mouse = 1
|
|
touchpad {
|
|
natural_scroll = true
|
|
}
|
|
}
|
|
|
|
general {
|
|
gaps_in = 5
|
|
gaps_out = 10
|
|
border_size = 2
|
|
col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg
|
|
col.inactive_border = rgba(595959aa)
|
|
layout = dwindle
|
|
}
|
|
|
|
decoration {
|
|
rounding = 8
|
|
blur {
|
|
enabled = true
|
|
size = 3
|
|
passes = 1
|
|
}
|
|
}
|
|
|
|
animations {
|
|
enabled = true
|
|
bezier = myBezier, 0.05, 0.9, 0.1, 1.05
|
|
animation = windows, 1, 5, myBezier
|
|
animation = windowsOut, 1, 5, default, popin 80%
|
|
animation = border, 1, 10, default
|
|
animation = fade, 1, 5, default
|
|
animation = workspaces, 1, 5, default
|
|
}
|
|
|
|
dwindle {
|
|
pseudotile = true
|
|
preserve_split = true
|
|
}
|
|
|
|
# Autostart essential services
|
|
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
|
|
exec-once = /usr/libexec/polkit-gnome-authentication-agent-1
|
|
exec-once = waybar
|
|
exec-once = dunst
|
|
exec-once = swaybg -c '#1e1e2e'
|
|
${GPU_CONFIG}
|
|
|
|
# Keybindings
|
|
\$mainMod = SUPER
|
|
|
|
bind = \$mainMod, RETURN, exec, ${TERMINAL_BIN}
|
|
bind = \$mainMod, SPACE, exec, ${LAUNCHER_BIN}
|
|
bind = \$mainMod, Q, killactive,
|
|
bind = \$mainMod, M, exit,
|
|
bind = \$mainMod, E, exec, nautilus || thunar || pcmanfm
|
|
bind = \$mainMod, V, togglefloating,
|
|
bind = \$mainMod, R, exec, hyprctl reload
|
|
bind = \$mainMod, P, pseudo, # dwindle
|
|
bind = \$mainMod, J, togglesplit, # dwindle
|
|
|
|
# Move focus
|
|
bind = \$mainMod, left, movefocus, l
|
|
bind = \$mainMod, right, movefocus, r
|
|
bind = \$mainMod, up, movefocus, u
|
|
bind = \$mainMod, down, movefocus, d
|
|
|
|
# Switch workspaces
|
|
bind = \$mainMod, 1, workspace, 1
|
|
bind = \$mainMod, 2, workspace, 2
|
|
bind = \$mainMod, 3, workspace, 3
|
|
bind = \$mainMod, 4, workspace, 4
|
|
bind = \$mainMod, 5, workspace, 5
|
|
bind = \$mainMod, 6, workspace, 6
|
|
bind = \$mainMod, 7, workspace, 7
|
|
bind = \$mainMod, 8, workspace, 8
|
|
bind = \$mainMod, 9, workspace, 9
|
|
bind = \$mainMod, 0, workspace, 10
|
|
|
|
# Screenshots
|
|
bind = , Print, exec, grim -g "\$(slurp)" - | wl-copy
|
|
EOF
|
|
echo "[✓] Configuration generated successfully."
|
|
else
|
|
echo "[i] ${HYPR_CONF} already exists. Skipping default creation to preserve user edits."
|
|
fi
|