Compare commits
No commits in common. "master" and "release" have entirely different histories.
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,3 @@
|
|||||||
.vscode/
|
.vscode/
|
||||||
Pipfile
|
Pipfile
|
||||||
Pipfile.lock
|
Pipfile.lock
|
||||||
.notes/
|
|
||||||
|
|||||||
44
README.md
44
README.md
@ -1,30 +1,14 @@
|
|||||||
# wallpaperctl
|
# wallpaperctl
|
||||||
|
|
||||||
wallpaperctl is a basic configurable wallpaper changing script
|
wallpaperctl is a basic configurable wallpaper changing script
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mkdir -p $HOME/.config/wallpaperctl
|
mkdir -p $HOME/.config/wallpaperctl
|
||||||
cp wallpaperctl.ini $HOME/.config/wallpaperctl/
|
cp wallpaperctl.ini $HOME/.config/wallpaperctl/
|
||||||
|
|
||||||
sudo mv -v wallpaperctl.py /usr/bin/wallpaperctl
|
sudo mv -v wallpaperctl.py /usr/bin/wallpaperctl
|
||||||
```
|
```
|
||||||
|
|
||||||
## Config options
|
## Config options
|
||||||
|
|
||||||
### General
|
|
||||||
```ini
|
|
||||||
- WALLHAVEN_API_KEY=asdfg
|
|
||||||
- X_SERVER=:0
|
|
||||||
- WALLPAPER_ENGINE=feh
|
|
||||||
- ULTRA_WALL_DIR=~/Pictures/wallpaper-ultra
|
|
||||||
- HOR_WALL_DIR=~/Pictures/wallpaper-hor
|
|
||||||
- VERT_WALL_DIR=~/Pictures/wallpaper-vert
|
|
||||||
|
|
||||||
|
|
||||||
[Monitors]
|
|
||||||
1=ultrawide
|
|
||||||
2=vertical
|
|
||||||
3=horizontal
|
|
||||||
```
|
|
||||||
@ -3,43 +3,17 @@
|
|||||||
import configparser
|
import configparser
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import sys
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import subprocess
|
||||||
|
|
||||||
def find_all_images(path):
|
def find_all_images(path):
|
||||||
IMAGE_TYPES = ['jpg', 'png', 'webp', 'jpeg']
|
IMAGE_TYPES = ['jpg', 'png', 'webp', 'jpeg']
|
||||||
if WALLPAPER_ENGINE == 'plasma':
|
|
||||||
IMAGE_TYPES.remove("webp")
|
|
||||||
images = []
|
images = []
|
||||||
for image_type in IMAGE_TYPES:
|
for image_type in IMAGE_TYPES:
|
||||||
[images.append(image) for image in path.glob(f'**/*.{image_type}')]
|
[images.append(image) for image in path.glob(f'**/*.{image_type}')]
|
||||||
|
|
||||||
return images
|
return images
|
||||||
|
|
||||||
def handle_feh(wallpapers):
|
|
||||||
cmd = "/usr/bin/feh --no-fehbg --bg-fill "
|
|
||||||
for wallpaper in wallpapers:
|
|
||||||
cmd += str(f"{wallpaper} ")
|
|
||||||
subprocess.call(cmd, shell=True)
|
|
||||||
|
|
||||||
def handle_plasma(wallpapers):
|
|
||||||
fuckingGarbageJS = """
|
|
||||||
var allDesktops = desktops();
|
|
||||||
"""
|
|
||||||
for wallpaper in wallpapers:
|
|
||||||
wallpaperIndex = wallpapers.index(wallpaper)
|
|
||||||
fuckingGarbageJS += f"""allDesktops[{wallpaperIndex}].wallpaperPlugin = "org.kde.image";
|
|
||||||
allDesktops[{wallpaperIndex}].currentConfigGroup = Array("Wallpaper", "org.kde.image", "General");
|
|
||||||
allDesktops[{wallpaperIndex}].writeConfig("Image", "file://{wallpaper}");
|
|
||||||
"""
|
|
||||||
cmd = f"/usr/bin/qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript '{fuckingGarbageJS}'"
|
|
||||||
subprocess.call(cmd, shell=True)
|
|
||||||
|
|
||||||
def handle_gnome(wallpapers):
|
|
||||||
raise NotImplementedError
|
|
||||||
|
|
||||||
conf_file = f"{os.environ['HOME']}/.config/wallpaperctl/wallpaperctl.ini"
|
conf_file = f"{os.environ['HOME']}/.config/wallpaperctl/wallpaperctl.ini"
|
||||||
|
|
||||||
# Initialize config file
|
# Initialize config file
|
||||||
@ -80,17 +54,13 @@ for mon in monitors:
|
|||||||
case _:
|
case _:
|
||||||
print(monitors[mon])
|
print(monitors[mon])
|
||||||
|
|
||||||
|
print(wallpapers)
|
||||||
|
|
||||||
match WALLPAPER_ENGINE:
|
cmd = "/usr/bin/feh --no-fehbg --bg-fill "
|
||||||
case 'feh':
|
|
||||||
handle_feh(wallpapers)
|
|
||||||
|
|
||||||
case 'plasma':
|
for wallpaper in wallpapers:
|
||||||
handle_plasma(wallpapers)
|
cmd += str(f"{wallpaper} ")
|
||||||
|
|
||||||
case 'gnome':
|
subprocess.call(cmd, shell=True)
|
||||||
handle_gnome(wallpapers)
|
|
||||||
|
|
||||||
case _:
|
# subprocess.call("ls -alh",shell=True)
|
||||||
print(f"Wallpaper engine {WALLPAPER_ENGINE} is not supported")
|
|
||||||
sys.exit()
|
|
||||||
Loading…
x
Reference in New Issue
Block a user