This commit is contained in:
Arthur 2022-07-03 17:07:01 +05:00
parent bb669ed7fa
commit 4e8c78915f
3 changed files with 43 additions and 7 deletions

View File

@ -26,16 +26,22 @@ Arch:
pacman -S feh pacman -S feh
``` ```
**foo-Wallpaper-feh-gif** is just bash script, you can download it [here](https://github.com/thomas10-10/foo-Wallpaper-Feh-Gif/blob/master/back4.sh) **foo-Wallpaper-feh-gif** is just bash script, you can download it [here](https://github.com/thomas10-10/foo-Wallpaper-Feh-Gif/blob/master/back4.sh)
``` ```
curl -L https://raw.githubusercontent.com/thomas10-10/foo-Wallpaper-Feh-Gif/master/install.sh | bash curl -L https://raw.githubusercontent.com/thomas10-10/foo-Wallpaper-Feh-Gif/master/install.sh | bash
``` ```
Install apscheduler Install apscheduler
``` ```
pip install apscheduler pip install apscheduler
``` ```
Then download WallPyPer and make main.py an run file. Then download WallPyPer and make main.py an run file.
``` ```
git clone https://github.com/KarimullinArthur/WallPyPer.git git clone https://github.com/KarimullinArthur/WallPyPer.git
@ -55,9 +61,32 @@ ln -s <abs_path_to_download_repo>/main.py wallpyper
The absolute path you cat get via command *pwd* The absolute path you cat get via command *pwd*
## Configuration
Create conifg in *~/.config/wallpyper/config*
and put this:
```
{
"path_to_wallpapers":"your_path",
"second":"*",
"minute":"*/1",
"hour":"*"
}
```
Where *path_to_wallpapers* is *absolute* path to wallpapers.
*second*, *minute* and *hour* set auto change via cron.
(More infarmation about cron)[https://en.wikipedia.org/wiki/Cron]
(crontab.guru)[https://crontab.guru]
## Auto Start ## Auto Start
For **i3wm** add in your ~/.conifg/i3/config one string: For **i3wm** add in your ~/.conifg/i3/config one string:
``` ```
exec wallpyper exec wallpyper
``` ```
Author - Karimullin Arthur
Mail - KarimullinArthur@riseup.net

14
func.py
View File

@ -21,16 +21,18 @@ def kill():
def configParsing(): def configParsing():
pathToConfig = os.path.expanduser('~')+'/.config/wallpyper/config' pathToConfig = os.path.expanduser('~')+'/.config/wallpyper/config'
try:
with open(pathToConfig) as file: with open(pathToConfig) as file:
contentFile = file.read() contentFile = file.read()
config = json.loads(contentFile) config = json.loads(contentFile)
return config return config
except FileNotFoundError:
createConfig()
def setWallPaper(): def setWallPaper():
config = configParsing() config = configParsing()
PATH = config['path_to_wallpapers'] PATH = configParsing['path_to_wallpapers']
files = os.listdir(PATH) files = os.listdir(PATH)
media = random.choices(files)[0] media = random.choices(files)[0]

View File

@ -15,5 +15,10 @@ if __name__ == '__main__':
start() start()
sched = BlockingScheduler() sched = BlockingScheduler()
sched.add_job(start,'interval',minutes=configParsing()['value'])
sched.add_job(start,'cron',\
second=configParsing()['second'],\
minute=configParsing()['minute'],\
hour=configParsing()['hour'])
sched.start() sched.start()