Giter VIP home page Giter VIP logo

waypaper's People

Contributors

anufrievroman avatar badloop avatar bitsheriff avatar calfmoon avatar ch3st3r08 avatar nikolaizombie1 avatar rdeisenroth avatar thaodan avatar zander-1024 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

waypaper's Issues

Custom backend command

It'd be nice if we can provide a custom command/script for the backend.

For example if you wanted to have a custom random transition with swww, you can specify a script to the config:

# Picks a random corner to start the transition from
swww img \
  -t $(shuf -n 1 <<<$'grow\nouter') \
  --transition-pos $(shuf -n 1 <<<$'top-left\ntop-right\nbottom-right\nbottom-left') \
  $1 # the passed image

Add desktop entries

I usually use rofi to open apps. A desktop entries could be useful for a gui app

List the current wallpapers in JSON through a command line option

I would like to add a command line option to list the currently set wallpapers and monitors in the form of a JSON printed to standard output.
The usage of this option would look something like this:

waypaper --list

The output of the command would look something like this:

[
    {
        "monitor": "All",
        "wallpaper": "~/Downloads/Wallpaper1.jpeg"
    },
    {
        "monitor": "DP-2",
        "wallpaper": "/home/user/Downloads/Wallpaper2.png"
    },
    {
        "monitor": "HDMI-A-1",
        "wallpaper": "/home/user/Downloads/Wallpaper3.png"
    }
]

This would address some of the concerns raised in issue #35 in a way that allows the output to be parsed at the command line or by another program and could be a stepping stone towards implementing #35.

post_command $wallpaper doesn't work properly if spaces are in filename

When a wallpaper has a space in it's filename $wallpaper doesn't treat it as a whole string and treats it as separate arguments.
wallpaper = /path/to/wall paper.png
post_command = wallust run $wallpaper
In this scenario the command it runs will be wallust run /path/to/wall paper.png (all wallust gets is /path/to/wall), which will make the command not work correctly as it doesn't know the full path to the wallpaper. I would imagine a fix to this would just be to wrap it in quotes so it's treated as a string and not separate arguments, ie: wallust run "/path/to/wall paper.png" which will work properly as wallust will know it's a string.

MPVPaper support?

