User Tools

Site Tools


starting_x

Starting X

There's a bunch of things that get done by DE's under the covers that you need to straighten out when you're just using a WM like i3 or fluxbox etc. Things like dbus and wallets. These need some attention in the way the WM is started up but I like to do it the old fashioned way - that is explicitly, without relying on bonnet-welded-shut, secret-propriety, dont-scare-the-horses, patronising-we'll take-care-of-you bulldust. Once you've got the startup covered, it's a simple matter of selecting the tools you like. I'll post separately on how I deal with my laptop quirks (detecting and acting on lid, brightness, etc)

Firstly it depends how you login.

If logging in to a system console and then running 'startx' (or if coming in from VNC) I put this in ~/.xinitrc:

#!/usr/bin/env bash
# This is called by xinit (or startx or Xvnc). It should set up 
# everything that is set up by xdm etc.

ERRFILE="$HOME/.xsession-errors$DISPLAY"
exec &> $ERRFILE
set -x
XSESSION="$HOME/.xsession"

LAUNCHER="dbus-launch" # should maybe use /usr/libexec/at-spi-bus-launcher like lxdm does - but it's only for accessibility ie screen readers etc
if type $LAUNCHER &> /dev/null; then
    LAUNCHER+=" --sh-syntax --exit-with-session"
else
    LAUNCHER=exec
fi

[ -r "$XSESSION" ] && {
    chmod +x "$XSESSION"
    $LAUNCHER "$XSESSION"
    exit 0
}

… so that gets me (hopefully) to the same point that xdm/gxm/kdm/lxdm whatever would do.

Logging in from xdm/gdm etc:

I put this into /usr/share/xsessions/xsession.desktop so that the login manager gives me an 'xsession' option as well as whatever DE I have installed:

[Desktop Entry]
Encoding=UTF-8
Name=XSession
Comment=This session will run your ~/.xsession
Exec=$HOME/.xsession
Icon=
Type=Application

[Window Manager]
SessionManaged=true

I have this in ~/.config/desktop so I that .xsession starts the right one:

WM=i3
# WM=startfluxbox
# WM=starte16
# WM=enlightenment_start # e17
# WM=gnome-session
# WM=startkde
# WM=fvwm2
# WM=icewm-session
# WM=twm
# WM=dwm-start
# WM=awesome

Now for ~/.xsession: xsession

The final piece is to tell VNC what to do: ~/.vnc/xsession:

#!/bin/sh
#vncconfig -iconic &

WM=i3
#WM=startfluxbox
#WM=starte16
#WM=enlightenment_start # e17
#WM=gnome-session
#WM=mate-session
#WM=startkde
#WM=fvwm2
#WM=icewm-session
#WM=twm
#WM=dwm-start
#WM=awesome
export WM

# some remote vnc sessions were seeing this set to an invalid value
# (maybe it was for the local system rather than the remote!).
unset SSH_AUTH_SOCK

XINITRC=$HOME/.xinitrc
[ -r "$XINITRC" ] && {
    chmod +x "$XINITRC"
    exec "$XINITRC"
}
starting_x.txt · Last modified: 2016/05/10 18:11 by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki