You are not logged in.

#1 2019-07-09 06:44:23

Brocellous
Member
Registered: 2017-11-27
Posts: 32

How to get a 'graphical session'?

Alright, so I noticed that the sway package in the git.archlinux.org repo added 'sway.service' and 'sway-session.target' files like so:
sway.service

# https://github.com/swaywm/sway/wiki/Systemd-integration

[Unit]
Description=sway - SirCmpwn's Wayland window manager
Documentation=man:sway(5)
BindsTo=graphical-session.target
Wants=graphical-session-pre.target
After=graphical-session-pre.target

[Service]
Type=simple
EnvironmentFile=-%h/.config/sway/env
ExecStart=/usr/bin/sway
Restart=on-failure
RestartSec=1
TimeoutStopSec=10

sway-session.target

# https://github.com/swaywm/sway/wiki/Systemd-integration

[Unit]
Description=sway compositor session
Documentation=man:systemd.special(7)
BindsTo=graphical-session.target
Wants=graphical-session-pre.target
After=graphical-session-pre.target

I checked out the link provided and thought it sounded like a good idea, so I switched over some starting services to systemd user-services with drop in override files like so:

[Install]
WantedBy=graphical-session.target

And that was successful. Seems to work fine and I can do dependencies nicely and in theory they'd autostart on another WM that triggers graphical-session.target so I don't need to copy the startup from my sway config. Neat.

I liked it so much I thought I'd go ahead an start sway itself as a user-service (in place of `if [$tty = /dev/tty1 ]; then exec sway; fi` in my ~/.zprofile) via

[Install]
WantedBy=default.target

on top of the sway.service file above, but no such luck. While enabled I get:

Jun 19 00:47:10 rxps sway[1052]: 2019-06-19 00:47:10 - [wlroots-0.6.0/backend/session/logind.c:576] Session '1' isn't a graphical session (type: 'tty')

And it's the same result if I just try `systemctl start sway.service` from the tty after I log in.

The error is accurate, I guess, so it might seem dead obvious it would fail -- but then why is it that `exec sway` works fine? How can I set it up so I get a 'graphical session' when I log in instead of type 'tty'? I'm guessing this is something a display manager can offer me? Do I need one to make this work?

Can someone help me understand what a session is? Is it related to a seat? Is it a part of linux? systemd? What are the parts of a session? How does one get created and when does it end? I'd really appreciate some man pages or wiki links that can answer these questions, because I can't find much explanatory content in this area.

Thanks.

Offline

#2 2019-07-09 09:56:32

berbae
Member
From: France
Registered: 2007-02-12
Posts: 1,295

Re: How to get a 'graphical session'?

'man sd-login' gives infos on seats, sessions.

Your problem is that the systemd user manager is not a part of the login session of the user, it resides outside the session.

The commands:

loginctl list-sessions

loginctl show-session # (the session number)

loginctl user-status <user name>

There the systemd user manager doesn't apppear.

The command:

systemctl --user status

shows that it is separated from the user session login.
So if you try to start a graphical service from there it will not work

Session '1' isn't a graphical session (type: 'tty')

Offline

#3 2019-07-09 17:21:43

Brocellous
Member
Registered: 2017-11-27
Posts: 32

Re: How to get a 'graphical session'?

That helps a lot. Thanks for the info.

Offline

Board footer

Powered by FluxBB