The officially official Devuan Forum!

You are not logged in.

#1 2017-06-27 07:14:57

PeteGozz
Member
From: Woodside South Australia
Registered: 2017-06-21
Posts: 72  

X without a Display Manager

I like to keep things light in desktop world.
You may not. Thats is more than fine. Its not called free software for nothing !
However, sometimes,  it feels as though loginkit and dbus is a soggy box, and certainly not a help.
So  you can live with and / or without them :

Here is part of one reasonably flexible solution.

Assuming you have:
    a/  xutils installed AND
    b/ you are allowed to login from the console.
        see: /etc/X11/Xwrapper.config
    c/ an optionally dbus free window manager

You should be able to simply login and
 
startx
or
xinit somexsessionhere -- :2

the icewm is a nice example
this _may_ override any commandline options (xinit)

# save to ~/.xinitrc  and or ~/.xsession
# ~$ man startx   for more information about why and what
# this file was originally from the sources of *slim display manager*
# edit to taste 
# usage: (where "foobar" will match your desired window manager)
# ~$  startx foobar
# ~$ xinit foo -- :1
# allocate to your default preference
# here 
DEFAULT_SESSION=openbox-session

case $1 in
    openb* | ob | foo)
    # see also: ~/.config/openbox/autostart 
        exec openbox-session
        ;;
    twm)
        # it is OK to not have xbindkeys
        xbindkeys || true  &
        xterm &
        exec twm
        ;;
     # examples 
    enlightenment)
        exec /usr/bin/enlightenment_start
        ;;
    enlightenment?*)
        exec /usr/local/bin/enlightenment_start
        ;;
    icewm)
        icewmbg &
        icewmtray &
        exec icewm
        ;;
    wmaker)
        exec wmaker
        ;;
    blackbox)
        exec blackbox
        ;;
    *)
        exec $DEFAULT_SESSION
        ;;
esac

of course you can simply try:
xinit -- :1
startx

for defaults
Or your window manager may provide an initialisation script
tab may be your friend smile

Upsides and uses include:
- testing window managers
and gui tools. (multiple logins and quick tests are easy to flip between)
- If you don't need  or want a full Desktop Manager with
DBUS and login "friends"
- Its OK with no {pulse,port}audio as well smile
you can uninstall all or some of the above  and _simplify your life_  or not. ;>
- You also wont need a Display Manager (slim or lightdm)
But you can still use them for other users. (or even yourself with a little thought)
and certainly wont need GDM or kdm etal.

Its your system its your code
break it your way.

Last edited by PeteGozz (2017-06-27 08:37:29)

Offline

#2 2017-06-27 12:28:09

msi
Member
Registered: 2017-02-04
Posts: 143  

Re: X without a Display Manager

PeteGozz wrote:

an optionally dbus free window manager

As far as I can see, all window managers are "dbus-free". dbus is, for example, required by file managers for mounting external devices. See: https://dev1galaxy.org/viewtopic.php?pid=1028

That's why you would probably want to have

exec dbus-launch --exit-with-session openbox-session

instead of just

exec openbox-session

inside your ~/.xinitrc file. At least when using Thunar or PCManFM.

Offline

#3 2017-06-27 15:13:46

PeteGozz
Member
From: Woodside South Australia
Registered: 2017-06-21
Posts: 72  

Re: X without a Display Manager

Yes that probably is wise.
There are many apps that use dbus.

I get by without it OK though just occasionally its  a bother.
I will post a better version in any case with dbus options.

Offline

#4 2017-06-27 15:36:45

PeteGozz
Member
From: Woodside South Australia
Registered: 2017-06-21
Posts: 72  

Re: X without a Display Manager

msi wrote:
PeteGozz wrote:

an optionally dbus free window manager

As far as I can see, all window managers are "dbus-free". dbus is, for example, required by file managers for mounting external devices. See: https://dev1galaxy.org/viewtopic.php?pid=1028

That's why you would probably want to have

