Compare commits

..

No commits in common. "1b4bb676f75cfc595b78e513a9e7c0ce3ff265ba" and "fe657bdb02c297e24ec10e25cf6f43c36f72131b" have entirely different histories.

4 changed files with 56 additions and 72 deletions

View file

@ -80,7 +80,7 @@ In general, you need to always define 3 variables and you can optionally add two
+ Optional: notify: bool + Optional: notify: bool
This defaults to "false". Enable to set send a desktop notification when the wallpaper is changed. The program will still work correctly, even if this option is not defined at all. This defaults to "false". Enable to set send a desktop notification when the wallpaper is changed. The program will still work correctly, even if this option is not defined at all.
+ Optional: fallback_wallpaper: bool + Optional: fallback_wallpaper: bool
Wallpaper to be set if an error is found in the config or the wallpaper intended to be set cannot be found. Defaults to None. If none is set and the config has been written incorrectly, a ConfigError is raised and the program is exited. If an error in the config occurs but the fallback wallpaper has been defined, it will be set and wallman will exit with Code 1. Wallpaper to be set if an error is found in the config. Defaults to None. If none is set and the config is written incorrectly, a ConfigError is raised and the program is exited. If an error in the config occurs but the fallback wallpaper has been defined, it will be set and wallman will exit with Code 1.
*** changing_times *** changing_times
The changing_times dictionary is used to specify the times of the day when your wallpaper is switched. The names of the keys do not matter here, the values must always be strings in the "XX:YY:ZZ" 24 hour time system. use 00:00:00 for midnight. Note that XX should be in the range of 00-23 and YY and ZZ should be in the range of 00-59. The changing_times dictionary is used to specify the times of the day when your wallpaper is switched. The names of the keys do not matter here, the values must always be strings in the "XX:YY:ZZ" 24 hour time system. use 00:00:00 for midnight. Note that XX should be in the range of 00-23 and YY and ZZ should be in the range of 00-59.
@ -102,6 +102,7 @@ The keys in the dictionary once again do not matter, the names of the keys in ea
+ Drop the feh dependecy and set wallpapers using pywlroots or python-xlib + Drop the feh dependecy and set wallpapers using pywlroots or python-xlib
** Features ** Features
+ Add support for setting a fallback wallpaper if a wallpaper the user set is not found
+ Add support for wallpapers that dynamically change with the time of day (Morning, noon, evening, night or light levels) rather than to times set in the config + Add support for wallpapers that dynamically change with the time of day (Morning, noon, evening, night or light levels) rather than to times set in the config
+ Add support for wallpapers that change by the weather + Add support for wallpapers that change by the weather
+ Add support for live wallpapers + Add support for live wallpapers

View file

