uld*_*ics 4 wallpaper command-line ubuntu-mate
我刚刚在 Ubuntu 16.10 上安装了 Mate DE。我想在每次登录后自动更改我的桌面背景。在 LXDE 上,这很容易完成,立即生效(只为在桌面加载后自动加载而休眠),使用下一个命令:
bash -c 'sleep 5; pcmanfm -w "$(find ~/Pictures/Wallpapers -type f | shuf -n1)"'
Run Code Online (Sandbox Code Playgroud)
当然,这不适用于 Mate。我收到此错误:
Desktop manager is not active.
Run Code Online (Sandbox Code Playgroud)
我为 Mate 获得的唯一解决方案涉及mateconftool-2,我没有安装它,看起来它已被弃用。它应该被其他东西取代,可能gconftool-2或gsettings。
只是将以下mateconftool-2命令替换为gconftool-2(这是我读过的一些论坛帖子)没有任何作用:
mateconftool-2 -t string -s /desktop/mate/background/picture_filename $(find ~/Pictures/Wallpapers -type f | shuf -n1)
Run Code Online (Sandbox Code Playgroud)
该gsettings命令被接受,但不会改变实际图片:
gsettings set org.gnome.desktop.background picture-uri "file://$(find ~/Pictures/Wallpapers -type f | shuf -n1)"
Run Code Online (Sandbox Code Playgroud)
虽然我可以看到它改变了价值:
myusername@mypcname:~$ gsettings get org.gnome.desktop.background picture-uri 'file:///home/myusername/Pictures/Wallpapers/Horex-VR6-Cafe-Racer-33-LTD-2014-1920x1080-001.jpg'
Run Code Online (Sandbox Code Playgroud)
我如何让它工作?
小智 6
您可以dconf为此使用该工具。
例如:
dconf write /org/mate/desktop/background/picture-filename "'PATH-TO-JPEG'"
Run Code Online (Sandbox Code Playgroud)
请注意图像文件名/路径的引用。 dconf需要一个字符串,因此需要单引号,而您的 shell 将需要双引号来保留单引号。