Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add win10 support #109

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ https://github.com/vician
https://github.com/wesbarnett
https://github.com/xenithorb
https://github.com/yupyupp
https://github.com/konosubakonoakua

https://www.reddit.com/u/officerchrister

Expand Down
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ near-realtime picture of Earth.
* GNOME 3
* Cinnamon 2.8.8
* KDE
* Win10 1909 with python3.7

### Not Supported

* any other desktop environments that are not mentioned above.

## Configuration
Expand Down Expand Up @@ -159,6 +161,41 @@ Finally, to launch it, enter this into the console:

launchctl load ~/Library/LaunchAgents/org.boramalper.himawaripy.plist

### For Win10 Users

- change background color

![](./win/figures/bg.png)

- install from source

`python3 setup.py install`

after the installation,you can use `hiwamaripy` to fetch photos.

![](./win/figures/tutorial-win-cmd.gif)



- modify `./win/auto.bat`

add your own parameters

![](./win/figures/pic2.png)



- modify `./win/task.xml`

replace the content of `<Command>` with your `run_silently.vbs` abs path,

so as the content of `<WorkingDirectory>`

![](./win/figures/pic1.png)

- gif tutorial

![](./win/figures/tutorial-win.gif)

## Uninstallation

Expand Down
14 changes: 12 additions & 2 deletions himawaripy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@
import subprocess
from distutils.version import LooseVersion

import win32api
import win32gui
from win32.lib import win32con


def set_background(file_path):
de = get_desktop_environment()

if de == "mac":
if de == "windows":
key = win32api.RegOpenKeyEx(win32con.HKEY_CURRENT_USER,
"Control Panel\\Desktop", 0, win32con.KEY_SET_VALUE)
win32api.RegSetValueEx(key, "WallpaperStyle", 0, win32con.REG_SZ, "6")
# 2 for stretching, 0 for centering, 6 for fitting
win32api.RegSetValueEx(key, "TileWallpaper", 0, win32con.REG_SZ, "0")
win32gui.SystemParametersInfo(win32con.SPI_SETDESKWALLPAPER, file_path, 1 + 2)
elif de == "mac":
subprocess.call(["osascript", "-e",
'tell application "System Events"\n'
'set theDesktops to a reference to every desktop\n'
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#-*- coding: utf-8 -*-
from setuptools import setup, find_packages

with open("README.md", "r") as f:
with open("README.md", "r",encoding="utf-8") as f:
long_description = f.read()

setup(
Expand Down
1 change: 1 addition & 0 deletions win/auto.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
himawaripy --level=4
Binary file added win/figures/bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added win/figures/pic1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added win/figures/pic2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added win/figures/tutorial-win-cmd.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added win/figures/tutorial-win.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions win/install.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@Echo off
schtasks /Create /XML ./task.xml /TN himawari8
pause
6 changes: 6 additions & 0 deletions win/run_silently.vbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Dim path
set oShell = CreateObject("WScript.Shell")
set fso = CreateObject("Scripting.FileSystemObject")
path = fso.GetAbsolutePathName("./auto.bat")
' msgbox path
oShell.run path, 0, ture
55 changes: 55 additions & 0 deletions win/task.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Author>konosubakonoakua</Author>
<Description>get himawari8 images and set as background</Description>
<URI>\himawari8</URI>
</RegistrationInfo>
<Triggers>
<CalendarTrigger>
<Repetition>
<Interval>PT1H</Interval>
<Duration>P1D</Duration>
<StopAtDurationEnd>false</StopAtDurationEnd>
</Repetition>
<StartBoundary>2019-12-03T11:25:30</StartBoundary>
<Enabled>true</Enabled>
<ScheduleByDay>
<DaysInterval>1</DaysInterval>
</ScheduleByDay>
</CalendarTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<LogonType>InteractiveToken</LogonType>
<RunLevel>LeastPrivilege</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>false</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
<UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT72H</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>D:\doc\repo\himawaripy\win\run_silently.vbs</Command>
<WorkingDirectory>D:\doc\repo\himawaripy\win</WorkingDirectory>
</Exec>
</Actions>
</Task>
3 changes: 3 additions & 0 deletions win/uninstall.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
schtasks /Delete /TN himawari8

pause