aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMihai Moldovan <ionic@ionic.de>2023-09-15 21:23:01 +0200
committerMihai Moldovan <ionic@ionic.de>2023-09-15 21:23:01 +0200
commit8f5cb2cb4123bfa3a744dd406efb0a9d10315932 (patch)
treefbdda140079b772f5940950aa7802c6134ebbc22 /src
parenta10a482c08a6b0aa98206b07dc3c88efc474ecd7 (diff)
parent6921a384256d14653db1e1b7cff3ae4fbb7c9f98 (diff)
downloadarctica-greeter-8f5cb2cb4123bfa3a744dd406efb0a9d10315932.tar.gz
arctica-greeter-8f5cb2cb4123bfa3a744dd406efb0a9d10315932.tar.bz2
arctica-greeter-8f5cb2cb4123bfa3a744dd406efb0a9d10315932.zip
Merge branch 'sunweaver-mr/hide-default-xsessions'
Attributes GH PR #67: https://github.com/ArcticaProject/arctica-greeter/pull/67
Diffstat (limited to 'src')
-rw-r--r--src/arctica-greeter.vala38
-rw-r--r--src/settings.vala1
2 files changed, 28 insertions, 11 deletions
diff --git a/src/arctica-greeter.vala b/src/arctica-greeter.vala
index 0aee212..81f0045 100644
--- a/src/arctica-greeter.vala
+++ b/src/arctica-greeter.vala
@@ -246,7 +246,10 @@ public class ArcticaGreeter : Object
public string? get_default_session ()
{
var sessions = new List<string> ();
- sessions.append ("lightdm-xsession");
+ var hide_default_xsession = AGSettings.get_boolean (AGSettings.KEY_HIDE_DEFAULT_XSESSION);
+ if (!hide_default_xsession) {
+ sessions.append ("lightdm-xsession");
+ }
var preferred_sessions = AGSettings.get_strv (AGSettings.KEY_PREFERRED_SESSIONS);
@@ -305,30 +308,42 @@ public class ArcticaGreeter : Object
var excluded_sessions = AGSettings.get_strv (AGSettings.KEY_EXCLUDED_SESSIONS);
var includeonly_sessions = AGSettings.get_strv (AGSettings.KEY_INCLUDEONLY_SESSIONS);
- if (includeonly_sessions.length > 0) {
- if (!(session in includeonly_sessions)) {
+ if (includeonly_sessions.length > 0)
+ {
+ if (!(session in includeonly_sessions))
+ {
session = null;
}
}
- else if (session in excluded_sessions) {
+ else if (session in excluded_sessions)
+ {
session = null;
}
- if (session != null) {
+ if (session != null)
+ {
var xsessions_path = Path.build_filename ("/usr/share/xsessions/", session.concat(".desktop"), null);
var wsessions_path = Path.build_filename ("/usr/share/wayland-sessions/", session.concat(".desktop"), null);
- if (AGSettings.get_boolean (AGSettings.KEY_HIDE_WAYLAND_SESSIONS) &
- FileUtils.test (wsessions_path, FileTest.EXISTS)) {
+ if ((session == "lightdm-xsession") &&
+ AGSettings.get_boolean (AGSettings.KEY_HIDE_DEFAULT_XSESSION))
+ {
+ debug ("default Xsession hidden: '%s'", session);
+ session = null;
+ }
+ else if (AGSettings.get_boolean (AGSettings.KEY_HIDE_WAYLAND_SESSIONS) &&
+ FileUtils.test (wsessions_path, FileTest.EXISTS))
+ {
debug ("Wayland session hidden: '%s'", session);
session = null;
}
- else if (AGSettings.get_boolean (AGSettings.KEY_HIDE_X11_SESSIONS) &
- FileUtils.test (xsessions_path, FileTest.EXISTS)) {
+ else if (AGSettings.get_boolean (AGSettings.KEY_HIDE_X11_SESSIONS) &&
+ FileUtils.test (xsessions_path, FileTest.EXISTS))
+ {
debug ("X11 session hidden: '%s'", session);
session = null;
}
- else if (!FileUtils.test (xsessions_path, FileTest.EXISTS) &
+ else if (!FileUtils.test (xsessions_path, FileTest.EXISTS) &&
!FileUtils.test (wsessions_path, FileTest.EXISTS))
{
debug ("Invalid session: '%s'", session);
@@ -336,7 +351,8 @@ public class ArcticaGreeter : Object
}
}
- if ((fallback == true) & (session == null)) {
+ if ((fallback == true) && (session == null))
+ {
var default_session = get_default_session ();
debug ("Invalid session: '%s'. Using session '%s' instead.", session, default_session);
return default_session;
diff --git a/src/settings.vala b/src/settings.vala
index 7c4bd84..68ce674 100644
--- a/src/settings.vala
+++ b/src/settings.vala
@@ -71,6 +71,7 @@ public class AGSettings : Object
public const string KEY_FLATBUTTON_BORDERCOLOR = "flatbutton-bordercolor";
public const string KEY_ENABLE_HIDPI = "enable-hidpi";
public const string KEY_MENUBAR_ALPHA = "menubar-alpha";
+ public const string KEY_HIDE_DEFAULT_XSESSION = "hide-default-xsession";
public const string KEY_HIDE_X11_SESSIONS = "hide-x11-sessions";
public const string KEY_HIDE_WAYLAND_SESSIONS = "hide-wayland-sessions";
public const string KEY_INCLUDEONLY_SESSIONS = "includeonly-sessions";