If you’ve already tried Elementary OS, you probably enjoyed the smooth login sequence from login screen to desktop without interruption.

However, I think it’s not worth changing OS just for that, especially to end up with a 2-year old Ubuntu :-). And besides, I do not intend to drop my old friends Firefox and Thunderbird, so Elementary is limited interest for me (it is a personal choice). I recognize, however, that it’s great work, so why not just do the same thing with our favorite Ubuntu ? Here is an experimental approach that probably deserves to be refined, but it works.

Note that another approach is to install lightdm and Pantheon (see here : https ://gandalfn.ovh/) but this is not the purpose of this post, the idea is to do it with Gnome. The goal is : no change of wallpaper between the login screen and the desktop with Ubuntu 18.04 (also works in 17.10) and Gnome 3.28.

We need to perform a three steps modification to the basic Ubuntu 17.10 or 18.04 login sequence to meet our requirements :

  • Replace the purple login screen wallpaper with the desktop one
  • Replace the purple wallpaper during the transition between the login screen and the desktop by the desktop one too
  • Remove the desktop zoom effect when it opens

Prerequisites

We will first create a wallpaper to the size of our screen, which we will use throughout the post. For example, I created /usr/share/backgrounds/Lighthouse_at_sunrise_by_Frenchie_Smalls_1366x768.jpg which is the adjusted version to my screen of one of Ubuntu’s native wallpapers. I used Gimp to resize it.

We will also need to install the python-gnome2 package to achieve the third point :

sudo apt install python-gnome2

Replace the login wallpaper

Source : http ://ubuntuhandbook.org/index.php/2017/10/change-login-screen-background-ubuntu-17-10/

It’s easy, just change a css rule in the /etc/alternatives/gdm3.css file (make a copy before you edit it).

sudo vim /etc/alternatives/gdm3.css

Then look for #lockDialogGroup in the file

Change :

#lockDialogGroup {
  background : # 607D8B url ("assets / noise-texture.svg") ;
  background-size : cover ;
}

To :

#lockDialogGroup {
   background : # 607D8B url ("file : ///usr/share/backgrounds/Lighthouse_at_sunrise_by_Frenchie_Smalls_1366x768.jpg") ;
   background-size : cover ;
   background-position : center ;
   background-repeat : no-repeat ;
 }

Incidentally, we will use the same wallpaper for the lock screen, it’s also easy (we can also use gnome-tweak GUI tool) :

gsettings set org.gnome.desktop.screensaver picture-uri 'file : ///usr/share/backgrounds/Lighthouse_at_sunrise_by_Frenchie_Smalls_1366x768.jpg'

Replace the transitional background between login screen and the desktop

Source : https ://ubuntuforums.org/showthread.php ?t=2384043&p=13736129#post13736129

This problem does not appear until the previous point is over, because it is the same dark purple background and so we do not see the difference before. The trick here is that this purple background is not directly accessible in a css file as the rule is embedded in a Gnome resource file : /usr/share/gnome-shell/gnome-shell-theme.gresource

We will therefore use the excellent script provided in the source above to recreate this resource file.

Install the devpy script :

cd ~ / <some_job_folder>
git clone https ://github.com/devpytech/scripts.git

Extract the sources of the gnome resource file :

cd scripts / gresource-extract
rm -rfv theme
mkdir theme
mkdir icons
./extract.sh

Edit gnome-shell.css :

vim ./theme/gnome-shell.css

Change :

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

To (the background color does not matter, we do not see it) :

#lockDialogGroup {
  background : # 607D8B url (resource : ///org/gnome/shell/theme/noise-texture.png) ;
  background-position : center ;
  background-repeat : no-repeat ; }

Copy the wallpaper that we use everywhere under the name noise-texture.png in the theme folder :

cp /usr/share/backgrounds/Lighthouse_at_sunrise_by_Frenchie_Smalls_1366x768.jpg theme / noise-texture.png

Recreate the gnome resource file :

./build.sh

Save the original resource file :

sudo cp /usr/share/gnome-shell/gnome-shell-theme.gresource/usr/share/gnome-shell/gnome-shell-theme.gresource.orig

Install the new :

sudo mv ./theme/gnome-shell-theme.gresource/usr/share/gnome-shell/gnome-shell-theme.gresource

There you go ! There is only one step left (but it’s not the easiest …)

Remove the zoom effect from the desktop when it opens

The zoom effect comes from the Gnome org.gnome.desktop.interface enable-animations parameter to true (can get it with dconf or gsettings get or in gnome-tweak). If we set it to false, no more dock windows will have this effect, which is disapointing. So, we will disable the animation when login and reactivate it after. Specifically, the animation will be disabled (gsettings set org.gnome.desktop.interface enable-animations false) when the user ends his Gnome session and will be re-enabled (gsettings set org.gnome.desktop.interface enable-animations true) when the user opens his/her session (after login). There should be a better way to do it but I haven’t found yet.

Step 1 : Restore the animation after the user’s login

Source : https ://stackoverflow.com/questions/8247706/start-script-when-gnome-starts-up

We will automatically restore animation after login using a standard Gnome feature : application autostart.

Note : we can also do it using « Startup Applications » graphic tool.

cd ~ / .config/autostart

Create a script that does the job, slightly offset to avoid restoring the animation before desktop is displayed :

touch gsettings.sh
chmod + x gsettings.sh
vim gsettings.sh

Containing :

# ! / Bin / bash
sleep 10
gsettings set org.gnome.desktop.interface enable-animations true
$ HOME / .config / autostart / gsettings_shutdown.sh &

(the last line is intended to launch the script that will be explained in step 2)

This script will be launched by Gnome thanks to a desktop file located in .config/autostart (the name does not matter however the extension must be desktop). For more details on this subject : https ://developer.gnome.org/integration-guide/stable/desktop-files.html

Create a .desktop file :

vim gsettings.desktop

Containing :

[Desktop Entry]
Type = Application
Exec = / home / <votre_user> /. Config / autostart / gsettings.sh
Hidden = false
NoDisplay = false
X-GNOME-autostart-enabled = true
Name [en_US] = Enable Gnome Animations
Name = Enable Gnome Animations
Comment [en_FR] = Reactivation after login
Comment = Reactivation after login

That’s all for this first step.

Step 2 : Disable the animation at logoff, in anticipation of the next login

Source : https ://askubuntu.com/questions/293312/execute-a-script-upon-logout-reboot-shutdown-in-ubuntu

Of course, you must disable the animation at logoff to not have it at the next login, with the command

gsettings set org.gnome.desktop.interface enable-animations false

Unfortunately, putting this command in .bash_logout does not work. We will then use this python script :

https ://www.linuxquestions.org/questions/linux-desktop-74/gnome-run-script-on-logout-724453/#post3560301

We are still in the $HOME/.config/autostart folder

Create a file gsettings_shutdown.sh and make it executable (I call it like that because it can also catch computer shutdown, in addition to Gnome end of session) :

touch gsettings_shutdown.sh
chmod + x gsettings_shutdown.sh
vim gsettings_shutdown.sh

Copy the script content provided in the link above.

Replace the line :

retcode = subprocess.call ("truecrypt -d", shell = True)

With (you will recognize the gsettings command) :

retcode = subprocess.call ("gsettings set org.gnome.desktop.interface enable-animations false", shell = True)

This script will be started at logon by gsettings.sh as we saw in step 1. It will listen to Gnome events to detect logoff and execute our gsettings command.

That’s all (and it’s enough) !

 

Tags : ,

Classés dans :

Pour aller plus loin