Dotfiles/setup/modules/Desktop-Environments/hyprdrive.sh

309 lines
14 KiB
Bash
Executable File

#!/bin/bash
# =============================================================================
# hyprdrive.sh — HyprDrive Desktop Environment installer (Lua-based config)
# =============================================================================
# Part of the Dotfiles setup system for Arch Linux.
#
# HyprDrive is a leaner sibling of HyprLua: same Lua-based Hyprland config
# (hyprland.lua, hl.bind/hl.dsp), same CyberQueer theme, but WITHOUT the older
# shell-component stack hyprlua carries for compatibility/history — no EWW bar,
# no leftover nwg-shell pieces (nwg-dock/-drawer/-panel), no walker, waybar,
# wofi, or ulauncher. In their place, the "Cosmonaut Shell" component suite
# (all built specifically for this profile, all sharing one hologram/glow
# visual language):
# - orbit-menu — radial power/utility menu
# - horizon-dock — hover-scrollable orbital app dock
# - astro-menu — astal-menu re-themed as a hologram info display; same
# functionality (Location/Weather/Bluetooth/Network quads,
# taskbar, app drawer), so it still needs astal-menu's own
# Astal service deps (see below)
# - station-bar — the EWW top bar's replacement ("Voidstation Status Bar"):
# a thin, curved, always-on-top layer-shell bar. Tracks
# Hyprland workspaces/active window natively over the
# .socket2.sock IPC event stream (no external
# hyprland-workspaces binary, no socat), so it needs no
# extra packages beyond what's already listed below
# (pactl from pipewire-pulse, sysfs for battery).
# Vicinae remains the launcher.
#
# Differences from hyprlua.sh:
# - Config source paths point to desktopenvs/hyprdrive/
# - No EWW compilation step (no bar at all yet)
# - Drops libshumate (astal-menu never actually used it — Shumate doesn't
# paint tiles in this environment, so the Location quad already falls back
# to a static Pillow-stitched map; libshumate was dead weight even in
# hyprlua) and the GTK3 gtk-layer-shell build (that one WAS EWW-only)
# - Drops wofi, walker-bin, ulauncher, bzmenu, iwmenu, wofi-calc, hyprland-
# workspaces (all tied to the dropped shell stack)
# - wofi-calc's Super+Alt+F bind now opens qalculate-gtk instead (already a
# general-purpose package, not wofi-dependent)
# - Default wallpaper is a real ESA/Hubble image ("Rings of Relativity",
# CC BY 4.0 — desktopenvs/hyprdrive/wallpaper/, see its CREDITS.md) instead
# of the personal Nextcloud-hosted background hyprlua.sh fetches
#
# High-level install flow:
# 1. System update + Flatpak
# 2. pacman packages (compositor, audio, networking, tools, fonts, webcam)
# 3. systemd service enablement
# 4. AUR packages via yay
# 5. Themes, terminal symlink, SSH askpass, dark-mode preference
# 6. Nordzy left-hand cursor theme
# 7. Bluetooth / iwd services
# 8. Config file deployment (hyprdrive source tree)
# 9. Wallpaper + resource files
# 10. Python venv for helper scripts
# 11. Udiskie tray-icon symlink fix
# 12. config-updater symlinks + apply-theme.sh
#
# Prerequisites: internet access, yay (AUR helper), rustup, git, curl, cargo.
# =============================================================================
set -e
source "$(dirname "${BASH_SOURCE[0]}")/../lib/logging.sh"
log "Starting HyprDrive installer (Lua-based config, minimal shell stack)..."
# ---------------------------------------------------------------------------
# 1. Update system and install Flatpak
# ---------------------------------------------------------------------------
log "Updating system and installing Flatpak..."
sudo pacman -Syu --noconfirm --needed flatpak
# ---------------------------------------------------------------------------
# 2. Install required packages
# ---------------------------------------------------------------------------
log "Installing required packages..."
HYPRDRIVE_PACKAGES=(
hyprland # Wayland compositor / window manager
hyprcursor # hardware-accelerated cursor rendering for Hyprland
wl-clipboard # wl-copy / wl-paste; Wayland clipboard CLI tools
hyprpaper # wallpaper utility with per-monitor support
hyprlock # GPU-accelerated screen locker (Hyprland-native)
kitty # GPU-accelerated terminal (default in this setup)
dunst # lightweight, scriptable notification daemon
nwg-look # GTK/cursor/icon theme picker for wlroots sessions (kept — theme picker, not a shell component)
# orbit-menu / horizon-dock / astro-menu / station-bar: all four are GTK4
# layer-shell Python apps (the Cosmonaut Shell)
python-gobject # PyGObject: GTK4 + Astal libs from Python
python-pillow # astro-menu's Location quad: stitches map tiles (backend/staticmap.py)
gtk4 # GTK4 toolkit (all four apps' frontend)
gtk4-layer-shell # wlr-layer-shell for GTK4 (their popup/dock/bar surfaces)
networkmanager # nmcli backend (Network quad/editor, orbit-menu Tools)
bluez-utils # bluetoothctl + bluez CLI (Bluetooth quad fallbacks)
iproute2 curl jq # ip/ss, HTTP fetches, JSON (helper scripts, astro-menu backends)
traceroute # path trace to 1.1.1.1 (astro-menu's Location quad)
# Build toolchain required for AUR package compilation
python cmake meson cpio pkgconf ruby-pkg-config
hyprsunset # blue-light filter / night-mode daemon
hypridle # idle daemon triggering lock/suspend after inactivity
hyprshutdown # graceful shutdown/reboot/sleep — orbit-menu's Power ring wraps this
ksshaskpass # Qt SSH passphrase dialog registered as ssh-askpass
nm-connection-editor # GTK editor for NetworkManager connection profiles
network-manager-applet # tray applet showing network connection status
blueman # GTK Bluetooth manager with tray icon support
bluez # core Linux Bluetooth protocol stack
pipewire # modern audio/video routing daemon (replaces PulseAudio)
alsa-utils # low-level ALSA CLI tools (amixer, aplay, arecord)
firefox # web browser
greetd-tuigreet # TUI login greeter (text-based, no GPU requirement)
grim # Wayland screenshot capture tool
slurp # interactive rectangular region selector for screenshots
gst-plugin-pipewire # GStreamer plugin routing through PipeWire
imagemagick # image processing toolkit for screenshot effects
nerd-fonts # all Nerd Font families (Cosmonaut Shell glyphs — orbit-menu, horizon-dock, station-bar)
otf-font-awesome # Font Awesome glyph set (notifications etc.)
pipewire-alsa pipewire-jack pipewire-pulse
qt5-wayland qt6-wayland
swww # smooth animated wallpaper daemon for wlroots (alternative to hyprpaper)
ttf-jetbrains-mono # monospace coding font used in terminals
wireplumber # PipeWire session and policy manager
xdg-desktop-portal-hyprland
xdg-utils
xorg-server xorg-xinit # XWayland support for legacy X11 apps
papirus-icon-theme
cool-retro-term
qalculate-gtk # full GTK calculator — also backs orbit-menu's Super+Alt+F / Tools>Calculator
iwd
dbus
thunar tumbler thunar-archive-plugin thunar-shares-plugin thunar-volman
hyprpicker
pcmanfm-qt
udisks2
kew
hyprpolkitagent
pavucontrol
playerctl
wf-recorder
sound-theme-freedesktop
python-opencv # webcam presence-detection daemon
v4l-utils
)
sudo pacman -Syu --noconfirm --needed -- "${HYPRDRIVE_PACKAGES[@]}"
# ---------------------------------------------------------------------------
# 3. Enable essential services
# ---------------------------------------------------------------------------
log "Enabling essential services..."
enable_service NetworkManager.service
# Greeter: same LightDM + cyberqueer greeter module as hyprlua.
bash "$(dirname "${BASH_SOURCE[0]}")/../optional-Modules/apps/lightdm.sh"
enable_service udisks2.service
# ---------------------------------------------------------------------------
# 4. Install AUR packages
# ---------------------------------------------------------------------------
log "Installing AUR packages..."
rustup default stable
# Packages:
# vicinae-bin — pre-built vicinae (launcher)
# bluetuith — TUI Bluetooth manager
# wvkbd — on-screen virtual keyboard for Wayland (tablet use)
# pinta — accessible image editor
# udiskie — auto-mounter with tray icon
# bri — brightness control helper
# chamel — colour-palette / theme switcher
# libastal-apps-git — Astal apps service, consumed by horizon-dock's
# All Apps/Favorites orbits via PyGObject
# libastal-network-git,
# libastal-bluetooth-git,
# libastal-io-git — astro-menu's Network/Bluetooth quads (same libs
# astal-menu always needed)
yay -Syu --answerdiff None --answerclean All --noconfirm --needed \
vicinae-bin bluetuith wvkbd pinta udiskie \
bri chamel \
libastal-apps-git libastal-network-git libastal-bluetooth-git libastal-io-git
# ---------------------------------------------------------------------------
# 5. Theme and icon setup
# ---------------------------------------------------------------------------
log "Installing themes and icons..."
sudo cp -r ~/Dotfiles/gtk-themes/cyberqueer /usr/share/themes
sudo cp ~/Dotfiles/desktopenvs/hyprdrive/btop/themes/cyberqueer.theme /usr/share/btop/themes
sudo ln -sf /usr/bin/kitty /usr/bin/xdg-terminal-exec
sudo ln -sf /usr/bin/ksshaskpass /usr/lib/ssh/ssh-askpass
if have_user_bus; then
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' || true
else
skip "No session bus — set GTK dark mode after first login (gsettings)."
fi
# ---------------------------------------------------------------------------
# 6. Cursor setup
# ---------------------------------------------------------------------------
log "Installing cursor theme..."
mkdir -p ~/.icons
curl -fL -o ~/install-tmp/Nordzy-cursors-lefthand.tar.gz \
https://github.com/guillaumeboehm/Nordzy-cursors/releases/download/v2.3.0/Nordzy-cursors-lefthand.tar.gz
tar -zxf ~/install-tmp/Nordzy-cursors-lefthand.tar.gz -C ~/.icons/
# ---------------------------------------------------------------------------
# 7. Enable Bluetooth and wireless services
# ---------------------------------------------------------------------------
log "Enabling Bluetooth and wireless services..."
enable_service bluez
enable_service bluetooth.service
enable_service iwd.service
# ---------------------------------------------------------------------------
# 8. Copy configs
# ---------------------------------------------------------------------------
log "Copying configs..."
CONFIGS=(kitty mimeapps.list vicinae hypr xfce4 dunst alacritty orbit-menu horizon-dock astro-menu station-bar scripts btop gtk-3.0)
for cfg in "${CONFIGS[@]}"; do
rm -rf ~/.config/"$cfg"
cp -r ~/Dotfiles/desktopenvs/hyprdrive/"$cfg" ~/.config/
done
# Vicinae loads NAMED custom themes from ~/.local/share/vicinae/themes/*.toml —
# see hyprlua.sh for the same note.
mkdir -p ~/.local/share/vicinae/themes
cp -f ~/Dotfiles/desktopenvs/hyprdrive/vicinae/cyberqueer.toml \
~/.local/share/vicinae/themes/cyberqueer.toml
# Device-specific overrides live in hypr/usr/ (bundled inside hypr/ above).
cp ~/Dotfiles/colors.conf ~/.config/colors.conf
# ---------------------------------------------------------------------------
# 9. Wallpaper and resources
# ---------------------------------------------------------------------------
log "Copying wallpaper and resources..."
mkdir -p ~/Pictures
# Default wallpaper: ESA/Hubble "Rings of Relativity" (CC BY 4.0 — see
# desktopenvs/hyprdrive/wallpaper/CREDITS.md). hyprpaper.conf and hyprlock-
# backgrounds.conf both already default to ~/Pictures/background.jpg.
cp ~/Dotfiles/desktopenvs/hyprdrive/wallpaper/background.jpg ~/Pictures/background.jpg
# ---------------------------------------------------------------------------
# 10. Python venv for scripts
# ---------------------------------------------------------------------------
log "Setting up Python venv for scripts..."
python -m venv ~/.config/python-script
~/.config/python-script/bin/pip install \
speedtest-cli `# Internet speed test` \
requests `# HTTP client for helper scripts` \
pint `# Unit conversion library` \
simpleeval `# Safe maths expression evaluator` \
parsedatetime `# Natural-language date/time parser for timer scripts`
# ---------------------------------------------------------------------------
# 11. Udiskie icon fix
# ---------------------------------------------------------------------------
log "Applying Udiskie icon fix..."
PAPIRUS_DIR="/usr/share/icons/Papirus-Dark/status"
HICOLOR_DIR="/usr/share/icons/hicolor/scalable/status"
if [ -d "$PAPIRUS_DIR" ]; then
sudo ln -sf "$PAPIRUS_DIR/checkbox-checked.svg" "$HICOLOR_DIR/udiskie-checkbox-checked.svg"
sudo ln -sf "$PAPIRUS_DIR/checkbox-unchecked.svg" "$HICOLOR_DIR/udiskie-checkbox-unchecked.svg"
sudo gtk-update-icon-cache -f -t /usr/share/icons/hicolor
else
warn "Papirus-Dark not found — skipping udiskie icon fix."
fi
# ---------------------------------------------------------------------------
# 12. Enable udiskie
# ---------------------------------------------------------------------------
log "Enabling udiskie service..."
enable_service udiskie.service
start_service udiskie.service
# ---------------------------------------------------------------------------
# 13. Install config updater and theme script
# ---------------------------------------------------------------------------
log "Installing config updater and theme script..."
mkdir -p ~/.config/config-updater
ln -sf ~/Dotfiles/desktopenvs/hyprdrive/config-updater/updater.conf ~/.config/config-updater/updater.conf
ln -sf ~/Dotfiles/desktopenvs/hyprdrive/config-updater/update-configs.sh ~/update-configs.sh
cp ~/Dotfiles/apply-theme.sh ~/apply-theme.sh
chmod +x ~/apply-theme.sh
log "HyprDrive installation complete. Reboot to start."