better xinit

This commit is contained in:
tavo 2025-09-27 17:23:49 -06:00
parent af42c0cde9
commit 21d5f4ed4f
9 changed files with 67 additions and 51 deletions

4
.gitignore vendored
View file

@ -276,9 +276,7 @@ nvim/lua/plugins/example.lua
cvim/
!cvim/vimrc
tailscale/
X11/xinit/xinitrc.d/
!X11/xinit/xinitrc.d/default.sh
!X11/xinit/xinitrc.d/example.sh
X11/xinit/xinitrc.d/*local.sh
*.bak
lazydocker/
sunshine/

View file

@ -8,41 +8,50 @@
# . /etc/X11/Xsession
# fi
userresources=$XDG_CONFIG_HOME/X11/Xresources
ERRFILE=$XDG_CACHE_HOME/X11/xsession-errors
usermodmap=$XDG_CONFIG_HOME/X11/Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
OPTIONFILE=/etc/X11/Xsession.options
if [ -f $sysresources ] ; then
xrdb -merge $sysresources
SYSRESOURCES=/etc/X11/Xresources
USRRESOURCES="$XDG_CONFIG_HOME"/X11/Xresources
SYSSESSIONDIR=/etc/X11/Xsession.d
USERXSESSION="$XDG_DATA_HOME"/xsession
USERXSESSIONRC="$XDG_CONFIG_HOME"/xsessionrc
ALTUSERXSESSION="$XDG_DATA_HOME"/Xsession
ERRFILE="$XDG_CACHE_HOME"/X11/xsession-errors
if ! [ -d "${ERRFILE%/*}" ] || ! touch "$ERRFILE"; then
if mkdir -p "${ERRFILE%/*}"; then
if ! touch "$ERRFILE"; then
return 1
fi
else
return 1
fi
fi
if [ -f $sysmodmap ] ; then
xmodmap $sysmodmap
fi
exec >>"$ERRFILE" 2>&1
if [ -f "$userresources" ] ; then
xrdb -merge "$userresources"
for res in "$SYSRESOURCES" "$USRRESOURCES"; do
if [ -f "$res" ]; then
xrdb -merge "$res"
fi
done
unset res
if [ -f "$usermodmap" ] ; then
xmodmap "$usermodmap"
sys_xinit_d="/etc/X11/xinit/xinitrc.d"
usr_xinit_d="$XDG_CONFIG_HOME/X11/xinit/xinitrc.d"
for dir in "$sys_xinit_d" "$usr_xinit_d"; do
if [ -d "$dir" ]; then
for f in "$dir"/?*.sh; do
if [ -x "$f" ]; then
. "$f"
fi
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
if [ -d ~/.config/X11/xinit/xinitrc.d ] ; then
for f in ~/.config/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
unset dir
while true; do
i3 >/dev/null 2>&1

View file

@ -3,11 +3,10 @@
# Example initialization script.
#
# In order to run commands on start, create scripts such
# as this one in the .config/X11/init.d directory and make
# as this one in the .config/X11/xinit/xinitrc.d directory and make
# them executable.
# Keyboard configuration
#xset r rate 300 70
# English keymap
#setxkbmap en
# Monitors
@ -20,5 +19,4 @@
# Startup programs
#STATUS_BLOCKS="tray vol mic net bat kbd time date" dwmstatus & # Status bar
#emacs --daemon &
#clipse -listen &
#dunst

5
X11/xinit/xinitrc.d/01-dbus.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
# updates the list of environment variables used by dbus
dbus-update-activation-environment --systemd --all
systemctl --user import-environment DISPLAY

View file

@ -0,0 +1,7 @@
#!/bin/sh
if command -v lxpolkit >/dev/null; then
lxpolkit &
else
echo "error: lxpolkit not found"
fi

View file

@ -0,0 +1,3 @@
#!/bin/sh
xset r rate 300 70

View file

@ -0,0 +1,7 @@
#!/bin/sh
if command -v clipse >/dev/null; then
clipse -listen-shell &
else
echo "error: clipse not found"
fi

View file

@ -0,0 +1,5 @@
#!/bin/sh
# A bit of grace time to press Ctrl+C if needed
# after startx
sleep 0.2

View file

@ -1,16 +0,0 @@
#!/bin/sh
#
# Default initialization script
#
# These commands are required at startup,
# If removed, you might run into errors.
# Environment for dbus and xdg-desktop-portal
dbus-update-activation-environment --systemd --all
systemctl --user import-environment DISPLAY
# Policy kit
lxpolkit &
# A bit of grace time to press Ctrl+C if needed
sleep 0.2