如何更換 Ubuntu 系統(tǒng)的 GDM 登錄界面背景

How To Change GDM Login Screen Background In Ubuntu

如何更換 Ubuntu 系統(tǒng)的 GDM 登錄界面背景

Whenever you log in or lock and unlock your Ubuntu 18.04 LTS desktop, you will be greeted with a plain purple-colored screen. It is the default GDM (GNOME Display Manager) background since Ubuntu version 17.04. Some of you may feel boring to look at this plain background and want to make the Login screen something cool and eye-candy! If so, you’re on the right track. This brief guide describes how to change GDM Login screen background in Ubuntu 18.04 LTS desktop.

Ubuntu 18.04 LTS 桌面系統(tǒng)在登錄、鎖屏和解鎖狀態(tài)下,我們會(huì)看到一個(gè)純紫色的背景。它是 GDM(GNOME 顯示管理器 GNOME Display Manager)從 ubuntu 17.04 版本開(kāi)始使用的默認(rèn)背景。有一些人可能會(huì)不喜歡這個(gè)純色的背景,想換一個(gè)酷一點(diǎn)、更吸引眼睛的!如果是這樣,你找對(duì)地方了。這篇短文將會(huì)告訴你如何更換 Ubuntu 18.04 LTS 的 GDM 登錄界面的背景。

Change GDM Login Screen Background In Ubuntu

更換 Ubuntu 的 GDM 登錄界面背景

Here is how the default GDM login screen background image looks like in Ubuntu 18.04 LTS desktop.

這是 Ubuntu 18.04 LTS 桌面系統(tǒng)默認(rèn)的登錄界面。

20190309200905861_46144125.png

Whether you like it or not, you will stumbled upon this screen every time you log in or lock and unlock the system. No worries! You can change this background with any beautiful image of your choice.
Changing desktop wallpaper and user’s profile picture is not a big deal in Ubuntu. We can do it with a few mouse clicks in no time. However, changing Login/Lock screen background need a little bit editing of a file called ubuntu.css located under /usr/share/gnome-shell/theme directory.
Before modifying this file, take a backup of this file. So, we can restore it if something went wrong.

不管你喜歡與否,你總是會(huì)不經(jīng)意在登錄、解屏/鎖屏的時(shí)面對(duì)它。別擔(dān)心!你可以隨便更換一個(gè)你喜歡的圖片作為背景。

在 Ubuntu 上更換桌面壁紙和用戶(hù)的資料圖像不難。我們可以點(diǎn)擊鼠標(biāo)就搞定了。但更換解屏/鎖屏的背景則需要修改文件 ubuntu.css,它位于 /usr/share/gnome-shell/theme。

修改這個(gè)文件之前,最好備份一下它。這樣我們可以避免出現(xiàn)問(wèn)題時(shí)可以恢復(fù)它。

sudo cp /usr/share/gnome-shell/theme/ubuntu.css /usr/share/gnome-shell/theme/ubuntu.css.bak

Now, edit ubuntu.css file:

現(xiàn)在,開(kāi)始編輯文件 ubuntu.css。

sudo nano /usr/share/gnome-shell/theme/ubuntu.css
  • 注:這里可以選擇自己喜歡的文本編輯工具,比如 vim、gedit 等,本文作者使用的是 nano。

Find the following lines under the directive named “l(fā)ockDialogGroup” in the file:

在文件中找到關(guān)鍵字<font color=red> lockDialogGroup</font>,如下行:

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

As you can see, the default image for the GDM login screen is noise-texture.png.
Now, change the background image by adding your image path. You can use either .jpg or .png file. Both format images worked fine for me. After editing the file, the contents of file will look like below:

可以看到,GDM 默認(rèn)登錄的背景圖片是 noise-texture.png

現(xiàn)在修改為你自己的圖片路徑。也可以選擇 **.jpg **或 .png 格式的文件,兩種格式的圖片文件都是支持的。修改完成后的文件內(nèi)容如下:

#lockDialogGroup {
   background: #2c001e url(file:///home/sk/image.png);
   background-repeat: no-repeat; 
   background-size: cover;
   background-position: center;
}

Please pay little attention to the modified version of this directive in the ubuntu.css file. I have marked the changes in bold.

請(qǐng)注意 ubuntu.css 文件里這個(gè)關(guān)鍵字的修改,我把修改點(diǎn)加粗了。

As you might have noticed, I have changed the line “…url(resource:///org/gnome/shell/theme/noise-texture.png);” with “…url(file:///home/sk/image.png);”. I.e You should change “…url(resource…” to “…url(file..”.

你可能注意到,我把原來(lái)的 ... url(resource:///org/gnome/shell/theme/noise-texture.png); 修改為 ... url(file:///home/sk/image.png);。也就是說(shuō),你可以把 ... url(resource ... 修改為 .. url(file ...。

Also, I have changed the value of “background-repeat:” parameter from “repeat” to “no-repeat” and added two more lines. You can simply copy/paste the above lines and change image path with your own in your ubuntu.css file.

同時(shí),你可以把參數(shù) background-repeat: 的值 repeat 修改為 no-repeat,并增加另外兩行。你可以直接復(fù)制上面幾行的修改到你的 ubuntu.css 文件,對(duì)應(yīng)的修改為你的圖片路徑。

Once you are done, save and close the file. And, reboot your system.

修改完成后,保存和關(guān)閉此文件。然后系統(tǒng)重啟生效。

Here is my GDM login screen with updated backgrounds:

下面是 GDM 登錄界面的最新背景圖片:

20190309202405565_1748831120.png
20190309202502188_338757135.png

Cool, yeah? As you can see, changing GDM login screen is not that difficult either. All you have to do is to change the path of the image in ubuntu.css file and restart your system. It is simple as that. Have fun!

是不是很酷,你都看到了,更換 GDM 登錄的默認(rèn)背景很簡(jiǎn)單。你只需要修改 ubuntu.css 文件中圖片的路徑然后重啟系統(tǒng)。是不是很簡(jiǎn)單也很有意思.

You can also edit gdm3.css file located under /usr/share/gnome-shell/theme directory and modify it as shown above to get the same result. Again, don’t forget to take the backup of the file before making any changes.

你也可以修改 /usr/share/gnome-shell/theme 目錄下的文件 gdm3.css ,具體修改內(nèi)容和修改結(jié)果和上面一樣。同時(shí)記得修改前備份要修改的文件。

And, that’s all now. More good stuffs to come. Stay tuned!

就這些了。如果有好的東東再分享了,請(qǐng)大家關(guān)注!

Cheers!

后會(huì)有期。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容