繁体   English   中英

如何在shell / bash脚本中更改linux上的桌面墙纸

[英]How to change the desktop wallpaper on linux from within a shell/bash script

我想从shell / bash脚本在linux上更改壁纸(使用其完整路径的特定文件)。

我已经找到了几种方法(见下文) - 但那些不适用于所有桌面环境。

a)使用gnome-settings-daemon / gsettings:

gsettings set org.gnome.desktop.background picture-uri   file://$fullPathToMyImage

b)使用gconftool-2

gconftool-2 --type=string --set /desktop/gnome/background/picture_filename $fullPathToMyImage

c)使用feh

feh --bg-scale $fullPathToMyImage

我现在正在寻找其他方法(虽然Gnome似乎用a,b和c覆盖) - 最适合所有桌面环境(以及所有Linux发行版)。

到目前为止,我至少缺少KDE4 / 5和XFCE的方法

类似的帖子: Shell脚本更改桌面壁纸

至于xfce,你可以使用这个命令:

 xfconf-query -c xfce4-desktop -p $xfce_desktop_prop_prefix/workspace1/last-image -s /path/to/file

并且还有用的设置图像缩放例如

xfconf-query -c xfce4-desktop -p $xfce_desktop_prop_prefix/workspace1/image-style -s 5

您可以在我的脚本中看到我是如何做到的 - https://github.com/yatsenko-ihor/himawari8-wallaper/blob/master/himawari8_wallaper.sh

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM