mirror of
https://github.com/gaschz/dotfiles.git
synced 2025-06-06 18:08:31 +02:00
81 lines
2.4 KiB
Bash
Executable File
81 lines
2.4 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
## SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
|
##
|
|
## SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
# shellcheck disable=SC1090,SC1091
|
|
## Sourced by display manager, xinit and startx.
|
|
|
|
## Load requirements.
|
|
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"
|
|
fi
|
|
|
|
## If running normal OS or Qubes: Dom0, apply settings.
|
|
# shellcheck disable=3028
|
|
hostname="${HOSTNAME:-$(hostname)}"
|
|
if ! command -v qubesdb-read >/dev/null || test "${hostname}" = "dom0"; then
|
|
## Decrease key repeat delay to X ms.
|
|
## Increase key repeat rate to Y per second.
|
|
xset r rate 275 60
|
|
|
|
## Give Caps Lock a better use.
|
|
## ctrl:swapcaps seems better than caps:swapescape because ctrl is
|
|
## difficult to reach and escape can be done with 'caps+['.
|
|
setxkbmap -keycodes "evdev+aliases(qwerty)" -model pc105 -layout us \
|
|
-variant ,qwerty -option "" -option "grp:win_space_toggle,ctrl:nocaps"
|
|
|
|
#qvm-prefs dom0 keyboard_layout "us+dvorak+grp:win_space_toggle,ctrl:nocaps"
|
|
fi
|
|
|
|
## Autostart desktop applications if the WM does not.
|
|
desktop_autostart(){
|
|
if test -e "${TMPDIR:-/tmp}/touch-desktop-autostart"; then
|
|
return 0
|
|
fi
|
|
|
|
touch -- "${TMPDIR:-/tmp}/touch-desktop-autostart"
|
|
autostart_etc="${XDG_CONFIG_DIRS-/etc/xdg}/autostart"
|
|
autostart_home="${XDG_CONFIG_HOME-${HOME}/.config}/autostart"
|
|
|
|
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}")"
|
|
command -v "${autostart_exec%% *}" >/dev/null || continue
|
|
${autostart_exec} &
|
|
done
|
|
}
|
|
|
|
## 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
|
|
desktop_autostart
|
|
while true; do
|
|
xroot_name="$(display-statusbar)"
|
|
xsetroot -name "${xroot_name}"
|
|
sleep 60
|
|
done &
|
|
fi
|
|
# shellcheck disable=SC2093
|
|
${wm} &
|
|
wm_pid="${!}"
|
|
done
|
|
|
|
test -z "${wm_pid:-}" || wait "${wm_pid}"
|