layout: Add check about whether session should start on Overview

In situations that there are UI applications that are meant to be
started together with the session, it is undesirable to boot into
the overview.

In ideal situations, we would have session management infrastructure
in place that would allow GNOME Shell to find out there's UI services
to be brought up in the startup phase, and be able to decide window
positions and workspaces beforehand.

But we don't have any of that. Add a sneaky file existence test
so the behavior can be tweaked by savvy users and e.g. installers.
The hope being that this is a temporary solution till we have the
ideal framework in place.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3854
This commit is contained in:
Carlos Garnacho 2021-04-01 17:03:13 +02:00
parent 687b84c90a
commit b360b08fd9

View file

@ -292,6 +292,15 @@ var LayoutManager = GObject.registerClass({
monitorManager.connect('monitors-changed',
this._monitorsChanged.bind(this));
this._monitorsChanged();
const fileName = GLib.build_filenamev([
GLib.get_user_config_dir(),
'gnome-shell',
'prevent-overview',
]);
this._startupIntoOverview =
Main.sessionMode.hasOverview &&
!GLib.file_test(fileName, GLib.FileTest.EXISTS);
}
// This is called by Main after everything else is constructed
@ -665,7 +674,7 @@ var LayoutManager = GObject.registerClass({
let monitor = this.primaryMonitor;
if (!Main.sessionMode.hasOverview) {
if (!this._startupIntoOverview) {
const x = monitor.x + monitor.width / 2.0;
const y = monitor.y + monitor.height / 2.0;
@ -706,7 +715,7 @@ var LayoutManager = GObject.registerClass({
_startupAnimationSession() {
const onComplete = () => this._startupAnimationComplete();
if (Main.sessionMode.hasOverview) {
if (this._startupIntoOverview) {
Main.overview.runStartupAnimation(onComplete);
} else {
this.uiGroup.ease({