aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/animate-timer.vala4
-rw-r--r--src/background.vala30
-rw-r--r--src/menubar.vala78
-rw-r--r--src/settings.vala4
-rw-r--r--src/user-list.vala30
6 files changed, 116 insertions, 32 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index bb91f59..7ddcf57 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -91,7 +91,5 @@ arctica_greeter_LDADD = \
logo_generator_LDADD = $(arctica_greeter_LDADD)
-arctica_greeter_vala.stamp: $(top_srcdir)/config.h
-
DISTCLEANFILES = \
Makefile.in
diff --git a/src/animate-timer.vala b/src/animate-timer.vala
index 9f92448..4879cb0 100644
--- a/src/animate-timer.vala
+++ b/src/animate-timer.vala
@@ -2,6 +2,7 @@
*
* Copyright (C) 2011,2012 Canonical Ltd
* Copyright (C) 2015 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
+ * Copyright (C) 2025 Robert Tari
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
@@ -18,6 +19,7 @@
* Authors: Robert Ancell <robert.ancell@canonical.com>
* Michael Terry <michael.terry@canonical.com>
* Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
+ * Robert Tari <robert@tari.in>
*/
private class AnimateTimer : Object
@@ -32,7 +34,7 @@ private class AnimateTimer : Object
public const int SLOW = 1000; /* Good for animations that convey information that is only presented in the animation */
/* speed is in milliseconds */
- public unowned EasingFunc easing_func { get; private set; }
+ public unowned EasingFunc easing_func;
public int speed { get; set; }
public bool is_running { get { return timeout != 0; } }
public double progress { get; private set; }
diff --git a/src/background.vala b/src/background.vala
index bf1ca6f..07dce7e 100644
--- a/src/background.vala
+++ b/src/background.vala
@@ -173,17 +173,43 @@ class BackgroundLoader : Object
var target_aspect = (double) width / height;
var aspect = (double) image.width / image.height;
double scale, offset_x = 0, offset_y = 0;
+ string sPosition = AGSettings.get_string (AGSettings.KEY_BACKGROUND_POSITION);
+
if (aspect > target_aspect)
{
/* Fit height and trim sides */
scale = (double) height / image.height;
- offset_x = (image.width * scale - width) / 2;
+
+ if (sPosition == "center")
+ {
+ offset_x = (image.width * scale - width) / 2;
+ }
+ else if (sPosition == "top-left" || sPosition == "bottom-left")
+ {
+ offset_x = 0;
+ }
+ else if (sPosition == "top-right" || sPosition == "bottom-right")
+ {
+ offset_x = (image.width * scale - width);
+ }
}
else
{
/* Fit width and trim top and bottom */
scale = (double) width / image.width;
- offset_y = (image.height * scale - height) / 2;
+
+ if (sPosition == "center")
+ {
+ offset_y = (image.height * scale - height) / 2;
+ }
+ else if (sPosition == "top-left" || sPosition == "top-right")
+ {
+ offset_y = 0;
+ }
+ else if (sPosition == "bottom-left" || sPosition == "bottom-right")
+ {
+ offset_y = (image.height * scale - height);
+ }
}
var scaled_image = new Gdk.Pixbuf (image.colorspace, image.has_alpha, image.bits_per_sample, width, height);
diff --git a/src/menubar.vala b/src/menubar.vala
index f449afa..0ba2903 100644
--- a/src/menubar.vala
+++ b/src/menubar.vala
@@ -127,6 +127,9 @@ public class MenuBar : Gtk.Grid
construct
{
+ // Assure that printf operates in C.UTF-8 locale for float-to-string conversions.
+ Intl.setlocale(LocaleCategory.NUMERIC, "C.UTF-8");
+
this.pMenubar = new Gtk.MenuBar ();
this.pMenubar.halign = Gtk.Align.END;
this.pMenubar.hexpand = true;
@@ -136,27 +139,27 @@ public class MenuBar : Gtk.Grid
this.show ();
add_style_class (this);
Gtk.CssProvider pGridProvider = new Gtk.CssProvider ();
- string sBackGround = AGSettings.get_string (AGSettings.KEY_MENUBAR_BGCOLOR);
- Gdk.RGBA pBackGround = Gdk.RGBA ();
- pBackGround.parse (sBackGround);
- int nRed = (int)(pBackGround.red * 255.0);
- int nGreen = (int)(pBackGround.green * 255.0);
- int nBlue = (int)(pBackGround.blue * 255.0);
- double fApha = AGSettings.get_double (AGSettings.KEY_MENUBAR_ALPHA);
-
- // Assure that printf operates in C.UTF-8 locale for float-to-string conversions.
- Intl.setlocale(LocaleCategory.NUMERIC, "C.UTF-8");
+ Gtk.StyleContext pGridContext = this.get_style_context ();
+ Gdk.RGBA pBackground = getBackground (pGridContext, AGSettings.KEY_MENUBAR_BGCOLOR, AGSettings.KEY_MENUBAR_ALPHA);
+ int nBackgroundRed = (int)(pBackground.red * 255.0);
+ int nBackgroundGreen = (int)(pBackground.green * 255.0);
+ int nBackgroundBlue = (int)(pBackground.blue * 255.0);
+ Gdk.RGBA pShadow = getBackground (pGridContext, AGSettings.KEY_MENUBAR_SHADOW_COLOR, AGSettings.KEY_MENUBAR_SHADOW_ALPHA);
+ int nShadowRed = (int)(pShadow.red * 255.0);
+ int nShadowGreen = (int)(pShadow.green * 255.0);
+ int nShadowBlue = (int)(pShadow.blue * 255.0);
+ string sBackground = "* {background-color: rgba(%i, %i, %i, %f); border: none; box-shadow: 0px 5px 5px -5px rgba(%i, %i, %i, %f);}".printf (nBackgroundRed, nBackgroundGreen, nBackgroundBlue, pBackground.alpha, nShadowRed, nShadowGreen, nShadowBlue, pShadow.alpha);
try
{
- pGridProvider.load_from_data ("* { background-color: rgba(%i, %i, %i, %f); } *.high_contrast { background-color: #ffffff; color: #000000; text-shadow: none; }".printf (nRed, nGreen, nBlue, fApha), -1);
+ pGridProvider.load_from_data (sBackground + " *.high_contrast {background-color: #ffffff; color: #000000; text-shadow: none; box-shadow: none;}", -1);
}
catch (Error pError)
{
error ("Panic: Failed loading menubar grid colours: %s", pError.message);
}
- this.get_style_context ().add_provider (pGridProvider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
+ pGridContext.add_provider (pGridProvider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
Gtk.CssProvider pMenubarProvider = new Gtk.CssProvider ();
@@ -171,21 +174,6 @@ public class MenuBar : Gtk.Grid
this.pMenubar.get_style_context ().add_provider (pMenubarProvider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
- /* Add shadow. */
- var shadow_style = new Gtk.CssProvider ();
-
- try
- {
- shadow_style.load_from_data ("* { box-shadow: 0px 0px 5px 5px rgba(%i, %i, %i, %f); }".printf (nRed, nGreen, nBlue, fApha), -1);
- }
- catch (Error pError)
- {
- error ("Panic: Failed adding shadow: %s", pError.message);
- }
-
- this.get_style_context ().add_provider (shadow_style,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
-
if (AGSettings.get_boolean (AGSettings.KEY_SHOW_HOSTNAME))
{
Gtk.Label pLabel = new Gtk.Label (Posix.utsname ().nodename);
@@ -222,6 +210,42 @@ public class MenuBar : Gtk.Grid
nat = (int)Math.round(greeter.menubar_height - 8);
}
+ private Gdk.RGBA getBackground (Gtk.StyleContext pContext, string sBackgroundKey, string sAlphaKey)
+ {
+ string sBackground = AGSettings.get_string (sBackgroundKey);
+ Gdk.RGBA pBackground;
+
+ if (sBackground != "")
+ {
+ pBackground = Gdk.RGBA ();
+ pBackground.parse (sBackground);
+ }
+ else
+ {
+ bool bFound = pContext.lookup_color ("osd_bg", out pBackground);
+
+ if (!bFound)
+ {
+ bFound = pContext.lookup_color ("dark_bg_color", out pBackground);
+
+ if (!bFound)
+ {
+ pBackground = Gdk.RGBA ();
+ pBackground.parse ("#444444");
+ debug ("Failed to retrieve osd_bg and dark_bg_color for %s - falling back to #444444", sBackgroundKey);
+ }
+ else
+ {
+ debug ("Failed to retrieve osd_bg for %s - falling back to dark_bg_color", sBackgroundKey);
+ }
+ }
+ }
+
+ pBackground.alpha = AGSettings.get_double (sAlphaKey);
+
+ return pBackground;
+ }
+
private Indicator.Object? load_indicator_file (string indicator_name)
{
string dir = Config.INDICATOR_FILE_DIR;
diff --git a/src/settings.vala b/src/settings.vala
index 12c1265..2a89c38 100644
--- a/src/settings.vala
+++ b/src/settings.vala
@@ -57,6 +57,7 @@ public class AGSettings : Object
public const string KEY_PLAY_READY_SOUND = "play-ready-sound";
public const string KEY_INDICATORS = "indicators";
public const string KEY_HIDDEN_USERS = "hidden-users";
+ public const string KEY_HIDDEN_GROUPS = "hidden-groups";
public const string KEY_USER_FILTER= "user-filter";
public const string KEY_USER_FILTER_ALWAYS = "user-filter-always";
public const string KEY_GROUP_FILTER = "group-filter";
@@ -100,6 +101,9 @@ public class AGSettings : Object
public const string KEY_LOGO_OFFSET_VERTICAL = "logo-offset-vertical";
public const string KEY_ERROR_BELOW_ENTRY = "error-below-entry";
public const string KEY_MENUBAR_BGCOLOR = "menubar-bgcolor";
+ public const string KEY_BACKGROUND_POSITION = "background-position";
+ public const string KEY_MENUBAR_SHADOW_COLOR = "menubar-shadow-color";
+ public const string KEY_MENUBAR_SHADOW_ALPHA = "menubar-shadow-alpha";
public static bool get_boolean (string key)
{
diff --git a/src/user-list.vala b/src/user-list.vala
index 3936768..3abfb06 100644
--- a/src/user-list.vala
+++ b/src/user-list.vala
@@ -87,10 +87,28 @@ public class UserList : GreeterList
}
var hidden_users = AGSettings.get_strv (AGSettings.KEY_HIDDEN_USERS);
+ string[] lHiddenGroups = AGSettings.get_strv (AGSettings.KEY_HIDDEN_GROUPS);
+
if (!value)
{
foreach (var username in hidden_users)
remove_entry (username);
+
+ foreach (string sGroup in lHiddenGroups)
+ {
+ LightDM.UserList lUsers = LightDM.UserList.get_instance ();
+
+ foreach (LightDM.User pUser in lUsers.users)
+ {
+ bool bInGroup = in_group (sGroup, pUser.name);
+
+ if (bInGroup)
+ {
+ remove_entry (pUser.name);
+ }
+ }
+ }
+
return;
}
@@ -1126,6 +1144,18 @@ public class UserList : GreeterList
foreach (var username in hidden_users)
if (username == user.name)
return;
+
+ string[] lHiddenGroups = AGSettings.get_strv (AGSettings.KEY_HIDDEN_GROUPS);
+
+ foreach (string sGroup in lHiddenGroups)
+ {
+ bool bInGroup = in_group (sGroup, user.name);
+
+ if (bInGroup)
+ {
+ return;
+ }
+ }
}
var user_filter = AGSettings.get_strv (AGSettings.KEY_USER_FILTER);