You are not logged in.

#1 2020-08-05 08:34:14

adigitoleo
Member
From: Australia
Registered: 2020-08-02
Posts: 47

[SOLVED] Autostarting X from .zlogin or .zprofile (zsh)

Hello,

I am trying to run startx automatically after login (via tty). I followed the wiki at
https://wiki.archlinux.org/index.php/Xi … X_at_login
however startx is not being run upon login. Any ideas?

Edit: I should clarify, running the snippet that I have in .zlogin (also tried .zprofile) in the tty does in fact start the WM as expected.

echo $SHELL

/bin/zsh

cat ~/.zlogin
( => Update: .zlogin should not be used for this, use .zprofile instead,
see https://wiki.archlinux.org/index.php/Zs … down_files)

# Autostart X using startx after tty login.
if systemctl -q is-active graphical.target && [[ ! $DISPLAY && $XDG_VNTR -eq 1 ]]; then
	exec startx
fi

cat ~/.xinitrc

#!/bin/sh

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi

if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi

if [ -f "$userresources" ]; then
    xrdb -merge "$userresources"
fi

if [ -f "$usermodmap" ]; then
    xmodmap "$usermodmap"
fi

# start any globally installed programs

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
 for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
  [ -x "$f" ] && . "$f"
 done
 unset f
fi

# start userspace background programs

xbindkeys &  # allow custom keybindings in the X session
udiskie &  # allow automatic mounting of portable drives

# set the desktop background

~/.fehbg &  # restores wallpaper last set by feh

# start the window manager

exec /usr/bin/i3

Last edited by adigitoleo (2020-08-05 11:29:30)

Offline

#2 2020-08-05 09:31:26

tucuxi
Member
From: Switzerland
Registered: 2020-03-08
Posts: 291

Re: [SOLVED] Autostarting X from .zlogin or .zprofile (zsh)

Two ideas:

If ZROOTDIR is set, make sure that .zlogin is in that directory.

pacman -Q xorg-xinit

Offline

#3 2020-08-05 10:35:05

adigitoleo
Member
From: Australia
Registered: 2020-08-02
Posts: 47

Re: [SOLVED] Autostarting X from .zlogin or .zprofile (zsh)

Ok so I verified that xorg-xinit is installed:

pacman -Q xorg-xinit

xorg-xinit 1.4.1-2

Haven't heard of ZROOTDIR before, but echo $ZROOTDIR gives nothing...

Well, I'll keep searching. Meanwhile doing startx by hand isn't all that bad. Might try if it works using bash...

Offline

#4 2020-08-05 10:35:15

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,429

Re: [SOLVED] Autostarting X from .zlogin or .zprofile (zsh)

Either remove the graphical target check or ensure you've actually enabled graphical target as the boot up goal: https://wiki.archlinux.org/index.php/Sy … _boot_into

Offline

#5 2020-08-05 10:44:34

adigitoleo
Member
From: Australia
Registered: 2020-08-02
Posts: 47

Re: [SOLVED] Autostarting X from .zlogin or .zprofile (zsh)

Hmm, so I think the target is correct, I don't have any kernel params that set other targets, also

systemctl get-default

graphical.target

Also tried removing that check just in case, still stays in the tty.

Offline

#6 2020-08-05 10:49:35

adigitoleo
Member
From: Australia
Registered: 2020-08-02
Posts: 47

Re: [SOLVED] Autostarting X from .zlogin or .zprofile (zsh)

I feel like I'm missing something obvious. I should mention that I also set up automatic login to the tty (only username not password) through getty as per:
https://wiki.archlinux.org/index.php/Ge … al_console
https://wiki.archlinux.org/index.php/Ge … sole_login

Edit: corrected link

Last edited by adigitoleo (2020-08-05 10:58:02)

Offline

#7 2020-08-05 11:07:37

adigitoleo
Member
From: Australia
Registered: 2020-08-02
Posts: 47

Re: [SOLVED] Autostarting X from .zlogin or .zprofile (zsh)

OK so the wiki here:
https://wiki.archlinux.org/index.php/Zs … down_files
says that .zlogin should not be used to start graphical sessions, so I'll move back to .zprofile for startx. I do not have ZDOTDIR set, but it says that HOME is used as a fallback.

Update: tried .zprofile without the graphical target check, still no luck.

Last edited by adigitoleo (2020-08-05 11:13:49)

Offline

#8 2020-08-05 11:17:26

seth
Member
Registered: 2012-09-03
Posts: 50,012

Re: [SOLVED] Autostarting X from .zlogin or .zprofile (zsh)

V1del wrote:

remove the graphical target check

https://bbs.archlinux.org/viewtopic.php?id=253417

Offline

#9 2020-08-05 11:28:41

adigitoleo
Member
From: Australia
Registered: 2020-08-02
Posts: 47

Re: [SOLVED] Autostarting X from .zlogin or .zprofile (zsh)

Oh shoot, sorry I missed that post. The following conditional that you suggested over there works perfectly:

if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]]; then

Sure it only works from tty1, but so does my autologin now that I think about it.

Cheers, closing.

Offline

Board footer

Powered by FluxBB