This repository has been archived on 2022-12-11. You can view files and clone it, but cannot push or open issues or pull requests.
dot-files/.xinitrc

88 lines
2.3 KiB
Bash
Executable File

#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
# GENERIC #
# Usage: .xinitrc [window-manager] [session-type]
# where: window-manager is one of '(xmonad openbox stumpwm awesome pekwm)
# session-type is either "local" or "remote"; upon "" defaults to "local"
# Runs system-wide xinitrc scripts
if [ -d /etc/X11/xinit/xinitrc.d ]; then
for f in /etc/X11/xinit/xinitrc.d/*; do
[ -x "$f" ] && . "$f"
done
unset f
fi
# Set the default curson used by all WM's
xsetroot -cursor_name left_ptr
# Initialize a local desktop session (run generic helper applications)
function init_local_session() {
# Start a user instance of systemd, which in turns starts:
# * xcompmgr
# * xscreensaver
# * unclutter
# * xbindkeys
# * urxvtd
# * emacsd
# * trayer *disabled* ..
# * udiskie
systemd --user &
# Set a desktop background
nitrogen --restore &
# Setup system tray *DISABLED* :: whats the point of a systray if no apps use it?
#trayer --monitor 1 --edge top --align right --expand true --width 4 --height 2 --transparent true --tint 0x000000 &
# Create variable GENERAL_SCREEN which is the pid of a screen called "general"
GENERAL_SCREEN=`screen -ls | grep general | cut -f1 -d'.' | sed 's/\W//g'`
# Check to see if a general screen is already running
if [ "x$GENERAL_SCREEN" == "x" ]; then
screen -dmS general &
fi
# Set the default wm to xmonad
DEFAULT_WM=xmonad
}
# Initialize a remote desktop session (run generic helper applications)
function init_remote_session() {
# Set desktop background
feh --bg-scale ~/.wallback/Cocaine_Wallpaper_II_by_mdornfeld.png &
# Set the default wm to xmonad
DEFAULT_WM=stumpwm
}
# Check the second cl parameter which denotes the session-type (E.g. remote, local)
case "$2" in
# Remote session
remote)
init_remote_session
break
;;
# Local session or unspecified
*)
init_local_session
;;
esac
# Check the first cl parameter which denotes the window-manager to use
# Notice: in each case expression below "exec app" hands over execution to some app thus
# ceasing execution in this script so no "break" is required
case "$1" in
xmonad|openbox|stumpwm|awesome|pekwm)
exec "$1"
;;
*)
exec "$DEFAULT_WM"
;;
esac