Gnome 背景登录,不变(更改后)

Gnome 背景登录,不变(更改后)

我尝试更改 Gnome 中的登录背景图片(GNOME Shell 3.14.4 - Ubuntu 15.04),这样做主题:无法更改 GDM 登录屏幕背景

copy the image you want to use into the /usr/share/gnome-shell/theme folder
sudo gedit /usr/share/gnome-shell/theme/gnome-shell.css

Search for the following section

#lockDialogGroup {
background: #2e3436 url(noise-texture.png);
background-repeat: no-repeat;

change the name of the image to your image
set background to repeat or no-repeat

Save the file
logout and your new background is there

我的图片是 .jpg 文件,这可能是问题所在吗?有解决办法吗?如果您需要更多信息,请告诉我。谢谢。

答案1

应该没问题(我想我之前确实用过 JPG),不过有几点需要注意:

  • 如果您希望它填满显示屏(除非您正在进一步修改 CSS),则需要使图像的大小与通常的显示分辨率相同才能正常工作(除非您希望它平铺多个副本)
  • 如果你复制你添加或修改的文件,这将使它更容易
  • 对于 3.16+ 来说,它相当复杂(参见这里这里:)

注意:自 GNOME 3.16 起,GNOME Shell 主题现在存储为二进制文件 (gresource)。

首先,您需要将现有的 GNOME Shell 主题提取到主目录中的文件夹中。您可以使用以下脚本执行此操作(extractgst.sh

#!/bin/sh

workdir=${HOME}/shell-theme
if [ ! -d ${workdir}/theme ]; then
  mkdir -p ${workdir}/theme
fi
gst=/usr/share/gnome-shell/gnome-shell-theme.gresource

for r in `gresource list $gst`; do
        gresource extract $gst $r >$workdir${r/#\/org\/gnome\/shell/}
done

导航到创建的目录。您应该发现主题文件已被提取到其中。现在将您喜欢的背景图像复制到此目录。

接下来,需要gnome-shell-theme.gresource.xml在目录中创建一个文件,内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<gresources>
  <gresource prefix="/org/gnome/shell/theme">
    <file>calendar-arrow-left.svg</file>
    <file>calendar-arrow-right.svg</file>
    <file>calendar-today.svg</file>
    <file>checkbox-focused.svg</file>
    <file>checkbox-off-focused.svg</file>
    <file>checkbox-off.svg</file>
    <file>checkbox.svg</file>
    <file>close-window.svg</file>
    <file>close.svg</file>
    <file>corner-ripple-ltr.png</file>
    <file>corner-ripple-rtl.png</file>
    <file>dash-placeholder.svg</file>
    <file>filter-selected-ltr.svg</file>
    <file>filter-selected-rtl.svg</file>
    <file>gnome-shell.css</file>
    <file>gnome-shell-high-contrast.css</file>
    <file>logged-in-indicator.svg</file>
    <file>filename</file>
    <file>more-results.svg</file>
    <file>no-events.svg</file>
    <file>no-notifications.svg</file>
    <file>noise-texture.png</file>
    <file>page-indicator-active.svg</file>
    <file>page-indicator-inactive.svg</file>
    <file>page-indicator-checked.svg</file>
    <file>page-indicator-hover.svg</file>
    <file>process-working.svg</file>
    <file>running-indicator.svg</file>
    <file>source-button-border.svg</file>
    <file>summary-counter.svg</file>
    <file>toggle-off-us.svg</file>
    <file>toggle-off-intl.svg</file>
    <file>toggle-on-us.svg</file>
    <file>toggle-on-intl.svg</file>
    <file>ws-switch-arrow-up.png</file>
    <file>ws-switch-arrow-down.png</file>
  </gresource>
</gresources>

代替文件名使用您的背景图像的文件名。

现在,打开目录中的gnome-shell.css文件,并将定义更改#lockDialogGroup如下:

#lockDialogGroup {
  background: #2e3436 url(filename);
  background-size: [WIDTH]px [HEIGHT]px;
  background-repeat: no-repeat;
}

设置background-size为 GDM 使用的分辨率,这可能不一定是图像的分辨率。同样,设置文件名作为背景图像的名称。

最后,使用以下命令编译主题:

$ glib-compile-resources gnome-shell-theme.gresource.xml

然后将生成的gnome-shell-theme.gresource文件复制到 /usr/share/gnome-shell目录中。

重新启动 GDM - 你会发现它正在使用你喜欢的背景图像

答案2

坦率地说,由于“noise-texture.png”是“.png”格式,因此最好使用相同格式的背景以避免其他系统问题。

最好的猜测是尝试将您喜欢的 .jpg 转换为 .png ---> 平安 ;)

相关内容