@ -1,38 +1,38 @@
# Table of Contents # Table of Contents
1. [Overwiev](#org38008e5) 1. [Overwiev](#org054ef0d)
1. [What is this?](#orgbf0d867) 1. [What is this?](#orgbf4dad3)
2. [What can it do?](#orga6b51ae) 2. [What can it do?](#orgdf86200)
2. [Installation](#orgf8cb7f4) 2. [Installation](#orge115851)
1. [Depedencies](#orgdcf9c12) 1. [Depedencies](#org1c920d8)
1. [Always Required](#org6db51f1) 1. [Always Required](#org5a03048)
2. [Optional](#orgd486e75) 2. [Optional](#org2bb7a20)
3. [Build dependencies](#orgb137ff2) 3. [Build dependencies](#orgbdbc04d)
2. [Installing with package Manager](#org7130917) 2. [Installing with package Manager](#org3f3b4a9)
1. [Gentoo](#org12416b9) 1. [Gentoo](#orgcfe6102)
2. [Arch Linux](#org839518f) 2. [Arch Linux](#org4adff79)
3. [Others](#orgc43c06f) 3. [Others](#orgdcb0d42)
3. [Installing with pip](#org09d87ac) 3. [Installing with pip](#org41ac4c9)
4. [Installing manually](#org978c6b3) 4. [Installing manually](#org88055b7)
3. [Configuration](#org67eaff5) 3. [Configuration](#orgc0a8c31)
1. [TOML Dictionaries](#orgf398b60) 1. [TOML Dictionaries](#orgc09a1b5)
1. [general](#org8cc8089) 1. [general](#org8297129)
2. [changing<sub>times</sub>](#orgb5c4a76) 2. [changing<sub>times</sub>](#org5f9734c)
3. [The other dictionaries](#org9066447) 3. [The other dictionaries](#org4d41b53)
4. [TODOs](#org2f22e63) 4. [TODOs](#org9f0b1f0)
1. [Structuring](#orgee9e8f9) 1. [Structuring](#org036190c)
2. [Technical Details](#org9af492c) 2. [Technical Details](#org35cda78)
3. [Features](#org58d4a35) 3. [Features](#org8250c51)
<a id="org38008e5"></a> <a id="org054ef0d"></a>
# Overwiev # Overwiev
<a id="orgbf0d867"></a> <a id="orgbf4dad3"></a>
## What is this? ## What is this?
@ -41,7 +41,7 @@ This version is an early Alpha. As of now, it supports the most important featur
As such, please make absolutely sure you follow the instructions on how to write the config file very closely. I will implement better config handling with more meaningful error output in the future. For now, follow everything really closely and read the logs if needed. If you do that, it *should* work. As such, please make absolutely sure you follow the instructions on how to write the config file very closely. I will implement better config handling with more meaningful error output in the future. For now, follow everything really closely and read the logs if needed. If you do that, it *should* work.
<a id="orga6b51ae"></a> <a id="orgdf86200"></a>
## What can it do? ## What can it do?
@ -52,17 +52,17 @@ Wallman currently has three main features:
- Settings Wallpapers at a specific time of the day - Settings Wallpapers at a specific time of the day
<a id="orgf8cb7f4"></a> <a id="orge115851"></a>
# Installation # Installation
<a id="orgdcf9c12"></a> <a id="org1c920d8"></a>
## Depedencies ## Depedencies
<a id="org6db51f1"></a> <a id="org5a03048"></a>
### Always Required ### Always Required
@ -71,14 +71,14 @@ Wallman currently has three main features:
- feh (Used for setting the wallpapers, hard dependency) - feh (Used for setting the wallpapers, hard dependency)
<a id="orgd486e75"></a> <a id="org2bb7a20"></a>
### Optional ### Optional
- libnotify (for desktop notification support) - libnotify (for desktop notification support)
<a id="orgb137ff2"></a> <a id="orgbdbc04d"></a>
### Build dependencies ### Build dependencies
@ -86,12 +86,12 @@ Wallman currently has three main features:
- build - build
<a id="org7130917"></a> <a id="org3f3b4a9"></a>
## Installing with package Manager ## Installing with package Manager
<a id="org12416b9"></a> <a id="orgcfe6102"></a>
### Gentoo ### Gentoo
@ -105,21 +105,21 @@ This program, as of now, can be installed very easily on gentoo. Just follow the
A proper portage overlay will be created soon so that updates can be handled automatically. A proper portage overlay will be created soon so that updates can be handled automatically.
<a id="org839518f"></a> <a id="org4adff79"></a>
### Arch Linux ### Arch Linux
Support for Arch Linux will be added soon. Support for Arch Linux will be added soon.
<a id="orgc43c06f"></a> <a id="orgdcb0d42"></a>
### Others ### Others
I will potentially write a version for nixpkgs and will also bundle wallman as a flatpak. I will potentially write a version for nixpkgs and will also bundle wallman as a flatpak.
<a id="org09d87ac"></a> <a id="org41ac4c9"></a>
## Installing with pip ## Installing with pip
@ -128,7 +128,7 @@ Wallman is available on PyPI. Simply run:
pip install wallman pip install wallman
<a id="org978c6b3"></a> <a id="org88055b7"></a>
## Installing manually ## Installing manually
@ -147,21 +147,21 @@ Wallman is available on PyPI. Simply run:
- Profit - Profit
<a id="org67eaff5"></a> <a id="orgc0a8c31"></a>
# Configuration # Configuration
This is a short guide on how to correctly configure wallman. Look in the sample config for additional context. This is a short guide on how to correctly configure wallman. Look in the sample config for additional context.
<a id="orgf398b60"></a> <a id="orgc09a1b5"></a>
## TOML Dictionaries ## TOML Dictionaries
First of all, the config file is structured via different TOML dictionaries. There are two TOML dictionaries: general and changing<sub>times</sub> that must be present in every config. Aside from that, further dictionaries are needed depending on how wallman is configured. You need to create a dictionary with the name of each wallpaper set defined in the used<sub>sets</sub> list (more on that later). You should probably just configure wallman by editing the sample config as it is by far the easiest way to do it. First of all, the config file is structured via different TOML dictionaries. There are two TOML dictionaries: general and changing<sub>times</sub> that must be present in every config. Aside from that, further dictionaries are needed depending on how wallman is configured. You need to create a dictionary with the name of each wallpaper set defined in the used<sub>sets</sub> list (more on that later). You should probably just configure wallman by editing the sample config as it is by far the easiest way to do it.
<a id="org8cc8089"></a> <a id="org8297129"></a>
### general ### general
@ -176,17 +176,17 @@ In general, you need to always define 3 variables and you can optionally add two
- Optional: notify: bool - Optional: notify: bool
This defaults to &ldquo;false&rdquo;. Enable to set send a desktop notification when the wallpaper is changed. The program will still work correctly, even if this option is not defined at all. This defaults to &ldquo;false&rdquo;. Enable to set send a desktop notification when the wallpaper is changed. The program will still work correctly, even if this option is not defined at all.
- Optional: fallback<sub>wallpaper</sub>: bool - Optional: fallback<sub>wallpaper</sub>: bool
Wallpaper to be set if an error is found in the config or the wallpaper intended to be set cannot be found. Defaults to None. If none is set and the config has been written incorrectly, a ConfigError is raised and the program is exited. If an error in the config occurs but the fallback wallpaper has been defined, it will be set and wallman will exit with Code 1. Wallpaper to be set if an error is found in the config. Defaults to None. If none is set and the config is written incorrectly, a ConfigError is raised and the program is exited. If an error in the config occurs but the fallback wallpaper has been defined, it will be set and wallman will exit with Code 1.
<a id="orgb5c4a76"></a> <a id="org5f9734c"></a>
### changing<sub>times</sub> ### changing<sub>times</sub>
The changing<sub>times</sub> dictionary is used to specify the times of the day when your wallpaper is switched. The names of the keys do not matter here, the values must always be strings in the &ldquo;XX:YY:ZZ&rdquo; 24 hour time system. use 00:00:00 for midnight. Note that XX should be in the range of 00-23 and YY and ZZ should be in the range of 00-59. The changing<sub>times</sub> dictionary is used to specify the times of the day when your wallpaper is switched. The names of the keys do not matter here, the values must always be strings in the &ldquo;XX:YY:ZZ&rdquo; 24 hour time system. use 00:00:00 for midnight. Note that XX should be in the range of 00-23 and YY and ZZ should be in the range of 00-59.
<a id="org9066447"></a> <a id="org4d41b53"></a>
### The other dictionaries ### The other dictionaries
@ -194,12 +194,12 @@ The other dictionaries must always have the names of the wallpaper sets from use
The keys in the dictionary once again do not matter, the names of the keys in each dictionary must be strings and be absolute paths. They should not include spaces unless prefaced by a backslash. The keys in the dictionary once again do not matter, the names of the keys in each dictionary must be strings and be absolute paths. They should not include spaces unless prefaced by a backslash.
<a id="org2f22e63"></a> <a id="org9f0b1f0"></a>
# TODOs # TODOs
<a id="orgee9e8f9"></a> <a id="org036190c"></a>
## Structuring ## Structuring
@ -207,7 +207,7 @@ The keys in the dictionary once again do not matter, the names of the keys in ea
- Add documentation for developers - Add documentation for developers
<a id="org9af492c"></a> <a id="org35cda78"></a>
## Technical Details ## Technical Details
@ -217,10 +217,11 @@ The keys in the dictionary once again do not matter, the names of the keys in ea
- Drop the feh dependecy and set wallpapers using pywlroots or python-xlib - Drop the feh dependecy and set wallpapers using pywlroots or python-xlib
<a id="org58d4a35"></a> <a id="org8250c51"></a>
## Features ## Features
- Add support for setting a fallback wallpaper if a wallpaper the user set is not found
- Add support for wallpapers that dynamically change with the time of day (Morning, noon, evening, night or light levels) rather than to times set in the config - Add support for wallpapers that dynamically change with the time of day (Morning, noon, evening, night or light levels) rather than to times set in the config
- Add support for wallpapers that change by the weather - Add support for wallpapers that change by the weather
- Add support for live wallpapers - Add support for live wallpapers

View file

@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "wallman" name = "wallman"
version = "1.3.2" version = "1.3.1b1"
authors = [ authors = [
{name = "Emma Nora Theuer", email = "wallman@entheuer.de"}, {name = "Emma Nora Theuer", email = "wallman@entheuer.de"},
] ]

View file

@ -10,7 +10,7 @@ from apscheduler.triggers.cron import CronTrigger
# setup logging # setup logging
chdir(str(getenv("HOME")) + "/.local/share/wallman/") chdir(str(getenv("HOME")) + "/.local/share/wallman/")
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
logging.basicConfig(filename="wallman.log", encoding="utf-8", level=logging.WARNING) logging.basicConfig(filename="wallman.log", encoding="utf-8", level=logging.DEBUG)
# read config # read config
# a = list(data["changing_times"].values()) # a = list(data["changing_times"].values())
@ -160,26 +160,11 @@ class WallpaperLogic(_ConfigLib):
else: else:
return start <= x or x < end return start <= x or x < end
def _check_system_exitcode(self, code) -> None:
if code != 0:
try:
self.set_fallback_wallpaper()
logger.error(f"The wallpaper {self.wallpaper_list[time_range]} has not been found, the fallback wallpaper has been set. Future wallpapers will still attempted to be set.")
print(f"ERROR: The wallpaper {self.wallpaper_list[time_range]} has not been found, the fallback wallpaper has been set. Future wallpapers will still attempted to be set.")
return False
except ConfigError:
logger.error(f"The wallpaper {self.wallpaper_list[time_range]} has not been found and no fallback wallpaper has been set. Future wallpapers will still attempted to be set.")
print(f"ERROR: The wallpaper {self.wallpaper_list[time_range]} has not been found and no fallback wallpaper has been set. Future wallpapers will still attempted to be set.")
return False
else:
return True
def _notify_user(self): def _notify_user(self):
system("notify-send 'Wallman' 'A new Wallpaper has been set.'") system("notify-send 'Wallman' 'A new Wallpaper has been set.'")
logger.debug("Sent desktop notification.") logger.debug("Sent desktop notification.")
def set_wallpaper_by_time(self) -> bool: def set_wallpaper_by_time(self) -> None:
# Ensure use of a consistent wallpaper set # Ensure use of a consistent wallpaper set
if self.chosen_wallpaper_set is False: if self.chosen_wallpaper_set is False:
self._choose_wallpaper_set() self._choose_wallpaper_set()
@ -188,19 +173,16 @@ class WallpaperLogic(_ConfigLib):
clean_time_two = self._clean_times(time_range + 1) clean_time_two = self._clean_times(time_range + 1)
# Check if the current time is between a given and the following changing time and if so, set that wallpaper. If not, keep trying. # Check if the current time is between a given and the following changing time and if so, set that wallpaper. If not, keep trying.
if self._time_in_range(time(int(clean_time[0]), int(clean_time[1]), int(clean_time[2])), time(int(clean_time_two[0]), int(clean_time_two[1]), int(clean_time_two[2])), datetime.now().time()): if self._time_in_range(time(int(clean_time[0]), int(clean_time[1]), int(clean_time[2])), time(int(clean_time_two[0]), int(clean_time_two[1]), int(clean_time_two[2])), datetime.now().time()):
exitcode = system(f"feh --bg-scale --no-fehbg --quiet {self.wallpaper_list[time_range]}") system(f"feh --bg-scale --no-fehbg {self.wallpaper_list[time_range]}")
has_wallpaper_been_set = self._check_system_exitcode(exitcode)
if self.config_notify: if self.config_notify:
self._notify_user() self._notify_user()
return has_wallpaper_been_set return
else: else:
continue continue
exitcode = system(f"feh --bg-scale --no-fehbg {self.wallpaper_list[-1]}") system(f"feh --bg-scale --no-fehbg {self.wallpaper_list[-1]}")
has_wallpaper_been_set = self._check_system_exitcode(exitcode)
if self.config_notify: if self.config_notify:
self._notify_user() self._notify_user()
return has_wallpaper_been_set
def schedule_wallpapers(self): def schedule_wallpapers(self):
scheduler = BlockingScheduler() scheduler = BlockingScheduler()