if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

if [ -n "$DISPLAY" ] && [ -z "$GNOME_KEYRING_CONTROL" ]; then
    KEYRING_DIR="$HOME/.local/share/keyrings"
    LOGIN_KEYRING="$KEYRING_DIR/login.keyring"

    if [ ! -f "$LOGIN_KEYRING" ]; then
        # Создаем директорию
        mkdir -p "$KEYRING_DIR"

        # Создаем минимальный ключ-ринг
        cat > "$LOGIN_KEYRING" << 'EOF'
[keyring]
display-name=Вход
ctime=$TIMESTAMP
mtime=$TIMESTAMP
lock-on-idle=false
lock-after=false
EOF

        # Заменяем timestamp
        sed -i "s/TIMESTAMP/$(date +%s)/g" "$LOGIN_KEYRING"
    fi

    # Экспортируем переменные
    export GNOME_KEYRING_CONTROL="$XDG_RUNTIME_DIR/keyring"
    export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/keyring/ssh"

    # Запускаем daemon
    gnome-keyring-daemon --start --components=secrets >/dev/null 2>&1 &
fi