-
-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathSessionSettings.vala
More file actions
56 lines (49 loc) · 1.48 KB
/
SessionSettings.vala
File metadata and controls
56 lines (49 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* Copyright 2026 elementary, Inc. (https://elementary.io)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Authored by: Leonhard Kargl <leo.kargl@proton.me>
*/
namespace Gala.SessionSettings {
private enum SessionType {
DESKTOP,
GREETER,
INSTALLER;
}
private static SessionType? session_type = null;
private static SessionType get_session_type () {
if (session_type == null) {
var session_type_str = Environment.get_variable ("GALA_SESSION_TYPE") ?? "desktop";
switch (session_type_str) {
case "desktop":
session_type = DESKTOP;
break;
case "greeter":
session_type = GREETER;
break;
case "installer":
session_type = INSTALLER;
break;
default:
warning ("Unknown session type: %s", session_type_str);
session_type = DESKTOP;
break;
}
}
return session_type;
}
public bool is_greeter () {
return get_session_type () != DESKTOP;
}
public string get_shell_clients_type () {
switch (get_session_type ()) {
case DESKTOP:
return "desktop";
case GREETER:
return "greeter";
case INSTALLER:
return "installer";
}
return "desktop";
}
}