# User defaults: login shell, file manager, mime handlers, user services.

# Login shell = zsh. The Hyprland autostart lives in ~/.zprofile, which only zsh
# reads at login; with the default bash shell you'd just land on a prompt.
if [ "$(getent passwd "$USER" | cut -d: -f7)" != /usr/bin/zsh ]; then
  sudo chsh -s /usr/bin/zsh "$USER" && info "login shell set to zsh"
fi

# Default file manager = GNOME Files (Nautilus). Set explicitly so no other app
# that claims inode/directory (e.g. easytag) wins. (arch_notes.md)
xdg-mime default org.gnome.Nautilus.desktop inode/directory

# Default interface fonts = Adwaita (GNOME 48's default). Under a non-GNOME
# session nothing sets these, so libadwaita/GNOME apps (Nautilus, …) would fall
# back to generic Sans. gtk-*/settings.ini covers the GTK toolkit font;
# gsettings covers the document/monospace fonts read via dconf/the portal.
# color-scheme=prefer-dark is the authoritative dark-mode signal: GTK4/libadwaita
# apps read it directly, and xdg-desktop-portal reports it via the appearance API
# (so GTK3 and Qt apps that ask the portal go dark too). See gtk-*/settings.ini
# for the GTK toolkit dark toggle and ~/.config/kdeglobals for KDE apps.
if command -v gsettings >/dev/null 2>&1; then
  gsettings set org.gnome.desktop.interface font-name 'Adwaita Sans 11' \
    && gsettings set org.gnome.desktop.interface document-font-name 'Adwaita Sans 11' \
    && gsettings set org.gnome.desktop.interface monospace-font-name 'SF Mono 11' \
    && gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' \
    && info "interface fonts → Adwaita Sans / SF Mono, color-scheme → prefer-dark" \
    || echo "   skip: could not set gsettings interface prefs"
fi

# User services that ship as ~/.config/systemd/user units (from dotfiles).
systemctl --user daemon-reload
systemctl --user enable shairport-sync.service 2>/dev/null \
  && info "enabled shairport-sync (user)" || echo "   skip: shairport-sync user unit"

# Let PAM own gnome-keyring-daemon (see 02-system/20-config.sh); disable the user
# socket so it isn't also started here — avoids a double instance / double prompt.
systemctl --user disable --now gnome-keyring-daemon.socket 2>/dev/null \
  && info "disabled gnome-keyring-daemon.socket (PAM starts the daemon)" \
  || echo "   skip: gnome-keyring-daemon.socket already off"
