簡體   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