GNOME-SESSION(1)
โจ NAME โจ
okay so real quick โ gnome-session is the manual page GNOME-SESSION(1), and it does exactly one extremely iconic thing: it starts the GNOME desktop environment. periodt. ๐
๐ฆ SYNOPSIS ๐ฆ
gnome-session [OPTION...]
๐ธ DESCRIPTION ๐ธ
gnome-session starts up the whole entire GNOME desktop environment. bestie, this is the program that makes your screen become GNOME. โจ
It's normally launched for you by your login manager โ so like GDM, SDDM, lightdm, or whatever other one you're running. You're usually not typing this yourself, it just happens when you log in. ๐ซถ
When it runs, it will either load your saved session, or it will give you a default session for the user โ and that default is defined by the system administrator (or, you know, whatever the default GNOME installation on your system ships with).
The default session lives in gnome.session, which is a .desktop-like file. Here's where it goes looking for it: ๐
$XDG_CONFIG_HOME/gnome-session/sessions$XDG_CONFIG_DIRS/gnome-session/sessions$XDG_DATA_DIRS/gnome-session/sessions
๐ OPTIONS ๐
--session=SESSIONโ runs the applications defined inSESSION.session. If you don't pass this at all,gnome.sessiongets used instead. no thoughts, just defaults. ๐--debugโ turns on debugging code. for when you wanna see the whole tea. ๐ต
๐ SYSTEMD ๐
ngl, this part is kind of the main character. gnome-session uses systemd for the bulk of its service management โ that's just how it does things now. ๐ซ
systemd provides two special targets for desktop integration:
graphical-session.targetgraphical-session-pre.target
These two work across desktop environments, so use them if you possibly can. fr fr, that's the recommendation.
On top of that, gnome-session gives you these extra GNOME-specific targets:
gnome-session.targetโ a generic unit that stays active throughout the entire session. it's basically the sibling ofgraphical-session.target.gnome-session-pre.targetโ for tasks that need to happen before session startup. the sibling ofgraphical-session-pre.target.gnome-session@SESSION.targetโ the main unit that gets started for the session.SESSIONhere is set according to whatever session got passed in through--session.gnome-session-basic-services.targetโ a special unit listing the basic services needed by any GNOME session built aroundgnome-shell. this one exists so kiosk sessions โ like the GDM login screen โ can conveniently reuse it. ๐งgnome-session-x11-services.targetโ a special unit that starts up when X11 services are needed. heads up: programs will need to use the specialGNOME_SETUP_DISPLAYenvironment variable instead ofDISPLAY. yes really, notDISPLAY. ๐
โ ๏ธ now listen, bestie, this is the part where you have to be careful: you must take care to set appropriateAfter=rules. And it's strongly recommended that you always do that in combination withBindsTo=orPartOf=on one of the core targets (for examplegraphical-session.target).
โ ๏ธ also: units are required to setCollectMode=inactive-or-failed. and on top of that, it is strongly recommended to setTimeoutStopSec=5, so that logout doesn't get delayed indefinitely in case the process doesn't stop properly. don't skip this one, you'll be sitting there waiting to log out forever. ๐
๐ SESSION DEFINITION ๐
Sessions are defined in .session files, and those use a .desktop-like format. Inside them, in the GNOME Session group, you get these keys:
Nameโ the name of the session. this one can be localized. ๐Kioskโ okay so kiosk sessions are these special single-purpose sessions built around starting one specific app. like, a kiosk session might run a full-screen web browser that's locked to one specific page. in GNOME we use kiosk sessions for the login screen (where the app is the login screen UI) and for the initial-setup first boot experience. when this is set totrue,gnome-sessionwill make no attempt to autostart any.desktopfiles at all โ instead it will require that the session configures all required functionality via systemd. all of it. no autostart, not even a little. ๐
Here's an example of a session definition:
[GNOME Session]
Name=GNOME
The .session files are loaded from:
$XDG_CONFIG_HOME/gnome-session/sessions$XDG_CONFIG_DIRS/gnome-session/sessions$XDG_DATA_DIRS/gnome-session/sessions
Important vibe check: session definitions don't do anything on their own. they're nothing without systemd configuration to actually provide functionality (i.e. launch services). the recommended way to do that is by hooking into one of the targets described above. ๐ซ
For instance: when you're defining a session named foobar, you can create a systemd drop-in file in /etc/systemd/user/gnome-session@foobar.target.d/session.conf and define Requires= and Wants= dependencies to tell systemd what services it needs to start when launching this session. literally that easy. ๐
๐ FILES ๐
$XDG_CONFIG_HOME/autostart
$XDG_CONFIG_DIRS/autostart
/usr/share/gnome/autostart
Applications defined via .desktop files in those directories will be started on login. ๐ but ngl, note this: previous versions of gnome-session would launch services from here, and that is no longer the case. services should now be configured via systemd unit files. the old way is over, we've moved on. ๐
$XDG_CONFIG_HOME/gnome-session/sessions
$XDG_CONFIG_DIRS/gnome-session/sessions
$XDG_DATA_DIRS/gnome-session/sessions
These directories contain the .session files that you can use with the --session option. ๐ธ
๐ญ BUGS ๐ญ
If you find bugs in the gnome-session program, please report them here: https://gitlab.gnome.org/GNOME/gnome-session/issues. do it, they wanna know. ๐ซถ
โญ SEE ALSO โญ
and that's the whole page, bestie!! this was gnome-session from GNOME-SESSION(1) โ yes, the manual is literally named the same thing as the program, iconic behavior honestly. go forth, log in, and let systemd handle the rest. mwah ๐โจ๐๐ฆ๐ธ
๐ฆ where this page comes from
- arch rolling: gnome-session 51.0-1 ยท GPL-2.0-or-later
- ubuntu stonking: gnome-session-bin 51.0-0ubuntu1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms