如何为一周中的每一天获取一张壁纸?

Lar*_*mbo 5 wallpaper

所以,我有个主意。为了让我更好地了解一周中的哪一天,我想要为每一天定制壁纸。但我不知道如何做到这一点。

是否存在可以为我做到这一点的任何软件?如果没有,任何人都可以帮助设置一个可以每天更改背景的脚本吗?

L. *_*mes 4

制作一个脚本,如本示例所示dailywallpaper.sh

#!/bin/bash

# Variables explained:
# [wallpaperpath]....The directory with your wallpapers.
# [background].......The wallpaper. For the current "Week" day make a symbolic
#                    link to the desired image.  Name the line the a number 
#                    between 1-7 with a dash and the name without extension.
#                    (ie. ln -s image.png 3-daily for the thrird day of the
#                    week)
# [default]..........The default wallpaper to set if the file matching the
#                     current day isn't found.

DBUS=$(ps aux | egrep "/gnome-session/.*\s--session=" | awk '{print $2}')
export $(strings /proc/$DBUS/environ | egrep DBUS_SESSION_BUS_ADDRESS)
day=$(date +"%u")

wallpaperpath="/home/userid/backgrounds/"
background="$day-daily"
default="manhattan-wallpaper-2.jpg"
# Default when the specified file isn't found.

newwallpaper="$wallpaperpath$default"
[[ -f "$wallpaperpath$background" ]] && newwallpaper="$wallpaperpath$background"

gsettings set org.gnome.desktop.background picture-uri "file://${newwallpaper}"
Run Code Online (Sandbox Code Playgroud)

脚本的注释中解释了脚本的用法。您可以将脚本设置为通过 运行crontab

crontab 示例条目:

# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
0 0 * * * /home/myaccount/bin/dailywallpaper.sh
Run Code Online (Sandbox Code Playgroud)

如果您在午夜未登录,则需要启动应用程序应用程序。启动应用程序将在您登录时进行更改。您可以在 Ubuntu Dash 中找到启动应用程序应用程序:(Ubuntu Dash -> Startup Applications)。

启动应用程序应用程序

crontab如果您已登录,则该条目将设置后台变量。Startup Applications如果 cron 运行时您在午夜未登录,则应用程序将设置该变量。

使用两者,将始终显示正确的当天壁纸。