summaryrefslogtreecommitdiffstatshomepage
path: root/sh/.profile
blob: 7095e1a3cc2a0a64128eafe28312260de67f80e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
# shellcheck disable=2046

# Use systemd-environment-d-generator(8) to generate environment, and export those variables
#
# See: https://wiki.archlinux.org/title/Environment_variables#Per_Wayland_session
for gen in /usr/lib/systemd/user-environment-generators/*; do
	if [ -e "$gen" ]; then
		export $($gen | xargs)
	fi
done

# Manually parse and export XDG user directories. xdg-user-dirs-update is disabled in
# $XDG_CONFIG_HOME/user-dirs.conf due to how it handles non-existant directories
#
# See: https://wiki.archlinux.org/title/XDG_user_directories
if [ -e "$HOME/.config/user-dirs.dirs" ]; then
	export $(xargs <"$HOME/.config/user-dirs.dirs")
fi

# Adopt the behavior of the system wide configuration for application specific settings
#
# See: https://wiki.archlinux.org/title/Command-line_shell#/etc/profile
for script in "$XDG_CONFIG_HOME"/profile.d/*.sh; do
	if [ -r "$script" ]; then
		# shellcheck disable=1090
		. "$script"
	fi
done