exec dbus-launch --exit-with-session openbox-session

instead of just

exec openbox-session

inside your ~/.xinitrc file. At least when using Thunar or PCManFM.

The type of use case as discussed above would most probably use a Display Manager in any case.
(and dbus and udev etc)

I am not suggesting that a chopped down xinit type login would have all  conveniences.
I am certainly not suggesting this is a default setting for anybody but those who are curious
or working toward smaller footprints and perhaps developing  debugging.

Its also a dying skill set smile
(and I'm not excluding myself)
In any case the next post should go some way to covering your absolutely correct note.
(untested as I have no dbus to test )
And probably even buggier now .

I need to trace startx a little more carefully as well.

Its just a hack. Not for user land.

Offline

#5 2017-06-27 16:11:22

PeteGozz
Member
From: Woodside South Australia
Registered: 2017-06-21
Posts: 72  

Re: X without a Display Manager

edit:
There should be a useful version with somewhat more advanced dbus support at::

https://git.devuan.org/PeteGozz/slim/bl … trc.sample

/edit

So a slightly more baroque version.
Is nicer to the startx wrapper the  poor user and
should use dbus if its available.

(of course you can set that to "" or /bin/true)
or even better rewrite this into something useful for you.

Check and edit this to suit your needs.
Note that startx should use and digest all the system /etc/X11/Xsession.* stuff.
Not so sure about xinit.

This can also work for plain old X -query  type asks

Sheeze its been a while.

# usage: (where "foobar" will possibly match your desired window manager)
# ~$  startx foobar
# ~$ xinit foobar -- :1
# ~$ xinit -- :$(tty | tr -d /dev/tty)
# now with simple dbus detection 
# allocate to your default window manager
DEFAULT_SESSION=openbox-session

# dbus executable ?

if [ -x dbus-launch ];then
    DESKTOP_BUS="dbus-launch --exit-with-session"
else
    DESKTOP_BUS=""
fi

if [ -z $1 ];
then
    # no option for xinit then just jump to default
    exec $DESKTOP_BUS $DEFAULT_SESSION
elif [ -x $1 ];
then
    # $1 in our PATH and executable  
      case $1 in
        fluxbox )
            
            # see also: ~/.fluxbox/startup
            exec $DESKTOP_BUS startfluxbox
            ;;
        openbox )
            
            # see also: ~/.config/openbox/autostart
            exec openbox-session
            ;;
        twm)
            # it is OK to not have xbindkeys
            xbindkeys || true  &
            xterm -e /bin/bash &
            exec twm
            ;;
        icewm)
            icewmbg &
            icewmtray &
            exec $DESKTOP_BUS icewm
            ;;
        wmaker)
            exec wmaker
            ;;
        blackbox)
            exec blackbox
            ;;
        *)
            # we should not arrive here unless we fed $1 with a shell or something
            # but I'm just gunna pretend we never did and go default
            # 
            exec $DESKTOP_BUS $DEFAULT_SESSION

            ;;
      esac

elif [ ! -x $1 ];
then
# spit some help in the middle of all those Xorg messages
    echo ""
    echo Please Note: Unable to understand: $1
    echo Try xinit  or startx with no options for $DEFAULT_SESSION
    echo "or if server in use try:  xinit -- :$(tty | tr -d /dev/tty)"
    echo Or try:  startx $1   finally try:  startx sh
else
    # we have to hope $1 is some argument an xterm or xinit understands
    xterm -e $1 || xterm &
    # this is a guess and seems a little safer than nothing
    exec $DEFAULT_SESSION 
fi

### this should never do a thing but the use cases are vast and interesting
### as this sourced thing should have been abandoned  by exec millisecs ago

if [ "$?" != "0" ]; then
    echo -e "\ntry:\t xinit -- :$(tty | tr -d /dev/tty)"
    echo -e "or plain  startx "
fi

#eof

Last edited by PeteGozz (2017-07-14 14:35:01)

Offline

Board footer