MPV Paper (https://github.com/GhostNaN/mpvpaper) is a wallpaper client that utilizes MPV to play a video on the user's wallpaper. Apparently it is easy to control and forward files/inputs to it. Videos are a lot heavier on people's system, but it may be preferable or more convenient than a simple animated image format for some.

Slow for large folders

Thanks for a great project—it's exactly what I've been looking for! 🙌

Waypaper seems to take a considerable amount of time—around 20 seconds—to open if I use my ~/wallpaper/highres folder (it contains ~300 images that are 3440x1440 or bigger). I'm guessing it's attempting to read all the images to display the thumbnails.

It would be great if the thumbnails could either be cached or the images could be lazy-loaded.

No such file or directory killall?

Error changing wallpaper: [Errno 2] No such file or directory: 'killall'

this shows every time i try to change the wallpaper with SWW backend(haven't treid others) currently on nixos and i got the package from the nixos unstable channel.

Ignore non-rendering images

Still need to find a way to overcome potential problem from this 1dff8bd commit, that some files with right extension might not be actually renderable images, in which case the rendering of the whole folder stops. The proposed solution had some flaws, but in principle there should be some feedback from cache_image() back to the App() to exclude failed images from the grid, or just put a placeholder instead.

swww deprecation warning

when using swww init a warning of deprecation is shown.

DEPRECATION WARNING: `swww init` IS DEPRECATED. Call `swww-daemon` directly instead

suggest call to subprocess to swww-daemon

ps: wanted to create a PR for this simple change, but was struggling to setup the project to run in my local environment with NixOS. 😭 If someone could crate a flake.nix for this project that would be great!

Issue building pycairo on Fedora 38 with pipx

I am unable to install using pipx due to pycairo not being able to build. Took a look at the opensuse issue that seemed similar but this seems like it might be slightly different. Never used pipx so this could be an issue on my end too.

(base) [iamroot@fedora i3]$ sudo pipx install waypaper
Fatal error from pip prevented installation. Full pip output in file:
    /root/.local/state/pipx/log/cmd_2024-06-04_09.57.02_pip_errors.log

pip seemed to fail to build package:
    pycairo

Some possibly relevant errors from pip install:
    error: subprocess-exited-with-error
    cairo/bufferproxy.c:32:10: fatal error: Python.h: No such file or directory
    error: command '/usr/bin/gcc' failed with exit code 1

Error installing waypaper.
(base) [iamroot@fedora i3]$ uname -a
Linux fedora 6.7.10-100.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Mar 18 18:51:12 UTC 2024 x86_64 GNU/Linux

Support '~' in config

[Enhancement]

Can you please add support for ~ expansion in config read?

image

You can check if path string contains ~ , if so os.path.expanduser(path)

While writing back to the config you can override the ~ with actual home path.

Just trying to make if username independent when installing dots on fresh install..

Config directory and picture directory are hardcoded

Waypaper hardcodes ~/.config as directory for configuration instead of first looking into ${XDG_CONFIG_HOME} and then falling back to ~/.config.

The situation is similar for the pictures directory which
would require to parse ${XDG_CONFIG_HOME}/user-dirs.dirs
to get XDG_PICTURES_DIR.

The platformdirs module should be useful for both cases.

You can append a pathlib object with a string by doing:
path / string e.g. path / foo.exist().

Add NASA Astronomy Picture Of the Day (APOD) feature?

One of the features I sorely miss from Nitrogen is the ability to pull wallpapers from APIs like NASA APOD. I'm currently implementing it with swww through this short python script, which can download, display, and delete wallpapers at custom intervals. I thought this project might be interested in incorporating this feature, since it's also written in Python. I'm happy to submit a PR. Let me know how you want it done.

#!/usr/bin/env python3

import os
import shutil
import subprocess
import threading
import time
from datetime import date, timedelta
from pathlib import Path
from random import choice, randrange
from tempfile import NamedTemporaryFile

import requests

URL = "https://api.nasa.gov/planetary/apod"
API_KEY = "i8VA6xi1tsQCodKcHP0MAr5ReizUNcHktwVspBdU"
QUERY_WITHIN = timedelta(days=6 * 30)
SAVE_DIR = Path(os.getenv("XDG_DATA_HOME")) / "wallpapers"
KEEP_NUMBER = 30


class RepeatedTimer(object):
    def __init__(self, interval, function, *args, **kwargs):
        self._timer = None
        self.function = function
        self.interval = interval
        self.args = args
        self.kwargs = kwargs
        self.is_running = False
        self.start()

    def _run(self):
        self.is_running = False
        self.start()
        self.function(*self.args, **self.kwargs)

    def start(self):
        if not self.is_running:
            self._timer = threading.Timer(self.interval, self._run)
            self._timer.start()
            self.is_running = True

    def stop(self):
        self._timer.cancel()
        self.is_running = False


def random_available_wallpaper():
    return choice(list(SAVE_DIR.iterdir()))


def organize_directory():
    downloaded_number = len(list(SAVE_DIR.iterdir()))
    if downloaded_number > KEEP_NUMBER:
        for _ in range(downloaded_number - KEEP_NUMBER):
            os.remove(random_available_wallpaper())


def display_random_wallpaper():
    wallpaper = random_available_wallpaper()
    subprocess.run(["swww", "img", str(wallpaper)])


def random_date():
    end = date.today()
    start = end - QUERY_WITHIN
    return start + timedelta(days=randrange(QUERY_WITHIN.days))


def request_wallpaper():
    response = requests.get(
        url=URL, params={"api_key": API_KEY, "date": random_date().isoformat()}
    )
    response.raise_for_status()
    info = response.json()
    if "hdurl" in info:
        url = info["hdurl"]
        suffix = Path(info["hdurl"]).suffix
    else:
        url = info["url"]
        suffix = Path(info["url"]).suffix

    return {"url": url, "file_name": f"APOD_{info['date']}{suffix}"}


def already_downloaded(info):
    return info["file_name"] in [file.name for file in SAVE_DIR.iterdir()]


def download(info: dict, number_of_trials: int = 3):
    with NamedTemporaryFile(mode="wb") as temp_file:
        for _ in range(number_of_trials):
            try:
                response = requests.get(url=info["url"])
                response.raise_for_status()
                temp_file.write(response.content)

                SAVE_DIR.mkdir(parents=True, exist_ok=True)
                shutil.copyfile(temp_file.name, SAVE_DIR / info["file_name"])
                break
            except (
                requests.ConnectionError,
                requests.HTTPError,
                requests.Timeout,
            ):
                time.sleep(10.0)


def download_wallpaper():
    while True:
        info = request_wallpaper()
        if not already_downloaded(info):
            download(info)
            break


# Start daemon
subprocess.run(["swww", "kill"])
subprocess.run(["swww", "init"])
time.sleep(1.0)

# Schedule wallpaper download
RepeatedTimer(3600.0, download_wallpaper)

# Schedule wallpaper rotation
RepeatedTimer(3600.0, display_random_wallpaper)

# Schedule organizer
RepeatedTimer(7200.0, organize_directory)

Generator of tiled wallpapers

Include a generator of images that have the feel of classic tiled wallpapers. The following are suggestions on how the generator can generate these tiled wallpapers.

  • Relief effect, based on a two-color (silhouette) image (such as one generated by thresholding an existing image). This generates a three-color image.
  • Dither to a limited color palette, such as a classic 16-color palette.
  • 8x8 two-color tiled pattern.
  • Convert to grayscale then shift the grayscale palette to a color gradient.
  • Hue shifting.
  • Tileable noise.
  • Tileable procedural textures.
  • Tileable arrangements of symbols or small images with partial transparency.
  • Other procedural tileable patterns.
  • Combinations of any of the foregoing.

None of the suggestions above should involve artificial intelligence.

Waypaper Issues & Features

First things first, I absolutely love the minimalistic approach of waypaper over waypaper-engine. However, I have found a few concerning issues to address while using [SWWW] as the wallpaper setter with waypaper. I have not bothered to reproduce these issues with another available setter, therefore, other setters may vary.

ISSUES & FEATURES

- [SWWW] Waypaper should only spawn swww-daemon, instead of an empty setter process (swww) by default.
- [SWWW] Waypaper should terminate all the previous wallpaper setter processes before spawning a new setter process upon selecting another wallpaper. Excluding diferent per-specified-output.
- Hidden wallpapers/directories (.wallpaper) are not excluded from the selectable wallpaper viewer.
- Subfolders (selected) should recursively index all folders in path.
- Resizing the GUI does not adjust the grid alignment of the viewable wallpapers (increment/decrement the column alignment).
- Ship waypaper as a binary, instead of requiring users to build each update/installation with 20 python packages.
- Stop overwriting $HOME/.config/waypaper/config.ini upon launching waypaper. Defeats the purpose of even hardcoding a config, since nothing is saved.
- [Feature] Minimize to tray (with icon) toggle (and --tray).
- [Feature] Selectable transitions/steps/angle/duration buttons in gui.
- [Feature] Either animate the GIFs in the GUI, or list two categories as GIFs and PICTURES by reading the file extension type.

💗 Hope to see new releases address and resolve these issues and features.

Support the webp images

eww backend supports .webp as bg images, but waypaper seems to show only .png files in directory. Would be great to see these in directory view too.

Updating wallpaper tries to use swaybg?

I do not have swaybg installed on my system, only swww, which is also the only & selected option in the Waypaper UI.
When trying to run waypaper --restore, it tries to use swaybg, I manually need to specify swww for it to work.
More problematic, the UI itself also tries to use swaybg (even though, as mentioned, swww is selected in the UI) failing. This causes me to manually need to run the refresh command (with backend specified) for wallpapers to update.

Restarting waybar in post-command causes waypaper interface to freeze

OS: Arch
my post-command in config.ini is currently "wal -i $wallpaper && pywalfox update && killall waybar && waybar". The last two commands are intended to simply restart waybar as it's colour scheme doesn't automatically update to match that created by pywal. Running waypaper with this config does execute the commands succesfully, but after this the interface for waypaper completely freezes and it cannot be closed, neither by clicking exit or by using my keybind for closing the focused program. I have tried putting the commands related to waybar into a simple script and adding said script to the post-command, eg. "wal -i $wallpaper && pywalfox update && sh /path/to/script/launch.sh", however this causes the exact same behaviour from waypaper.

Waypaper can no longer set wallpaper

Since updating to 2.1.r7 the wallpaper fails to change. Running waypaper --restore --random produces swaybg: no process found. I do have swaybg installed. Downgrading to 2.1.r6 fixes the issue. Currently running Arch linux if that makes any difference.

Sort order

Having a large wallpaper directory (see #1) it would be nice to be able to change how the wallpapers are sorted. I.e.:

  1. By date created or modified
  2. By name

Nitrogen supported this feature, and it was really handy!

Store current wallpaper in state directory rather than config file.

Right now, Waypaper keeps track of the current wallpaper in its config file in $XDG_CONFIG_HOME/waypaper/config.ini.

This is problematic for lots of NixOS users who want to manage their application configurations using home-manager, because this means the config file has to be writable.

By the XDG Base Directory Specification, this kind of state should be stored in the state directory, i.e. $XDG_STATE_HOME/waypaper:

The $XDG_STATE_HOME contains state data that should persist between (application) restarts, but that is not important or portable enough to the user that it should be stored in $XDG_DATA_HOME. It may contain:

  • actions history (logs, history, recently used files, …)
  • current state of the application that can be reused on a restart (view, layout, open files, undo history, …)

I propose that the current wallpaper is simply stored as a symlink at $XDG_STATE_HOME/waypaper/wallpaper to the path of the currently-activated wallpaper. I'd also be willing to implement this change or a similar one.

GUI freezing on low CPU machines

It appears that GUI freezes if we quickly toggle hidden or subfolders several times (i.e. on process that force rechecking the folder and rendering the GUI). I noticed that on a machine with just two cores. I did many tests but could not find any reason, nor could I see a clear sequence that would cause that every time. All tests show that all the functions are executed successfully. It's just that at some point, the waypaper process takes 100% of CPU on one core (which it usually never needs to do), freezes the interface, and remains in this state indefinitely. However, even while GUI is frozen, the program still seems to work properly in the background. Likely, it's some GTK interface issue, so we'd need advice of someone experienced in these matters...

Add contribution instructions to README and improve code documentation

I would like to create instructions on how to contribute to waypaper so that it is easier for future contributors to get started implementing their additions to this project. Along this same vein I would also like to document the code base primarily through doc strings to ease the process of familiarization of the code base. Would this be advisable?

Memory leaks on swaybg

On swaybg, the app seems to run a new instance with every new wallpaper. Need to killall swaybg first.

No longer able to set wallpaper

Just updated to the latest commit (3f2fe2c838de864cbe4cce7db71429b9a1da143c). Trying to change or set the wallpaper results in

Error changing wallpaper: name 'color' is not defined

using swaybg as the backend, and swaybg works if I call it directly.

No module named 'PIL'

Hey there! Just installed waypaper from AUR on a relatively fresh Arch install and faced this error:

Traceback (most recent call last):
  File "/usr/bin/waypaper", line 5, in <module>
    from waypaper.__main__ import run
  File "/usr/lib/python3.11/site-packages/waypaper/__main__.py", line 8, in <module>
    from waypaper.app import App
  File "/usr/lib/python3.11/site-packages/waypaper/app.py", line 10, in <module>
    from PIL import Image
ModuleNotFoundError: No module named 'PIL'

I assume I need to install this module, but through what? Also it'd probably be good to have the respective instructions for this in the Readme.

Add Spanish translation

I would like to add a Spanish translation to waypaper. I am a native speaker and I would like to increase the accessibility of the application.

Add the ability to hide wallpapers

Hello,
The problem is simple : I would like the gui to hide all wallpapers whose name starts with a dot likewise all files managers and be able to toggle the visibility with a menu or ctrl+h.
It could also be useful to have an option like "hide wallpaper" on right-click to add it to a hide-list without needing to make the filename start with a dot.
... I have no dubious wallpaper at all, what do you mean ?
Thanks in advance for any answer.

cannot execute sequential commands as post_command

Was trying to configure my post_command in config.ini such that pywal grabs the selected wallpaper, and then pywalfox is updated. The command I used is this:

post_command = wal -i $wallpaper && pywalfox update

Doing this however causes both of these commands to fail. I should note that having the post_command just be "wal -i $wallpaper" works as expected, and that running the same combo command manually (swapping out the $wallpaper variable for path/to/img, i.e "wal -i path/to/img && pywalfox update") also works exactly as expected

Random wallpaper?

Pretty self explainatory and was already implemented in wallutils.
Maybe you can implement it on waypaper itself?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.