Last active
July 8, 2023 18:36
-
-
Save renegarcia/3890018ebab038f1f2e8adc8e3903231 to your computer and use it in GitHub Desktop.
Setup wallpaper image in plasma shell (Cli)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import call | |
from argparse import ArgumentParser | |
JS = """ | |
/* | |
* This script is meant to be run from the python interface below. | |
*/ | |
const allDesktops = desktops(); | |
for (desktop of allDesktops){{ | |
desktop.wallpaperPlugin = "org.kde.image"; | |
desktop.currentConfigGroup = Array("Wallpaper", | |
"org.kde.image", | |
"General"); | |
desktop.writeConfig("Image", `file://{fname}`) | |
}} | |
""" | |
def main(): | |
parser = ArgumentParser("set-wallpaper") | |
parser.add_argument("file", help="File location",) | |
args = parser.parse_args() | |
call([ | |
"qdbus", | |
"org.kde.plasmashell", | |
"/PlasmaShell", | |
"org.kde.PlasmaShell.evaluateScript", | |
JS.format(fname=args.file), | |
]) | |
if __name__ == "__main__": | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This script is meant to be run from the python interface (set-wallpaper.py). | |
*/ | |
const allDesktops = desktops(); | |
for (desktop of allDesktops){ | |
desktop.wallpaperPlugin = "org.kde.image"; | |
desktop.currentConfigGroup = Array("Wallpaper", | |
"org.kde.image", | |
"General"); | |
desktop.writeConfig("Image", `file://{fname}`) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment