Editing gresource file for gdm

I'd like to modify the gresource file and recompile it to have more customization options for the GDM login screen. For example, I think it would be nice if you could also change the shield in the middle of the screen (I'm not sure if that's the right name) and adjust the text color and background. In the default ZorinBlue-Dark theme the font color is white and the background has transparency, so it is unreadable when you set a light background picture.

I tried it yesterday but failed. It’s quite time-consuming and complicated.

At the end of the experiment, I was greeted by a white screen with a error message... gdm was broken.

That's why I want to be better prepared for the next attempts (in the live session).
What can help me regain access to the system?
Using Ctrl+Alt+F3, I was able to access a TTY, which at least allowed me to shut down the system properly.

I'll also install lightdm next time just to be safe, in the hope that I'll then be able to switch to lightdm from the TTY console.
Would it help to restore the original gresource file in the ZorinBlue-Dark theme (I had named it .bak), remove the other one/s and restart gdm3?

How do you create a new option for update-alternatives for gdm-theme.gresource? I’d like to keep the existing options for the original gnome-shell and ZorinBlue-Dark and add my modified theme there so I can select it as further option. That would make it easier to fall back on working versions if something goes wrong.

Unfortunately, I'm pretty much in the dark about what I need to do.
Yesterday, I followed the instructions from jlb for Zorin 17 to extract the ZorinBlue-Dark gresource file into my home directory. Then I edited the gnome-shell.css file in there (though I’m not sure which file to edit - there was also a gdm.css file). Afterward, I created an XML file listing all the extracted files individually. That was very tedious, since many of the images in the “assets” folder were no longer named the same way as in Zorin 17, and I basically had to recreate the file from scratch.

After that, I must have done something wrong during compilation. I had put that XML file into the original Zorin Blue Dark theme, but the original gresource file was still there (I had forgotten to remove it). Then I compiled it with sudo glib-compile-resources. Somewhere was a message that gdm.css doesn't exist, so I removed it from my xml file.

Is it possible to compile the XML file in the folder you're currently in (the home directory) and then, once it's done, save it somewhere as a theme?

Maybe I'll just give up because it's too much trouble just to get a nicer login screen for light-colored background images in gdm.
I'm just trying it out of curiosity and to better understand the system, not because I need it. It's easier to switch to lightdm instead.

1 Like

On reddit a user wrote that they bypasses gdm and uses the lockscreen instead (it is easier customizable), But I'm not sure if this method might bypass GDM's security mechanisms. I don't think it's a good idea to do that.

https://www.reddit.com/r/gnome/comments/1tb8lyh/bypassing_gdm_for_a_better_gnome_lock_screen/

It's not worth to risk safety just because of a gdm login-screen that isn't very customizable.

1 Like

tty + live usb is the right safety net. before you touch gresource again, copy the working theme files somewhere outside /usr so you can put them back blind.

from a live session (or root on tty) restoring the original .gresource for that zorin theme package usually brings gdm back. if apt still has the theme package, reinstalling it is cleaner than hand-copying. temporary lightdm as a fallback is fine for experiments, just remember to switch default display manager back when you are done.

i would not bypass gdm for a prettier lock screen. too easy to paper over a login path you actually need after a bad update. tweak one thing, reboot, confirm you can still log in, then tweak the next.

1 Like

That sounds like a good Idea for me. Before You make bigger Changes, You could try this first to check if it works.

1 Like

How can I switch from gdm3 to lightdm without rebooting?
Unfortunately, I wasn't able to do it in the live session, so I'm not sure if it's even possible.
I installed lightdm and lightdm-gtk-greeter and ran the reconfigure procedure, and restarted lightdm with sudo systemctl restart lightdm. Then logged out. Lightdm was shown, but I was not able to login, setting a password for the live session user didn't help.

Edit: I have figured it out now. After lightdm is installed and reconfigured (after the installation it is shown automatically, the other times run manually sudo dpkg-reconfigure gdm3 and select lightdm) to lightdm, log out and then open a tty by pressing Ctrl+Alt+F3. In the tty run

sudo systemctl stop gdm3
sudo systemctl restart lightdm

Then wait a bit until it is ready, press Ctrl+Alt+F1 to leave the tty and show the login screen.
...I hope that is the fix for me in a live session if I want to switch. I'll have to try it again. At the moment I have problems to get a login manager to work after I wanted to switch back to the other login manager...Puh, back in session :grinning_face:.

In the session you can do the other way round:

sudo dpkg-reconfigure lightdm

Then select gdm3.
Logout, open the tty (Ctrl+Alt+F3) and enter

sudo systemctl stop lightdm
sudo systemctl restart gdm3.

Then press Ctrl+Alt+F1 to see the the login-screen and login there.

Necessity is the mother of invention!!! I definitely don't want to practice editing the gresource file on my bare-metal system. Too many things could go wrong. And all guides I found mentioned you have to reboot to switch between the login managers...But I'm not sure what to do when gdm3 fails to load after an experiment and you don't have access to the reconfiguring-window to set lightdm.

Ah...The dpkg-reconfigure command works in the tty and shows the window, but you need to stop the running login-manager after you have reconfigured it there and restart the other one. Then everything works.

Now my test with deleting the gresource file from /usr/share/themes/ZorinBlue-Dark - which leads to the notorious white screen.
I had saved a copy of ZorinBlue-Dark in my home directory before the removal.
With Ctrl+Alt+F3 I went from the white error screen into the tty, copied the Zorin theme recursively to /usr/share/themes
and ran sudo systemctl restart gdm3.
The gdm login-screen was back.
That's good to know before I try the next tests. I'm not sure if the Zorin theme can be installed with apt, I didn't found it with
apt list | grep ZorinBlue-Dark

The Themes are combined in the Package zorin-desktop-themes so, they are not seperately.

2 Likes

Today I successfully compiled my first gresource file using these instructions. Before that, I switched to the gnome-shell-theme for gdm. Unfortunately, only the background image worked; the instructions for changing the top bar didn't. There were several .css files in the extracted theme. I'm not sure which ones I need to edit.

Please tell me: Is it just gnome-shell.css which needs to be edited or other ones (gdm.css, gdm3.css, gnome-shell-dark.css...). I changed around 50 values (because I don't know which lines to edit and to test if it makes a change at all somewhere), and saw no effect.

For the Zorin gdm theme, the instructions need to be adapted. It didn't work for me, and I don't know why and what I have to edit.
I switched back to the Zorin gdm theme for this test.

In the extract-shell-theme.sh script I changed the line
gresource-file=/usr/share/themes/ZorinBlue-Dark/gnome-shell/gnome-shell-theme.gresource

This time I replaced the Zorin login-background image at the extracted assets folder with a custom image and changed the line in the gnome-shell.css to that .jpg image.

Then I used the compile-shell-theme.sh script.
The compiled gnome-shell-theme.gresorce file of my home directory I put then to /usr/share/themes/ZorinBlue-Dark/gnome-shell after I had renamed the original .gresouce file there to .bak.

The login-screen showed a grey background, no picture, and flickered in the middle field.
Where is the mistake? Perhaps I misunderstood something.

Edit:
I tried it again, and this time the background image in Zorin gdm theme was shown and worked.

The scripts are really helpful, so you don't need to create the .xml file yourself. But I'm not sure if everything is right in the scripts for Zorin 18. The guide is a few years old. At least there wasn't a session/gdm3 crash.

I have edited Gresource files in the past and while I was probably quite lucky, it was not without it's trying moments.
Gresource is yet another method of control - a means of preventing the owner from making custom changes on their own machine. These files can be described in one word as "Fragile."

If you are unsure about which property in which .css file to change - this is where you start gritting teeth, because you must recompile each time you want to test.

The script you linked to modifies the gdm.css to match the gnome-shell.css:

cp "${shell_dir}"/gnome-shell.css "${shell_dir}"/gdm.css

before compiling. You can use this trick to not need to edit values individually. But for the gnome-shell-dark.css, you must keep its independent values for darker colors. If you change values other than colors, make it match your base gdm.css theme with one command, first - then go back in and itemize the remaining colors changes and save the file.

It is painful trial and error.

1 Like

I still don't understand which files in the gresource file are responsible for GDM. The gnome-shell.css file is also responsible for the regular desktop, isn't it, or is the one which is extracted from .gresource for gdm only? I'm a little worried that if I edit the Zorin theme or gnome-shell-theme, I might accidentally change things that affect more than just the gdm login screen.

In the comments on the gdm-app, I read that a user complained that the app also caused changes to the top bar outside of gdm, which isn’t supposed to happen.
How can I make sure that the changes I make only affect gdm?

If a property appears in multiple .css files of the extracted theme, does it have to be changed in all of them, and not just in one?

The gdm.css stylesheet can affect gnome-shell and GDM and the same is true of gnome-shell.css stylesheet If Both contain classes and properties for the other.

So what you ideally want is for the gdm.css stylesheet to only contain classes and properties for GDM. The gnome-shell.css to contain no GDM classes, and only Gnome-Shell classes.

What happens is that a theme creator copies one, for efficiency and ease, then adds in the classes and properties/values for the other...

What you can do is make Both match each other exactly, containing both gdm and gnome-shell - by making one sheet, then copying it, then renaming it the other. This creates a gnome-shell.css and a gdm.css that are identical.

1 Like

What is the name of the class/property I need to change to modify the text color of the top bar, the text color of the username, "not listed" and password input in gdm?

I already tried so many things for the panel and login-dialog-user-list.

After each test, when it didn't work, I removed the .gresouce file from ~, edited the .css at the extracted theme folder again, and then compiled it and replaced the last version of the .gresouce file in /usr/share/themes/ZorinBlue-Dark with the new version.

The most tests I made with the gnome-shell-theme, but there it was much more complicated because of the different .css files for gnome-shell (normal, light, dark) and gdm and gdm3...I'm not sure if the app gdm-settings had set leftovers there or changed things because I had installed it and removed the app in the same session. I suspect, I edited the wrong .css or need to edit all. The script is perhaps better for the Zorin theme which only has gnome-shell.css and gdm.css, but I didn't get it to work yet.
I'll try later today.

I have not themed Gnome in a while... and will not anymore.
I think it should be #panel for the Top bar. Text or icons inherit from panel.
So under the #panel class, used color for text color.

For the username widget, try
.user-widget-label

or:

.login-dialog-user-list-item

"Not listed": .login-dialog-not-listed-button

The password entry field, you can try StEntry or .login-dialog-prompt-entry. Gnome likes to keep changing class names on things between versions, they are the only dev that does this. It creates a lack of desire to theme Gnome.

1 Like

Thank you very much for your help!
I'll give it another try.
It's really frustrating and no fun at all, especially since you have to expect that it won't work anymore after an update and you'll have to start all over again.

But I'm also a little proud of myself for having at least taken one step forward fiddling out extracting and compiling a .gresouce file.

I hope the developers will take my suggestion into consideration and release a modified GDM theme, but I don't have much hope, since there were only a few supporters of this suggestion and it seems that most people don't see a need for it, perhaps because they use darker background images, where the dark theme works well.

I think that the ZorinGroup likely will take the suggestion seriously, despite an apparent lack of popular posts on it.
This is because the ZorinGroup takes Zorin Theme compatibility and function very seriously. This is less about popular opinion and more about the Zorin Themes working properly. And Popular Posting is not a reliable indicator of need - Many users will stay silent about theme issues.

I cannot say that they have seen your specific suggestion, though. I believe you are referring to this thread, so I will place a note on this in the moderator Forum to ensure that it is noticed by them.

2 Likes

Yes, that was the post I was referring to.

Another small step forward... I don't know exactly what change caused it, but I tried to find all the properties you mentioned, and the username is black now😀.

1 Like

Can the compilation script be modified so that it flags errors, e.g. syntax errors, and shows the lines which are wrong?
When you forget one charakter as e.g." or ;, you don't get a message at the moment, so you think, everything is fine, but it actually isn't. Often when I made a mistake, the gdm3 login-screen flickered or showed overlapping windows in double layers.

I've since figured out how to add the modified gdm theme as an option to update-alternatives. This way, I can choose which theme to use for the login screen. That's exactly what I had in mind - because so I can test it at my leisure and switch themes as I please, depending on whether I have a light or dark background image for gdm. :grinning_face:

I renamed my current modified Zorin theme to ZorinBlue-Dark-Edit and then copied the backup folder of the original Zorin theme back to /usr/share/themes.

Then I ran:

sudo update-alternatives --install /usr/share/gnome-shell/gdm-theme.gresource gdm-theme.gresource /usr/share/themes/ZorinBlue-Dark-Edit/gnome-shell/gnome-shell-theme.gresource 10

10 is the priority. The original Zorin theme has the highest priority 20, the gnome-shell-theme has 0, so I put mine between them.

With

sudo update-alternatives --config gdm-theme.gresource

I can select the theme which I want to use for the gdm login-screen:

I have now four options there, 3 is the number for my modified Zorin theme.

Perhaps it is better to set the priority of the gnome-shell-theme higher than the test version ZorinBlue-Dark-Edit (if it is the original and not modified as mine at the moment). I have now exchanged the priorities and set priority 0 for my modified Zorin theme and priority 10 for the gnome-shell-theme by running the install-command for both themes:

sudo update-alternatives --install /usr/share/gnome-shell/gdm-theme.gresource gdm-theme.gresource /usr/share/themes/ZorinBlue-Dark-Edit/gnome-shell/gnome-shell-theme.gresource 0
sudo update-alternatives --install /usr/share/gnome-shell/gdm-theme.gresource gdm-theme.gresource /usr/share/gnome-shell/gnome-shell-theme.gresource 10

I'm not sure what is better. I had been wondering whether priority matters when using the automatic mode (0), in case the prefered theme fails that the theme with the second-highest priority serves as a fallback. But I don't know if that's the case. For the manual mode, the priority doesn't matter.

If something goes wrong and the modified theme doesn't work and results in a white screen, switch to the TTY and login there. I usually set German as keyboard layout first by running sudo loadkeys de and then run the command to configure the GDM theme.

sudo update-alternatives --config gdm-theme.gresource

Select another theme there, e.g. the ZorinBlue-Dark there (look what the numbers are, e.g. 0)
Then restart gdm3

sudo systemctl restart gdm3

and you are back on the desktop.

I tested it just by removing (renaming) the .gresouce file from my edited Zorin theme which was set as gdm theme, and got a white screen then after logout. With this method I was able to get back to the normal desktop.

Well, the easiest Way would be when the Gnome Dev's would put in the Settings a Point called ''Login Screen'' and there You would be able to select Stuff like Background Picture, Theme, Icon, Font etc. Then it would be directly in the Gnome Desktop available.

But that might be a bit too much expected from the Gnome Dev's.

I thought I'd phrase my request in a way that would require the least amount of effort on the developers' part, so that there might be a better chance that they'll grant my request. Your suggestion would, of course, be the best solution for all users and would significantly improve accessibility for inexperienced users and those new to Linux.

It would really be nice if you could adjust the settings for the gdm login screen in Zorin without using external tools, scripts, or these highly complex procedures.