Skip to content

Commit

Permalink
Merge branch 'n1be-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
boramalper committed Aug 16, 2016
2 parents 8a70f99 + cb1f47f commit 0e91cff
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
4 changes: 0 additions & 4 deletions himawaripy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,3 @@
output_file = os.path.join(appdirs.user_cache_dir(appname="himawaripy",
appauthor=False),
"latest.png")

# Xfce4 displays to change the background of
xfce_displays = ["/backdrop/screen0/monitor0/image-path",
"/backdrop/screen0/monitor0/workspace0/last-image"]
4 changes: 2 additions & 2 deletions himawaripy/himawaripy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from PIL import Image
from pytz import timezone
from tzlocal import get_localzone
from dateutil.tz import tzlocal

from .config import level, output_file, auto_offset, hour_offset
from .utils import set_background, get_desktop_environment
Expand All @@ -24,7 +24,7 @@

def get_time_offset(latest_date):
if auto_offset:
local_date = datetime.now(timezone(str(get_localzone())))
local_date = datetime.now(tzlocal())
himawari_date = datetime.now(timezone('Australia/Sydney'))
local_offset = local_date.strftime("%z")
himawari_offset = himawari_date.strftime("%z")
Expand Down
7 changes: 4 additions & 3 deletions himawaripy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import subprocess
from distutils.version import LooseVersion

from .config import xfce_displays


def set_background(file_path):
de = get_desktop_environment()
Expand All @@ -22,7 +20,10 @@ def set_background(file_path):
elif de == 'i3':
subprocess.call(['feh','--bg-max',file_path])
elif de == "xfce4":
for display in xfce_displays:
# Xfce4 displays to change the background of
displays = subprocess.getoutput('xfconf-query --channel xfce4-desktop --list | grep last-image').split()

for display in displays:
subprocess.call(["xfconf-query", "--channel", "xfce4-desktop", "--property", display, "--set", file_path])
elif de == "lxde":
subprocess.call(["pcmanfm", "--set-wallpaper", file_path, "--wallpaper-mode=fit", ])
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
description='Put near-realtime picture of Earth as your desktop background',
long_description='himawaripy is a Python 3 script that fetches near-realtime (10 minutes delayed) picture of Earth '
'as its taken by Himawari 8 (ひまわり8号) and sets it as your desktop background.',
install_requires=["appdirs", "pillow", "python-dateutil", "pytz", "tzlocal"],
install_requires=["appdirs", "pillow", "python-dateutil", "pytz"],
packages=find_packages(),
entry_points={'console_scripts': ['himawaripy=himawaripy.himawaripy:main']},
)

0 comments on commit 0e91cff

Please sign in to comment.