From 08ae066a7a1f233986969898a4cd8de500db4c71 Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Thu, 16 Apr 2020 00:30:47 +0200 Subject: [PATCH] [X11]: rewrote xinitrc, moved to xprofile instead of xsession --- .install.conf.yaml | 2 +- X11/xinitrc | 74 +++++++++++++--------------------------------- X11/xprofile | 25 ++++++++++++++++ X11/xsession | 5 ---- 4 files changed, 47 insertions(+), 59 deletions(-) create mode 100644 X11/xprofile delete mode 100644 X11/xsession diff --git a/.install.conf.yaml b/.install.conf.yaml index b66998d..46221e4 100644 --- a/.install.conf.yaml +++ b/.install.conf.yaml @@ -22,7 +22,7 @@ ~/.tmux.conf: tmux/tmux.conf ~/.vimrc: vim/vimrc ~/.xinitrc: X11/xinitrc - ~/.xsession: X11/xsession + ~/.xprofile: X11/xprofile ~/.Xresources: X11/Xresources ~/.Xresources.d/urxvt: urxvt/Xresources ~/.config/user-dirs.dirs: X11/user-dirs.dirs diff --git a/X11/xinitrc b/X11/xinitrc index bf8a3bd..5c6653a 100644 --- a/X11/xinitrc +++ b/X11/xinitrc @@ -1,5 +1,11 @@ #!/bin/sh -#Standard Stuff + +# Default values for session and term +[ "$1" ] || set -- cinnamon + +TERM=urxvt + +# Source the Standard Stuff from this machine . /etc/X11/xinit/xinitrc-common if [ -f $HOME/.Xclients ]; then exec $CK_XINIT_SESSION $SSH_AGENT $HOME/.Xclients || \ @@ -15,60 +21,22 @@ else [ -x /usr/bin/xterm ] && xterm -geometry 80x50-50+150 & [ -x /usr/bin/twm ] && /usr/bin/twm fi -# --------------------------------------------------------------- -# OWN -# --------------------------------------------------------------- -# Load Main Xresources -[ -f ~/.Xresources ] && xrdb -merge $HOME/.Xresources +# Source the xprofile files +[ -f /etc/xprofile ] && . /etc/xprofile +[ -f ~/.xprofile ] && . ~/.xprofile -# Load specific Xresources -XRESD="$HOME/.Xresources.d/" -for f in "$XRESD*" -do - xrdb -merge "$f" -done - -numlockx on # turn on numlock -setxkbmap -option caps:escape # caps lock works as escape - - -# Load session -DEFAULT_SESSION="awesome >> $HOME/.cache/awesome/stdout 2>> $HOME/.cache/awesome/stderr" -XTERM=xterm +# Set Desktop or Window Manager case $1 in - xfce4) - RUN=startxfce4 - ;; - awesome) - xscreensaver -nosplash & - nm-applet & - RUN=awesome - ;; - enlightenment) - RUN=enlightenment_start - ;; - openbox) - RUN=openbox - ;; - cinnamon) - RUN=cinnamon - ;; - kde) - RUN=startkde - ;; - gnome) - RUN=gnome-session - ;; - unity) - RUN=unity - ;; - xterm) - RUN=xterm - ;; - *) - RUN=$DEFAULT_SESSION - ;; + cinnamon) set -- cinnamon-session;; + gnome) set -- gnome-session;; + kde) set -- startkde;; + xfce) set -- xfce4-session;; + awesome) set -- awesome;; + enlightenment) set -- enlightenment_start;; esac -exec "$RUN" || exec "$XTERM" +# Run the session, if it doesn't work try TERM, +# finally fallback to xterm if there's nothing +exec "$@" || exec "$TERM" || exec xterm + diff --git a/X11/xprofile b/X11/xprofile new file mode 100644 index 0000000..00be695 --- /dev/null +++ b/X11/xprofile @@ -0,0 +1,25 @@ +#~/bin/sh + +# This file is the equivalent of .profile when using X. +# It is hopefully sourced by the DE. +# It is definitely sourced from .xinitrc + +# Merge the Main Xresources +[ -f ~/.Xresources ] && xrdb -merge $HOME/.Xresources + +# Turn on numlock +numlockx on + +# Caps Lock works as escape key: whoever uses CapsLock? +setxkbmap -option caps:escape + +# Start redshift if it exists +if [[ $(command -v redshift) ]]; then + redshift & +fi +# See if we can set the background using feh +[ -x ~/.fehbg ] && ~/.fehbg + +# Source the local xprofiles +[ -r ~/.xprofile.local ] && . ~/.xprofile.local +[ -r ~/.local/.xprofile ] && . ~/.local/.xprofile diff --git a/X11/xsession b/X11/xsession deleted file mode 100644 index 217b389..0000000 --- a/X11/xsession +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -if [[ $(command -v redshift) ]]; then - redshift & -fi