Skip to content

Add support for login-window-alignment/offset and logo-positioning + dev documentation #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ A configuration tool is available at https://github.com/linuxmint/lightdm-settin
- Sessions are validated. If a default/chosen session isn't present on the system, the greeter scans for known sessions in /usr/share/xsessions and replaces the invalid session choice with a valid session.
- You can take a screenshot by pressing PrintScrn. The screenshot is saved in /var/lib/lightdm/Screenshot.png.

# Development

- Requires `automake`, `autogen`, `gnome-common` and `vala` to setup a build
- Build with `make`, binary lands in `src/slick-greeter`
- Test with `src/slick-greeter --test-mode`, global slick-greeter.conf and x.dm.slick-greeter.gschema.xml are used
- Deploy to system with `sudo mv src/slick-greeter /bin/slick-greeter`
- If you change the global schema, recompile with `sudo glib-compile-schemas /usr/share/glib-2.0/schemas/`

# Credit

- Slick Greeter started as a fork of Unity Greeter 16.04.2, a greeter developed for Ubuntu by Canonical, which used indicators and unity-settings-daemon.
Expand Down Expand Up @@ -59,4 +67,9 @@ Configuration file format for /etc/lightdm/slick-greeter.conf
# group-filter=List of groups that users must be part of to be shown (empty list shows all users)
# enable-hidpi=Whether to enable HiDPI support (on/off/auto)
# only-on-monitor=Sets the monitor on which to show the login window, -1 means "follow the mouse"
# main-align, alignment of loginbox; 0 = left = default; 50 = center; 100 = right
# main-xpos, x-offset (in px) of login-window, 0 = default
# main-ypos, y-offset (in px) of login-window, 0 = default
# logo-xpos, x-offset (in px) of logo, auto if logo-xpos + logo-ypos not set
# logo-ypos, y-offset (in px) of logo, auto if logo-xpos + logo-ypos not set
[Greeter]
21 changes: 21 additions & 0 deletions data/x.dm.slick-greeter.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,26 @@
<default>'auto'</default>
<summary>Monitor on which to show the GUI</summary>
</key>
<key name="main-align" type="i">
<default>0</default>
<summary>Main window align; 0=left, 100=right</summary>
</key>
<key name="main-xpos" type="i">
<default>0</default>
<summary>Main window xpos</summary>
</key>
<key name="main-ypos" type="i">
<default>0</default>
<summary>Main window ypos</summary>
</key>

<key name="logo-xpos" type="i">
<default>-1</default>
<summary>Logo xpos</summary>
</key>
<key name="logo-ypos" type="i">
<default>-1</default>
<summary>Logo ypos</summary>
</key>
</schema>
</schemalist>
11 changes: 9 additions & 2 deletions src/background.vala
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,15 @@ class BackgroundLoader : Object
if (logo != null)
{
bc.save ();
var y = (int) (image.height / grid_size - 2) * grid_size + grid_y_offset;
bc.translate (grid_x_offset, y);
var xpos = UGSettings.get_integer(UGSettings.KEY_LOGO_XPOS);
var ypos = UGSettings.get_integer(UGSettings.KEY_LOGO_YPOS);
if ( xpos == -1 || ypos == -1) {
// traditional behaviour if not set
var y = (int) (image.height / grid_size - 2) * grid_size + grid_y_offset;
bc.translate (grid_x_offset, y);
} else {
bc.translate (xpos, ypos);
}
bc.set_source_surface (logo, 0, 0);
bc.paint_with_alpha (1.0);
bc.restore ();
Expand Down
8 changes: 7 additions & 1 deletion src/main-window.vala
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ public class MainWindow : Gtk.Window
back_button.clicked.connect (pop_list);
align.add (back_button);

align = new Gtk.Alignment (0.0f, 0.5f, 0.0f, 1.0f);
// default value = 0 -> left
var main_align = 0.01f*UGSettings.get_integer(UGSettings.KEY_MAIN_ALIGN);
align = new Gtk.Alignment (main_align, 0.5f, 0.0f, 1.0f);
align.show ();
hbox.add (align);

Expand Down Expand Up @@ -156,6 +158,10 @@ public class MainWindow : Gtk.Window
monitors_changed_cb (screen);
}

// set offset of main window with main-xpos / main-ypos
align.top_padding = UGSettings.get_integer(UGSettings.KEY_MAIN_XPOS);
align.left_padding = UGSettings.get_integer(UGSettings.KEY_MAIN_YPOS);

/* Force a call on login_box.show()...
This fixes the following issue:
When the greeter starts, the login box looks too small, its entry isn't visible and
Expand Down
10 changes: 10 additions & 0 deletions src/settings.vala
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public class UGSettings
public const string KEY_ENABLE_HIDPI = "enable-hidpi";
public const string KEY_ACTIVATE_NUMLOCK = "activate-numlock";
public const string KEY_ONLY_ON_MONITOR = "only-on-monitor";
public const string KEY_MAIN_ALIGN = "main-align";
public const string KEY_MAIN_XPOS = "main-xpos";
public const string KEY_MAIN_YPOS = "main-ypos";
public const string KEY_LOGO_XPOS = "logo-xpos";
public const string KEY_LOGO_YPOS = "logo-ypos";

public static bool get_boolean (string key)
{
Expand Down Expand Up @@ -144,6 +149,11 @@ public class UGSettings

var int_keys = new List<string> ();
int_keys.append (KEY_XFT_DPI);
int_keys.append (KEY_MAIN_ALIGN);
int_keys.append (KEY_MAIN_XPOS);
int_keys.append (KEY_MAIN_YPOS);
int_keys.append (KEY_LOGO_XPOS);
int_keys.append (KEY_LOGO_YPOS);

var strv_keys = new List<string> ();
strv_keys.append (KEY_HIDDEN_USERS);
Expand Down