From bd1551bbb8883da692645b26b1577c4f45e38689 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 1 Feb 2026 15:39:51 -0600 Subject: feat(hyprland): install plugins on first login via setup script hyprpm requires running Hyprland to determine version for plugin compilation. Move plugin installation from archsetup to a first-login script (hyprland-plugins-setup) that runs via exec-once. Script checks if plugins are already installed and skips if so. Update validation to check for setup script presence instead of enabled plugins. --- archsetup | 24 +-------- dotfiles/hyprland/.config/hypr/hyprland.conf | 2 +- .../hyprland/.local/bin/hyprland-plugins-setup | 61 ++++++++++++++++++++++ scripts/testing/lib/validation.sh | 33 +++++------- 4 files changed, 78 insertions(+), 42 deletions(-) create mode 100755 dotfiles/hyprland/.local/bin/hyprland-plugins-setup diff --git a/archsetup b/archsetup index ab00629..38ae597 100755 --- a/archsetup +++ b/archsetup @@ -1424,31 +1424,11 @@ hyprland() { aur_install nautilus-open-any-terminal # right-click "open in terminal" with configurable terminal # Hyprland Plugins (via hyprpm) - # Plugins require compilation, so cmake must be installed first + # Plugins are installed on first login via hyprland-plugins-setup script + # (hyprpm requires running Hyprland to determine version for compilation) action="Hyprland Plugins" && display "subtitle" "$action" pacman_install cmake # required for plugin compilation - # Add plugin repositories and enable plugins (runs as user) - action="installing hyprland-plugins repository" && display "task" "$action" - (sudo -u "$username" hyprpm add https://github.com/hyprwm/hyprland-plugins --notify >> "$logfile" 2>&1) || \ - error "warn" "$action" "$?" - - action="enabling hyprscrolling plugin" && display "task" "$action" - (sudo -u "$username" hyprpm enable hyprscrolling >> "$logfile" 2>&1) || \ - error "warn" "$action" "$?" - - action="enabling xtra-dispatchers plugin" && display "task" "$action" - (sudo -u "$username" hyprpm enable xtra-dispatchers >> "$logfile" 2>&1) || \ - error "warn" "$action" "$?" - - action="installing hy3 repository" && display "task" "$action" - (sudo -u "$username" hyprpm add https://github.com/outfoxxed/hy3 --notify >> "$logfile" 2>&1) || \ - error "warn" "$action" "$?" - - action="enabling hy3 plugin" && display "task" "$action" - (sudo -u "$username" hyprpm enable hy3 >> "$logfile" 2>&1) || \ - error "warn" "$action" "$?" - # Pacman hook to rebuild plugins after Hyprland updates # Prevents plugin version mismatch that causes plugins to fail loading action="creating hyprpm pacman hook" && display "task" "$action" diff --git a/dotfiles/hyprland/.config/hypr/hyprland.conf b/dotfiles/hyprland/.config/hypr/hyprland.conf index c9c3999..a8b3154 100644 --- a/dotfiles/hyprland/.config/hypr/hyprland.conf +++ b/dotfiles/hyprland/.config/hypr/hyprland.conf @@ -17,7 +17,7 @@ exec-once = systemctl --user start xdg-desktop-portal-hyprland xdg-desktop-porta # Core services exec-once = /usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh exec-once = dunst > ~/.local/var/log/dunst-$(date +%Y-%m-%d-%H%M%S).log 2>&1 -exec-once = hyprpm -n update && sleep 1 && hyprctl dismissnotify -1 +exec-once = hyprland-plugins-setup && sleep 1 && hyprctl dismissnotify -1 # Desktop appearance (after portal is ready) exec-once = swww-daemon && sleep 1 && swww img ~/pictures/wallpaper/trondheim-norway.jpg diff --git a/dotfiles/hyprland/.local/bin/hyprland-plugins-setup b/dotfiles/hyprland/.local/bin/hyprland-plugins-setup new file mode 100755 index 0000000..f0181c8 --- /dev/null +++ b/dotfiles/hyprland/.local/bin/hyprland-plugins-setup @@ -0,0 +1,61 @@ +#!/bin/bash +# hyprland-plugins-setup - Install Hyprland plugins on first login +# Called from hyprland.conf exec-once + +LOGFILE="$HOME/.local/var/log/hyprland-plugins-setup.log" +mkdir -p "$(dirname "$LOGFILE")" + +log() { + echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" >> "$LOGFILE" +} + +# Check if plugins already installed and enabled +if hyprpm list 2>/dev/null | grep -q "hyprscrolling"; then + if hyprpm list | grep -q "enabled: .*true"; then + log "Plugins already installed and enabled, skipping" + exit 0 + fi +fi + +log "Starting Hyprland plugin setup" + +# Add hyprland-plugins repository +log "Adding hyprland-plugins repository..." +if hyprpm add https://github.com/hyprwm/hyprland-plugins 2>&1 | tee -a "$LOGFILE"; then + log "hyprland-plugins repository added" +else + log "Failed to add hyprland-plugins repository" +fi + +# Enable plugins from hyprland-plugins +for plugin in hyprscrolling xtra-dispatchers; do + log "Enabling $plugin..." + if hyprpm enable "$plugin" 2>&1 | tee -a "$LOGFILE"; then + log "$plugin enabled" + else + log "Failed to enable $plugin" + fi +done + +# Add hy3 repository +log "Adding hy3 repository..." +if hyprpm add https://github.com/outfoxxed/hy3 2>&1 | tee -a "$LOGFILE"; then + log "hy3 repository added" +else + log "Failed to add hy3 repository" +fi + +# Enable hy3 +log "Enabling hy3..." +if hyprpm enable hy3 2>&1 | tee -a "$LOGFILE"; then + log "hy3 enabled" +else + log "Failed to enable hy3" +fi + +# Reload plugins into Hyprland +log "Reloading plugins..." +hyprpm reload 2>&1 | tee -a "$LOGFILE" + +log "Plugin setup complete" +notify-send "Hyprland Plugins" "Plugin setup complete" -t 3000 diff --git a/scripts/testing/lib/validation.sh b/scripts/testing/lib/validation.sh index 16b4122..de23809 100644 --- a/scripts/testing/lib/validation.sh +++ b/scripts/testing/lib/validation.sh @@ -535,29 +535,24 @@ validate_portal_dark_mode() { } validate_hyprland_plugins() { - step "Checking Hyprland plugins installed" - - # Check if hyprpm has repositories configured - local repos=$(ssh_cmd "sudo -u cjennings hyprpm list 2>/dev/null | grep -c 'Repository' || echo 0") - if [ "$repos" -lt 2 ]; then - validation_fail "Hyprland plugin repositories not configured (found $repos, expected 2)" - attribute_issue "hyprpm repositories not configured" "archsetup" + step "Checking Hyprland plugins setup script" + + # Plugins are installed on first login via hyprland-plugins-setup script + # (hyprpm requires running Hyprland to determine version for compilation) + # Validate that the setup script exists and is executable + local setup_script="/home/cjennings/.local/bin/hyprland-plugins-setup" + if ! ssh_cmd "test -x $setup_script"; then + validation_fail "Hyprland plugins setup script not found or not executable" + attribute_issue "hyprland-plugins-setup script missing" "archsetup" return 1 fi - # Check for expected enabled plugins - local missing="" - for plugin in hyprscrolling xtra-dispatchers hy3; do - if ! ssh_cmd "sudo -u cjennings hyprpm list 2>/dev/null | grep -A1 'Plugin $plugin' | grep -q 'enabled: true'"; then - missing="$missing $plugin" - fi - done - - if [ -z "$missing" ]; then - validation_pass "All Hyprland plugins enabled (hyprscrolling, xtra-dispatchers, hy3)" + # Check that hyprland.conf calls the setup script + if ssh_cmd "grep -q 'hyprland-plugins-setup' /home/cjennings/.config/hypr/hyprland.conf"; then + validation_pass "Hyprland plugins setup configured (installs on first login)" else - validation_fail "Hyprland plugins not enabled:$missing" - attribute_issue "Hyprland plugins not enabled:$missing" "archsetup" + validation_fail "hyprland.conf doesn't call hyprland-plugins-setup" + attribute_issue "hyprland-plugins-setup not in hyprland.conf" "archsetup" fi } -- cgit v1.2.3