From 82e2fcfd0915047033599290109b4fb055fa3cf6 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 29 Jan 2026 10:23:52 -0600 Subject: fix(hyprland): resolve autologin startup issues - Use start-hyprland wrapper instead of Hyprland directly (fixes "started without start-hyprland" warning) - Add init-keyring script to create empty-password keyring (fixes keyring password prompt with autologin) - Add easyeffects config with noWindowAfterStarting=true (starts minimized instead of fullscreen) - Install python-secretstorage for init-keyring script Co-Authored-By: Claude Opus 4.5 --- .../hyprland/.config/easyeffects/db/easyeffectsrc | 5 +++ dotfiles/hyprland/.config/hypr/hyprland.conf | 1 + dotfiles/hyprland/.local/bin/init-keyring | 46 ++++++++++++++++++++++ .../hyprland/.profile.d/99-hyprland-autostart.sh | 13 ++---- 4 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 dotfiles/hyprland/.config/easyeffects/db/easyeffectsrc create mode 100755 dotfiles/hyprland/.local/bin/init-keyring (limited to 'dotfiles/hyprland') diff --git a/dotfiles/hyprland/.config/easyeffects/db/easyeffectsrc b/dotfiles/hyprland/.config/easyeffects/db/easyeffectsrc new file mode 100644 index 0000000..71fa605 --- /dev/null +++ b/dotfiles/hyprland/.config/easyeffects/db/easyeffectsrc @@ -0,0 +1,5 @@ +[StreamInputs] +inputDevice=easyeffects_sink + +[Window] +noWindowAfterStarting=true diff --git a/dotfiles/hyprland/.config/hypr/hyprland.conf b/dotfiles/hyprland/.config/hypr/hyprland.conf index de2e3fa..1c3408e 100644 --- a/dotfiles/hyprland/.config/hypr/hyprland.conf +++ b/dotfiles/hyprland/.config/hypr/hyprland.conf @@ -16,6 +16,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 = init-keyring exec-once = dunst > ~/.local/var/log/dunst-$(date +%Y-%m-%d-%H%M%S).log 2>&1 exec-once = hyprpm reload && sleep 2 && hyprctl dismissnotify -1 diff --git a/dotfiles/hyprland/.local/bin/init-keyring b/dotfiles/hyprland/.local/bin/init-keyring new file mode 100755 index 0000000..c8bb733 --- /dev/null +++ b/dotfiles/hyprland/.local/bin/init-keyring @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 +"""Initialize gnome-keyring with empty password for autologin systems. + +This script creates the 'login' keyring collection with an empty password, +allowing gnome-keyring to auto-unlock without PAM password entry. + +Only runs once - exits immediately if login keyring already exists. +""" + +import os +import sys + +# Check if login keyring already exists +keyring_dir = os.path.expanduser("~/.local/share/keyrings") +login_keyring = os.path.join(keyring_dir, "login.keyring") + +if os.path.exists(login_keyring): + sys.exit(0) + +try: + import secretstorage +except ImportError: + print("python-secretstorage not installed", file=sys.stderr) + sys.exit(1) + +try: + connection = secretstorage.dbus_init() + + # Check if login collection exists via D-Bus + collections = list(secretstorage.get_all_collections(connection)) + for collection in collections: + if collection.get_label() == "login" or collection.get_label() == "Login": + # Already exists + sys.exit(0) + + # Create login collection with empty password + secretstorage.create_collection(connection, "Login", password=b"") + + # Set as default + os.makedirs(keyring_dir, exist_ok=True) + with open(os.path.join(keyring_dir, "default"), "w") as f: + f.write("login") + +except Exception as e: + print(f"Failed to initialize keyring: {e}", file=sys.stderr) + sys.exit(1) diff --git a/dotfiles/hyprland/.profile.d/99-hyprland-autostart.sh b/dotfiles/hyprland/.profile.d/99-hyprland-autostart.sh index 9d80353..753fdce 100644 --- a/dotfiles/hyprland/.profile.d/99-hyprland-autostart.sh +++ b/dotfiles/hyprland/.profile.d/99-hyprland-autostart.sh @@ -6,21 +6,14 @@ [ -z "$SSH_TTY" ] || return 0 [ -z "$WAYLAND_DISPLAY" ] || return 0 [ -z "$DISPLAY" ] || return 0 -command -v Hyprland >/dev/null 2>&1 || return 0 +command -v start-hyprland >/dev/null 2>&1 || return 0 # Skip if flag file exists (touch ~/.skip-hyprland to disable) [ -f "$HOME/.skip-hyprland" ] && return 0 -# Setup logging (same pattern as start-hyprland wrapper) -_hypr_log_dir="$HOME/.local/var/log" -mkdir -p "$_hypr_log_dir" -_hypr_log="$_hypr_log_dir/hyprland-$(date +%Y-%m-%d-%H%M%S).log" - -# Clear screen and start Hyprland (no exec = return to shell on exit) +# Clear screen and start Hyprland via watchdog wrapper clear -Hyprland >"$_hypr_log" 2>&1 +start-hyprland # Hyprland exited - inform user echo "Hyprland session ended. Type 'start-hyprland' to restart." - -unset _hypr_log_dir _hypr_log -- cgit v1.2.3