feat: source X11 profiles directory

This commit is contained in:
Ben Grande 2024-02-18 14:58:57 +01:00
parent 076ea43eaf
commit 3d49981cab
No known key found for this signature in database
GPG Key ID: 00C64E14F51F9E56
3 changed files with 19 additions and 15 deletions

View File

View File

@ -8,12 +8,12 @@
## Sourced by display manager, xinit and startx.
## Load requirements.
test -r "$HOME/.profile" && . "$HOME/.profile"
: "${XDG_CONFIG_HOME:=$HOME/.config}"
test -r "${HOME}/.profile" && . "${HOME}/.profile"
: "${XDG_CONFIG_HOME:=${HOME}/.config}"
## Load resources.
if command -v xrdb >/dev/null; then
xrdb "$XDG_CONFIG_HOME/x11/xresources"
xrdb "${XDG_CONFIG_HOME}/x11/xresources"
fi
## If running normal OS or Qubes: Dom0, apply settings.
@ -39,26 +39,30 @@ desktop_autostart(){
touch "${TMPDIR:-/tmp}/touch-desktop-autostart"
autostart_etc="${XDG_CONFIG_DIRS-/etc/xdg}/autostart"
autostart_home="${XDG_CONFIG_HOME-$HOME/.config}/autostart"
autostart_home="${XDG_CONFIG_HOME-${HOME}/.config}/autostart"
for f in "$autostart_etc"/*.desktop "$autostart_home"/*.desktop; do
test -r "$f" || continue
for f in "${autostart_etc}"/*.desktop "${autostart_home}"/*.desktop; do
test -r "${f}" || continue
# shellcheck disable=SC2091
autostart_exec="$(awk -F '=' '/^Exec=/{print $2}' "$f")"
autostart_exec="$(awk -F '=' '/^Exec=/{print ${2}}' "${f}")"
command -v "${autostart_exec%% *}" >/dev/null || continue
${autostart_exec} &
done
}
## Source local profile.
if test -r "$HOME/.xprofile.local"; then
. "$HOME/.xprofile.local"
## Source Xorg profiles.
if test -r "${HOME}/.xprofile.local"; then
. "${HOME}/.xprofile.local"
for x11_profile in "${XDG_CONFIG_HOME}/x11/xprofile.d"/*.sh; do
# shellcheck disable=SC1090,SC1091
! test -r "${x11_profile}" || . "${x11_profile}"
done
fi
: "${wm_list:="dwm"}"
for wm in $wm_list; do
command -v "$wm" >/dev/null || break
if test "$wm" = "dwm" && command -v xsetroot >/dev/null; then
for wm in ${wm_list}; do
command -v "${wm}" >/dev/null || break
if test "${wm}" = "dwm" && command -v xsetroot >/dev/null; then
desktop_autostart
while true; do
xsetroot -name "$(display-statusbar)"
@ -66,8 +70,8 @@ for wm in $wm_list; do
done &
fi
# shellcheck disable=SC2093
$wm &
${wm} &
wm_pid="$!"
done
test -z "$wm_pid" || wait "$wm_pid"
test -z "${wm_pid:-}" || wait "${wm_pid}"

View File