diff --git a/konawall/environment.py b/konawall/environment.py index fcd7ecb..2cb6ea7 100644 --- a/konawall/environment.py +++ b/konawall/environment.py @@ -16,7 +16,7 @@ def detect_linux_environment(): "cinnamon", # dconf "mate", # dconf "deepin", # dconf - "xfce4", # xfconf + "xfce", # xfconf "lxde", # pcmanfm "kde", # qdbus ] diff --git a/konawall/environments/xfce.py b/konawall/environments/xfce.py new file mode 100644 index 0000000..0ec22f5 --- /dev/null +++ b/konawall/environments/xfce.py @@ -0,0 +1,15 @@ +import subprocess +from konawall.module_loader import add_environment +from konawall.imager import combine_to_viewport + +@add_environment("xfce_setter") +def set_wallpapers(files: list, displays: list): + file = combine_to_viewport(displays, files) + command_for_last_image = ["xfconf-query", "--channel", "xfce4-desktop", "--list"] + workspaces_command = subprocess.run(command_for_last_image, capture_output=True) + workspaces_command_lines = workspaces_command.stdout.decode("utf-8").strip().split("\n") + workspaces_command_wallpapers = [conf for conf in workspaces_command_lines if "last-image" in conf] + set_command_base = ["xfconf-query", "-c", "xfce4-desktop", "-s", file.name, "-p"] + for workspace_config in workspaces_command_wallpapers: + set_command = set_command_base + [workspace_config] + subprocess.run(set_command)