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

View File