Files
darkforge/configs/zprofile
2026-03-20 09:45:20 +01:00

67 lines
2.5 KiB
Bash

# ============================================================================
# DarkForge Linux — User Shell Profile (~/.zprofile)
# ============================================================================
# Sourced on login to zsh. Auto-starts the full desktop session on tty1:
# D-Bus user session → PipeWire audio → polkit agent → dwl compositor
# ============================================================================
# --- XDG directories --------------------------------------------------------
export XDG_SESSION_TYPE=wayland
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
export XDG_CONFIG_HOME="${HOME}/.config"
export XDG_CACHE_HOME="${HOME}/.cache"
export XDG_DATA_HOME="${HOME}/.local/share"
export XDG_STATE_HOME="${HOME}/.local/state"
export XDG_CURRENT_DESKTOP=dwl
# --- NVIDIA Wayland environment ---------------------------------------------
export GBM_BACKEND=nvidia-drm
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export WLR_NO_HARDWARE_CURSORS=1
export LIBVA_DRIVER_NAME=nvidia
# Hardware video decoding (Firefox, mpv)
export MOZ_ENABLE_WAYLAND=1
# Firefox: use native Wayland backend
export QT_QPA_PLATFORM=wayland
# Qt applications: use Wayland backend
export SDL_VIDEODRIVER=wayland
# SDL2 games: prefer Wayland (falls back to X11 via XWayland)
# --- Seatd environment (seat manager for wlroots) --------------------------
export LIBSEAT_BACKEND=seatd
# Tell wlroots/dwl to use seatd for device access
# --- Ensure XDG runtime directory exists ------------------------------------
if [ ! -d "${XDG_RUNTIME_DIR}" ]; then
mkdir -p "${XDG_RUNTIME_DIR}"
chmod 700 "${XDG_RUNTIME_DIR}"
fi
# --- Auto-start Wayland compositor on tty1 ----------------------------------
if [ -z "${WAYLAND_DISPLAY}" ] && [ "$(tty)" = "/dev/tty1" ]; then
# Start user D-Bus session (required by PipeWire, polkit, desktop apps)
if [ -z "${DBUS_SESSION_BUS_ADDRESS}" ]; then
eval "$(dbus-launch --sh-syntax)"
export DBUS_SESSION_BUS_ADDRESS
fi
# Start PipeWire audio stack (runs as user, not system service)
pipewire &
sleep 0.2
pipewire-pulse &
# PulseAudio compatibility server — needed by Firefox, Steam, most apps
wireplumber &
# Session manager — handles audio routing and device management
# Start polkit authentication agent (for GUI password prompts)
lxqt-policykit-agent &>/dev/null &
# Start the dwl Wayland compositor
# -s "startup_cmd" runs a command after dwl starts (opens a terminal)
exec dwl 2>/dev/null
fi