Browse Source

fix --set-desktop for linux, add Requirements section to README.md

master
Niklas Rosenstein 1 year ago
parent
commit
0307370bea
No known key found for this signature in database GPG Key ID: 6D269B33D25F6C6
3 changed files with 9 additions and 2 deletions
  1. + 5
    - 0
      README.md
  2. + 1
    - 1
      src/wpx/__main__.py
  3. + 3
    - 1
      src/wpx/setwp/linux.py

+ 5
- 0
README.md

@ -7,6 +7,11 @@ Wpx is a wallpaper downloader. That's it.
* [Bing.com](https://www.bing.com/)
* [WallpapersHome](https://wallpapershome.com)
##### Requirements
* Python 3.5+
* (Linux) `python3-gi` (when installing through `pipx` pass `--system-site-packages`)
##### Usage
Get Bing's image of the day:

+ 1
- 1
src/wpx/__main__.py

@ -23,7 +23,6 @@ from nr.databind.core import ObjectMapper
from nr.databind.json import JsonModule
from typing import Optional, BinaryIO
from wpx.providers import IImageProvider
from wpx.setwp import SetWallpaperOptions, set_wallpaper
import argparse
import logging
import os
@ -92,6 +91,7 @@ def main(argv=None, prog=None):
print(os.path.abspath(image.filename))
if args.set_desktop or args.set_login:
from .setwp import SetWallpaperOptions, set_wallpaper
options = SetWallpaperOptions(image.filename,
desktop=args.set_desktop, login=args.set_login)
try:

+ 3
- 1
src/wpx/setwp/linux.py

@ -21,7 +21,9 @@
# NOTE: Assumes that the system is running GNOME.
from . import SetWallpaperOptions
from gi.repository import Gio
import os
import logging
SCHEMA = 'org.gnome.desktop.background'
@ -30,7 +32,7 @@ PICTURE_URI = 'picture-uri'
def set_wallpaper(options: SetWallpaperOptions):
if options.desktop:
path = 'file://' + os.path.abspath(options.filename)
path = 'file://' + os.path.abspath(options.path)
settings = Gio.Settings.new(SCHEMA)
settings.set_string(PICTURE_URI, path)
if options.login:

Loading…
Cancel
Save