Commit c39d3cb1 authored by GabMus's avatar GabMus

fixed mate support with flatpak-spwan temp workaround

parent b5e0dfdf
......@@ -10,6 +10,7 @@
"--socket=wayland",
"--talk-name=org.gnome.SettingsDaemon",
"--talk-name=org.mate.SettingsDaemon",
"--talk-name=org.freedesktop.Flatpak",
"--filesystem=home:ro",
"--filesystem=xdg-run/dconf",
"--filesystem=~/.config/dconf:ro",
......
from gi.repository import Gio
from PIL import Image
from PIL.ImageOps import fit
from os import Popen
from .confManager import ConfManager
TMP_DIR='/tmp/HydraPaper/'
......@@ -35,8 +37,24 @@ def set_wallpaper_gnome(path, wp_mode='spanned'):
gsettings.set_string(mode_key, wp_mode)
def set_wallpaper_mate(path, wp_mode='spanned'):
gsettings = Gio.Settings.new('org.mate.background')
wp_key = 'picture-filename'
mode_key = 'picture-options'
gsettings.set_string(wp_key, path)
gsettings.set_string(mode_key, wp_mode)
# TODO make this work with plain Gio.Settings
# As of now I can't seem to be able to set mate gsettings
# If running under flatpak, for now getting out of the sandbox with
# flatpak-spawn --host is the only way to properly support MATE
confman = ConfManager()
if confman.is_flatpak:
cmds = [
f'gsettings set org.mate.background picture-filename {path}',
f'gsettings set org.mate.background picture-options {wp_mode}'
]
for cmd in cmds:
Popen(
f'flatpak-spawn --host {cmd}',
shell=True
)
else:
gsettings = Gio.Settings.new('org.mate.background')
wp_key = 'picture-filename'
mode_key = 'picture-options'
gsettings.set_string(wp_key, path)
gsettings.set_string(mode_key, wp_mode)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment