agg*_*877 13 desktop linux-mint cinnamon
我正在使用 Cinnamon 1.6 运行 Mint 13。我希望我的桌面壁纸根据一天中的时间自动更改。所以,首先想到的是设置一个 cron 作业来为我做这件事。问题是,我不知道如何从脚本/终端更改壁纸。
我想知道的是:
1)如何从终端更改背景?
2)是否已经有一种内置的方式来做到这一点?
Ram*_*Man 21
这是问题的正确答案。其他任何事情都只是一个黑客
gsettings set org.cinnamon.desktop.background picture-uri "file:///filename"
Run Code Online (Sandbox Code Playgroud)
Tig*_*ger 10
使用 Linux Mint 16(不确定其他版本),您可以使用它gsettings来获取有关当前壁纸的信息以及设置它。
该man gsettings是有点薄,但TAB建成后,将在下面的命令大多数步骤工作。
获取信息:
gsettings get org.cinnamon.desktop.background picture-uri
gsettings get org.cinnamon.desktop.background picture-opacity
gsettings get org.cinnamon.desktop.background picture-options
Run Code Online (Sandbox Code Playgroud)
要更改任何选项,只需将“get”更改为“set”并将新值添加到末尾。
这是一个快速脚本,它将在已知的壁纸列表中循环:
#!/bin/sh
#
# Set the wallpaper from a list
#
# The list, all can be found in $BASE
BASE="file:///home/tigger/.wallpapers/"
LIST="shot1.png another.png just_no_space_in_name.png keep_adding.png"
# The current wallpaper
current=`gsettings get org.cinnamon.desktop.background picture-uri`
opacity=`gsettings get org.cinnamon.desktop.background picture-opacity`
options=`gsettings get org.cinnamon.desktop.background picture-options`
# loop over the list until we find a match
matched=0
new=""
for wp in $LIST
do
if [ $matched -eq 1 ]
then
new="${BASE}${wp}"
break
elif [ "'${BASE}${wp}'" = "${current}" ]
then
matched=1
fi
done
# if "$new" is blank, then we show the first shot
if [ "$new" = "" ]
then
new=${BASE}${LIST%% *}
fi
# set the wallpaper
gsettings set org.cinnamon.desktop.background picture-uri \'${new}\'
gsettings set org.cinnamon.desktop.background picture-opacity ${opacity}
gsettings set org.cinnamon.desktop.background picture-options ${options}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
39620 次 |
| 最近记录: |