oct*_*pus 10 ubuntu desktop-customization windows-10
是否可以将其设置为每隔几个小时自动更新的桌面背景(地图本身每三个小时更新一次)?
这个问题在本质上是相似的:如何将来自国际空间站的实时视频源设置为我的桌面背景?.
我使用的是 Windows 10 和 Ubuntu,但我会让这个问题更笼统。
编辑:
程序WallpaperWebPage 有正确的想法,但有以下限制:
在 Ubuntu 上我使用多样性。它是“自动壁纸更换器、下载器和管理器”。
它可以从 RSS 提要中提取图片并自动更新您的桌面。
因此,我想,如果您设置一个 RSS 提要,每隔 x 小时拍摄一次您网站的屏幕截图,并为其添加各种内容,您就会有一个解决方案。
我实际上不知道如何设置 RSS 提要,但如果您对多样性有任何疑问,请告诉我。
编辑:
这是做你想做的事的另一种方法。
sudo apt-get install libqt5webkit5 python3-pyqt5.qtwebkit python3-pyqt5 python3以安装所需的库使用以下 python3 代码设置文件。此代码从 WEBSITE_URL 获取屏幕截图并更新您的 Ubuntu 桌面。
import sys
import time
import os
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtWebKitWidgets import *
WEBSITE_URL='https://earth.nullschool.net/#current/wind/surface/level/overlay=temp/winkel3'
OUT_FILE="websiteScreenshot.png"
class Screenshot(QWebView):
def __init__(self):
self.app = QApplication(sys.argv)
QWebView.__init__(self)
self._loaded = False
self.loadFinished.connect(self._loadFinished)
def capture(self, url, output_file):
self.load(QUrl(url))
self.wait_load()
# set to webpage size
frame = self.page().mainFrame()
self.page().setViewportSize(frame.contentsSize())
# render image
image = QImage(self.page().viewportSize(), QImage.Format_ARGB32)
painter = QPainter(image)
frame.render(painter)
painter.end()
print ('saving', output_file)
image.save(output_file)
def wait_load(self, delay=5):
# process app events until page loaded
while not self._loaded:
self.app.processEvents()
t_end = time.time() + delay
while time.time() < t_end:
self.app.processEvents()
self._loaded = False
def _loadFinished(self, result):
self._loaded = True
s = Screenshot()
s.capture(WEBSITE_URL, OUT_FILE)
#Update your background
workingDir=os.path.dirname(os.path.realpath(__file__))
os.system("gsettings set org.gnome.desktop.background picture-uri file://"+workingDir+"/"+OUT_FILE)
Run Code Online (Sandbox Code Playgroud)在“启动应用程序”中按添加并watch -n 3600 python3 yourfilepath在命令下键入。替换yourfilepath为保存 python 脚本的路径。这将每 3600 秒 = 1 小时运行一次脚本。
注意 wait_load 函数中的延迟变量。如果网页没有时间加载,则增加它的值。
| 归档时间: |
|
| 查看次数: |
3646 次 |
| 最近记录: |