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/
!cvim/vimrc !cvim/vimrc
tailscale/ tailscale/
X11/xinit/xinitrc.d/ X11/xinit/xinitrc.d/*local.sh
!X11/xinit/xinitrc.d/default.sh
!X11/xinit/xinitrc.d/example.sh
*.bak *.bak
lazydocker/ lazydocker/
sunshine/ sunshine/

View file

@ -8,41 +8,50 @@
# . /etc/X11/Xsession # . /etc/X11/Xsession
# fi # fi
userresources=$XDG_CONFIG_HOME/X11/Xresources OPTIONFILE=/etc/X11/Xsession.options
ERRFILE=$XDG_CACHE_HOME/X11/xsession-errors
usermodmap=$XDG_CONFIG_HOME/X11/Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
if [ -f $sysresources ] ; then SYSRESOURCES=/etc/X11/Xresources
xrdb -merge $sysresources 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 fi
if [ -f $sysmodmap ] ; then exec >>"$ERRFILE" 2>&1
xmodmap $sysmodmap
fi
if [ -f "$userresources" ] ; then for res in "$SYSRESOURCES" "$USRRESOURCES"; do
xrdb -merge "$userresources" if [ -f "$res" ]; then
fi xrdb -merge "$res"
fi
done
unset res
if [ -f "$usermodmap" ] ; then sys_xinit_d="/etc/X11/xinit/xinitrc.d"
xmodmap "$usermodmap" usr_xinit_d="$XDG_CONFIG_HOME/X11/xinit/xinitrc.d"
fi
if [ -d /etc/X11/xinit/xinitrc.d ] ; then for dir in "$sys_xinit_d" "$usr_xinit_d"; do
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do if [ -d "$dir" ]; then
[ -x "$f" ] && . "$f" for f in "$dir"/?*.sh; do
if [ -x "$f" ]; then
. "$f"
fi
done done
unset f unset f
fi fi
done
if [ -d ~/.config/X11/xinit/xinitrc.d ] ; then unset dir
for f in ~/.config/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
while true; do while true; do
i3 >/dev/null 2>&1 i3 >/dev/null 2>&1

View file

@ -3,11 +3,10 @@
# Example initialization script. # Example initialization script.
# #
# In order to run commands on start, create scripts such # 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. # them executable.
# Keyboard configuration # English keymap
#xset r rate 300 70
#setxkbmap en #setxkbmap en
# Monitors # Monitors
@ -20,5 +19,4 @@
# Startup programs # Startup programs
#STATUS_BLOCKS="tray vol mic net bat kbd time date" dwmstatus & # Status bar #STATUS_BLOCKS="tray vol mic net bat kbd time date" dwmstatus & # Status bar
#emacs --daemon & #emacs --daemon &
#clipse -listen &
#dunst #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