mirror of
https://github.com/1j01/textual-paint.git
synced 2024-12-22 22:31:43 +03:00
DRY gsettings schema/key
This commit is contained in:
parent
fece1c48c6
commit
5fd214182c
@ -91,14 +91,14 @@ def set_wallpaper(file_loc: str, first_run: bool = True):
|
||||
desktop_env = get_desktop_environment()
|
||||
if desktop_env in ["gnome", "unity", "cinnamon"]:
|
||||
uri = "'file://%s'" % file_loc
|
||||
try:
|
||||
from gi.repository import Gio # type: ignore
|
||||
SCHEMA = "org.gnome.desktop.background"
|
||||
KEY = "picture-uri"
|
||||
try:
|
||||
from gi.repository import Gio # type: ignore
|
||||
gsettings = Gio.Settings.new(SCHEMA) # type: ignore
|
||||
gsettings.set_string(KEY, uri)
|
||||
except Exception:
|
||||
args = ["gsettings", "set", "org.gnome.desktop.background", "picture-uri", uri]
|
||||
args = ["gsettings", "set", SCHEMA, KEY, uri]
|
||||
subprocess.Popen(args)
|
||||
elif desktop_env=="mate":
|
||||
try: # MATE >= 1.6
|
||||
|
Loading…
Reference in New Issue
Block a user