I found Terminal command to change desktop wallpaper:
gsettings set org.gnome.desktop.background picture-uri file:///path/to/your/image.png
but this command not working in cron and other desktops like Mate. pgrep gnome-session
approach shows nothing for me.
答案 0 :(得分:3)
您可以使用<Animated.View style={{...style.placeCardContent, transform: [{
translateX: 0
},{
translateY: this.state.placeCard.y.interpolate({
inputRange: [0, deviceHeight - placeCardClosedHeight],
outputRange: [0, -(Math.round(deviceHeight / 2) - 160)]
})
}]}}>
来更改背景。这是简单的bash脚本的示例:
dconf
您可以使用GUI应用- dconf-editor
找到特定于发行版的密钥但是要在CRON中使用此脚本,您需要设置会话环境变量。命令#!/bin/bash
WP="$(find ~+ -type f -exec mimetype {} + 2>/dev/null | awk -F': +' '{ if ($2 ~ /^image\//) print $1 }' | sort -R | tail -30 | shuf -n 1)"
dconf write /org/mate/desktop/background/picture-filename "'${WP}'"
在Mint和其他非Gnome桌面中不起作用。要解决此问题,您需要通过在系统启动时运行命令来保存特定用户的环境变量:
pgrep gnome-session
现在您的用户主目录中有env > ~/cronenv && sed -i '/%s/d' ~/cronenv
个文件(无替代变量-%s)。只需在运行cronenv
之前将它们恢复到cron中即可:
dconf
使用crontab -e编辑当前用户的cron作业。一切正常!