mirror of
https://github.com/1j01/textual-paint.git
synced 2025-01-05 13:43:04 +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()
|
desktop_env = get_desktop_environment()
|
||||||
if desktop_env in ["gnome", "unity", "cinnamon"]:
|
if desktop_env in ["gnome", "unity", "cinnamon"]:
|
||||||
uri = "'file://%s'" % file_loc
|
uri = "'file://%s'" % file_loc
|
||||||
|
SCHEMA = "org.gnome.desktop.background"
|
||||||
|
KEY = "picture-uri"
|
||||||
try:
|
try:
|
||||||
from gi.repository import Gio # type: ignore
|
from gi.repository import Gio # type: ignore
|
||||||
SCHEMA = "org.gnome.desktop.background"
|
|
||||||
KEY = "picture-uri"
|
|
||||||
gsettings = Gio.Settings.new(SCHEMA) # type: ignore
|
gsettings = Gio.Settings.new(SCHEMA) # type: ignore
|
||||||
gsettings.set_string(KEY, uri)
|
gsettings.set_string(KEY, uri)
|
||||||
except Exception:
|
except Exception:
|
||||||
args = ["gsettings", "set", "org.gnome.desktop.background", "picture-uri", uri]
|
args = ["gsettings", "set", SCHEMA, KEY, uri]
|
||||||
subprocess.Popen(args)
|
subprocess.Popen(args)
|
||||||
elif desktop_env=="mate":
|
elif desktop_env=="mate":
|
||||||
try: # MATE >= 1.6
|
try: # MATE >= 1.6
|
||||||
|
Loading…
Reference in New Issue
Block a user