3

I've patched together a primitive understanding of gnome custom sessions from

My goal is to run i3 with gnome-flashback on Ubuntu 18.04.4 LTS. But these resources seem to offer conflicting instructions.

I created /usr/share/xsessions/gnome-plus-i3.desktop containing basic information on what is launched when my custom session, GNOME Flashback (i3), is selected in the display manager.

[Desktop Entry]
Name=GNOME Flashback (i3)
Comment=This session logs you into GNOME Flashback with i3

# Don't continue if i3 doesn't exist.
TryExec=i3

# TODO: How can I define my own .target file here?
Exec=/usr/lib/gnome-session/run-systemd-session gnome-session-flashback.target

Type=Application
DesktopNames=GNOME-Flashback;GNOME;
X-Ubuntu-Gettext-Domain=gnome-flashback

Question #1: Should I define my own .target file on this line

Exec=/usr/lib/gnome-session/run-systemd-session gnome-session-flashback.target

I assume since I'm creating my own session that I want my own .target file. However, this doesn't seem to contain anything specific to a window manager:

[Unit]
Description=User systemd services for the GNOME Flashback sessions
Requires=graphical-session-pre.target
Requires=indicators-pre.target
# start/tear down graphical-session.target along with the ubuntu session
BindsTo=graphical-session.target
# session leader -- if this dies, die along with it
BindsTo=gnome-session.service
# here we list the indicators that we want to load
Wants=indicator-application.service
Wants=indicator-bluetooth.service
Wants=indicator-datetime.service
Wants=indicator-keyboard.service
Wants=indicator-messages.service
Wants=indicator-power.service
Wants=indicator-session.service
Wants=indicator-sound.service
Wants=indicator-printers.service

Question 2: If I define my own .target file, do I need to add it to /usr/lib/systemd/user/ or can I provide a full-path and put it somewhere in my home dir?

Question 2.5: How does /usr/lib/gnome-session/run-systemd-session know where to find the .target file?

Question 3: Assuming I get this far, why do I need to use .xsession? It seems to do almost exactly the same as the .desktop file (runs a named gnome-session).

# Menu tools use this value to decide which applications
# are approriate for the current session.
if [ -z $XDG_CURRENT_DESKTOP ]; then
    export XDG_CURRENT_DESKTOP="GNOME-Flashback:GNOME"
fi

# Run gnome-session and tell it to use our i3 session.
exec gnome-session --session=gnome-plus-i3 --disable-acceleration-check

Question #4: Is it necessary to start the various DBus services from the i3 configuration file (~/.config/i3/config) if they're all listed as RequiredComponents in /usr/share/gnome-session/sessions/gnome-plus-i3.session?

# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!

set $mod Mod4

# ...omitted for brevity

# Start the various DBus services.
exec --no-startup-id /usr/lib/gnome-settings-daemon/gsd-xsettings
exec --no-startup-id /usr/lib/gnome-settings-daemon/gsd-keyboard
exec --no-startup-id /usr/lib/gnome-settings-daemon/gsd-mouse
exec --no-startup-id /usr/lib/gnome-settings-daemon/gsd-media-keys
exec --no-startup-id /usr/lib/gnome-settings-daemon/gsd-sound

My /usr/share/gnome-session/sessions/gnome-plus-i3.session file is

[GNOME Session]
# To create a session with all the required GNOME background services, the easiest thing is to use gnome-session.
# We’ll create a session that includes i3 and the GNOME Flashback goodies.

# Name of the session. This can be localized.
Name=GNOME Flashback (i3)

# List of component identifiers (desktop files) that are required by the session.
# The required components will always run in the session.
# Note that RequiredComponents aren’t executables, they’re the names of .desktop files.

RequiredComponents=gnome-flashback-init;gnome-flashback;i3;org.gnome.SettingsDaemon.Sound;org.gnome.SettingsDaemon.MediaKeys;org.gnome.SettingsDaemon.Mouse;org.gnome.SettingsDaemon.Keyboard;org.gnome.SettingsDaemon.XSettings;org.gnome.Shell.Extensions;org.gnome.SettingsDaemon.PrintNotifications;

UPDATE

Answer #2: Desktop Entry Specification provides detailed information on The Exec key https://developer.gnome.org/desktop-entry-spec/#exec-variables

The executable program can either be specified with its full path or with the name of the executable only. If no full path is provided the executable is looked up in the $PATH environment variable used by the desktop environment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.