GNOME 中一个非常酷,但鲜为人知的功能是它能够将幻灯片显示为壁纸。您可以在 GNOME 控制中心的背景设置面板中选择壁纸幻灯片。壁纸幻灯片与静态壁纸的区别在于预览的右下角显示的小时钟标志。
一些发行版预装了幻灯片壁纸。例如,Ubuntu 包含标准的 GNOME 定时壁纸幻灯片,以及 Ubuntu 壁纸竞赛的获奖作品之一。
如果您想创建自己的自定义幻灯片作为壁纸怎么办?虽然 GNOME 没有为此提供用户界面,但使用您主目录中的一些简单 XML 文件创建幻灯片非常简单。幸运的是,GNOME 控制中心中的背景选择支持一些常见的目录路径,这使得创建幻灯片变得容易,而无需编辑发行版提供的任何内容。
入门
使用您喜欢的文本编辑器,在 $HOME/.local/share/gnome-background-properties/
中创建一个 XML 文件。虽然文件名并不重要,但目录名很重要(您可能需要创建该目录)。在我的示例中,我创建了 /home/ken/.local/share/gnome-background-properties/osdc-wallpapers.xml
,内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
<wallpapers>
<wallpaper deleted="false">
<name>Opensource.com Wallpapers</name>
<filename>/home/ken/Pictures/Wallpapers/osdc/osdc.xml</filename>
<options>zoom</options>
</wallpaper>
</wallpapers>
上面的 XML 文件需要为每个要包含在 GNOME 控制中心 backgrounds
面板中的幻灯片或静态壁纸添加一个 <wallpaper>
节。

opensource.com
在此示例中,我的 osdc.xml
文件如下所示:
<?xml version="1.0" ?>
<background>
<static>
<!-- Duration in seconds to display the background -->
<duration>30.0</duration>
<file>/home/ken/Pictures/Wallpapers/osdc/osdc_2.png</file>
</static>
<transition>
<!-- Duration of the transition in seconds, default is 2 seconds -->
<duration>0.5</duration>
<from>/home/ken/Pictures/Wallpapers/osdc/osdc_2.png</from>
<to>/home/ken/Pictures/Wallpapers/osdc/osdc_1.png</to>
</transition>
<static>
<duration>30.0</duration>
<file>/home/ken/Pictures/Wallpapers/osdc/osdc_1.png</file>
</static>
<transition>
<duration>0.5</duration>
<from>/home/ken/Pictures/Wallpapers/osdc/osdc_1.png</from>
<to>/home/ken/Pictures/Wallpapers/osdc/osdc_2.png</to>
</transition>
</background>
上面的 XML 中有几个重要的部分。XML 中的 <background>
节点是您的外部节点。每个背景都支持多个 <static>
和 <transition>
节点。
<static>
节点定义要显示的图像以及显示它的持续时间,分别使用 <duration>
和 <file>
节点。
<transition>
节点为每个过渡定义 <duration>
、<from>
图像和 <to>
图像。
全天更换壁纸
GNOME 的另一个很酷的功能是基于时间的幻灯片。您可以定义幻灯片的开始时间,GNOME 将根据它计算时间。这对于根据一天中的时间设置不同的壁纸非常有用。例如,您可以将开始时间设置为 06:00,并显示一个壁纸直到 12:00,然后在下午更换它,并在 18:00 再次更换。
这是通过在您的 XML 中像这样定义 <starttime>
来实现的:
<starttime>
<!-- A start time in the past is fine -->
<year>2017</year>
<month>11</month>
<day>21</day>
<hour>6</hour>
<minute>00</minute>
<second>00</second>
</starttime>
上面的 XML 在 2017 年 11 月 21 日 06:00 启动了动画,持续时间为 21,600.00 秒,等于六小时。这将显示您的早晨壁纸直到 12:00,届时它将更改为您的下一个壁纸。您可以继续以这种方式在一天中的任何时间间隔更改壁纸,但请确保所有持续时间的总和为 86,400 秒(等于 24 小时)。
GNOME 将计算开始时间和当前时间之间的差值,并显示当前时间的正确壁纸。例如,如果您在 16:00 选择新的壁纸,GNOME 将显示从 06:00 开始时间起 36,000 秒后的适当壁纸。
有关完整示例,请参阅大多数发行版中的 gnome-backgrounds 软件包提供的 adwaita-timed 幻灯片。它通常位于 /usr/share/backgrounds/gnome/adwaita-timed.xml
。
更多信息
希望这能鼓励您深入了解创建自己的幻灯片壁纸。如果您想下载本文中引用的文件的完整版本,可以在 GitHub 上找到它们。
如果您对用于生成 XML 文件的实用程序脚本感兴趣,您可以在互联网上搜索 gnome-background-generator。
2 条评论