Added plasma wallpaperengine
This commit is contained in:
parent
fc271e6496
commit
e4d8bccdab
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
.vscode/
|
.vscode/
|
||||||
Pipfile
|
Pipfile
|
||||||
Pipfile.lock
|
Pipfile.lock
|
||||||
|
.notes/
|
||||||
|
|||||||
@ -3,11 +3,15 @@
|
|||||||
import configparser
|
import configparser
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
from pathlib import Path
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
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}')]
|
||||||
@ -54,13 +58,32 @@ for mon in monitors:
|
|||||||
case _:
|
case _:
|
||||||
print(monitors[mon])
|
print(monitors[mon])
|
||||||
|
|
||||||
print(wallpapers)
|
|
||||||
|
|
||||||
cmd = "/usr/bin/feh --no-fehbg --bg-fill "
|
match WALLPAPER_ENGINE:
|
||||||
|
case 'feh':
|
||||||
|
cmd = "/usr/bin/feh --no-fehbg --bg-fill "
|
||||||
|
for wallpaper in wallpapers:
|
||||||
|
cmd += str(f"{wallpaper} ")
|
||||||
|
subprocess.call(cmd, shell=True)
|
||||||
|
case 'plasma':
|
||||||
|
# Write code to handle changing wallpapers on plasmashell
|
||||||
|
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"qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript '{fuckingGarbageJS}'"
|
||||||
|
subprocess.call(cmd, shell=True)
|
||||||
|
|
||||||
for wallpaper in wallpapers:
|
case 'gnome':
|
||||||
cmd += str(f"{wallpaper} ")
|
# Write code to handle changing wallpapers on gnomeshell
|
||||||
|
cmd = "ls"
|
||||||
|
pass
|
||||||
|
|
||||||
subprocess.call(cmd, shell=True)
|
case _:
|
||||||
|
print(f"Wallpaper engine {WALLPAPER_ENGINE} is not supported")
|
||||||
# subprocess.call("ls -alh",shell=True)
|
sys.exit()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user