15

I want to know if it is possible to change the login screen background to an image, or if not, how to change the color from the default.

login screen, orange and purple

Zanna
  • 70,465

1 Answers1

17

I found these instructions on ubuntuhandhandbook.com

The good thing about GDM3 (and Gnome) is that it's designed to be modular, so pretty much everything can be customized and changed.

That being said in case you don't like how something looks, if you know CSS (or even SASS) chances are you can change it to whatever you like.

However bear in mind, that some of these changes aren't planned customization features, so an update can erase them completely (this could change in the future though.)

Alright, so in our case we'd like to change the login screen background for GDM3.

First thing would be to find what CSS rule is responsible for it, and in what file. Fortunately, someone has already done that (in that link at the beginning), so these instructions will be based on that.

The file we will be editing will be either /usr/share/gnome-shell/theme/gdm3.css, or /etc/alternatives/gdm3.css (the latter is just a symlink to the former).

I'm going to use the nano editor; you can do everything in it, and it's really practical, as it stays in the console.

First, open a console, then the file with nano:

sudo nano /usr/share/gnome-shell/theme/gdm3.css

(We'll have to have root access to edit this file, that's why we use sudo.)

Then we'll want to find the rule that's responsible for the lock screen background, it will be this one:

#lockDialogGroup {
    background: #2c001e url(resource:///org/gnome/shell/theme/noise-texture.png);
    background-repeat: repeat; 
}

As you can see, the background is currently set to an image repeated multiple times, that's how you get the noise texture at the login.

If you know CSS, the rest of this "guide" will be useless for you.

Let's say, we'll want to change that noisy texture to a single picture stretched across the login screen. We can do that by changing the rule to this.

#lockDialogGroup {
    background: url(file:///path/to/your/picture.png);
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center; 
}

Where the /path/to/your/picture.png part should be replaced with the actual path to the image you'd like to use, starting from the / root path. (Note that you need all the /-s after file:, as shown in the example.)

You're done. Press CTRL+X to save the file, and exit nano. After the next login, you should have the picture you set there.

In case you only want to set a solid color you can simply set:

#lockDialogGroup {
    background-color: #2c001e;
}

Where the #... part is a color code of your choice. (You can look up web color codes, if you don't know how they work, or use a color picker to get the desired color code.)

That's it. Note that while this should work, it was not tested by me, as I cannot use GDM at the moment due to an another issue that hasn't been fixed yet.

Zanna
  • 70,465
tamasfe
  • 248
  • 2
  • 12
  • 1
    when i opened the gdm3.css i found it empty – Molham Mohamed Dec 31 '17 at 02:05
  • Are you sure you're editing the right file in either "/usr/share/gnome-shell/theme" or "/etc/alternatives/" ? It's not empty for me. However I cannot test whether it's actively used or not, as I'm not using GDM at the moment. – tamasfe Dec 31 '17 at 02:13
  • I used xhost +local: && sudo gedit /etc/alternatives/gdm3.css – Molham Mohamed Dec 31 '17 at 02:16
  • Since links can disappear, please add the relevant details from that link here. – Chai T. Rex Dec 31 '17 at 03:23
  • Fair point, gonna update the answer with the instructions. – tamasfe Dec 31 '17 at 10:02
  • @MolhamMohamed try editing /usr/share/gnome-shell/theme/gdm3.css. The file you tried to open might not exist, instead of just being empty. – N. Cornet Dec 31 '17 at 13:11
  • @N.Cornet yea I tried that too but when I save it it pops up an error "Unexpected error: Error opening file “/usr/share/gnome-shell/theme/gdm3.css”: Too many levels of symbolic links" – Molham Mohamed Dec 31 '17 at 16:23
  • Ok, please include what you tried (and what error you get) in your question. Otherwise people may think you didn't try anything and you're just asking how to do it in a normal case – N. Cornet Dec 31 '17 at 16:30
  • The symlink error suggets that it was not setup properly and probably just links to itself, which is weird considering you haven't touched it(so you couldn't mess it up), and gnome can use it without any errors(I assume). You could try a "sudo dpkg-reconfigure gdm3", or even a "sudo apt --reinstall install gdm3" in case your gdm3 broke in an update or something similar. – tamasfe Jan 01 '18 at 01:25
  • This question should be accepted answer. It worked for me exactly the way it was described. I'm on Ubuntu 18.04.1 LTS. – Siniša Jan 12 '19 at 11:04