Commit b5c9e707 authored by Gabriele Musco's avatar Gabriele Musco
Browse files

added support for swaylock

parent b76c1d05
Pipeline #114916 passed with stage
in 21 seconds
...@@ -22,7 +22,7 @@ def _apply_wallpapers_worker(monitors, lockscreen=False): ...@@ -22,7 +22,7 @@ def _apply_wallpapers_worker(monitors, lockscreen=False):
if desktop_environment == 'mate': if desktop_environment == 'mate':
set_wallpaper = set_wallpaper_mate set_wallpaper = set_wallpaper_mate
elif desktop_environment == 'sway': elif desktop_environment == 'sway':
set_wallpaper_sway(monitors) set_wallpaper_sway(monitors, lockscreen)
# add other DE cases as `elif` here # add other DE cases as `elif` here
if len(monitors) == 1: if len(monitors) == 1:
set_wallpaper(monitors[0].wallpaper, 'zoom', lockscreen) set_wallpaper(monitors[0].wallpaper, 'zoom', lockscreen)
......
...@@ -7,6 +7,7 @@ import re ...@@ -7,6 +7,7 @@ import re
TMP_DIR = '/tmp/HydraPaper/' TMP_DIR = '/tmp/HydraPaper/'
SWAY_CONF_PATH = f'{Env.get("HOME")}/.config/sway/config' SWAY_CONF_PATH = f'{Env.get("HOME")}/.config/sway/config'
SWAYLOCK_CONF_PATH = f'{Env.get("HOME")}/.swaylock/config'
def multi_setup_pillow(monitors, save_path, wp_setter_func=None): def multi_setup_pillow(monitors, save_path, wp_setter_func=None):
...@@ -59,17 +60,21 @@ def set_wallpaper_mate(path, wp_mode='spanned', lockscreen=False): ...@@ -59,17 +60,21 @@ def set_wallpaper_mate(path, wp_mode='spanned', lockscreen=False):
def set_wallpaper_sway(monitors, lockscreen=False): def set_wallpaper_sway(monitors, lockscreen=False):
if lockscreen: conf_path = SWAYLOCK_CONF_PATH if lockscreen else SWAY_CONF_PATH
print('Lock screen wallpaper on sway unsupported') with open(conf_path) as fd:
return
with open(SWAY_CONF_PATH) as fd:
conf = fd.read() conf = fd.read()
fd.close() fd.close()
n_conf = re.sub(r'output .* bg .*', '', conf).strip() if lockscreen:
n_conf += '\n' + '\n'.join([ n_conf = re.sub(r'image=.*', '', conf).strip()
f'output {m.name} bg {m.wallpaper} fill' for m in monitors n_conf += '\n' + '\n'.join([
]) f'image={m.name}:{m.wallpaper.replace(":", "::")}' for m in monitors
with open(SWAY_CONF_PATH, 'w') as fd: ])
else:
n_conf = re.sub(r'output .* bg .*', '', conf).strip()
n_conf += '\n' + '\n'.join([
f'output {m.name} bg {m.wallpaper} fill' for m in monitors
])
with open(conf_path, 'w') as fd:
fd.write(n_conf) fd.write(n_conf)
fd.close() fd.close()
run('sway reload'.split(' ')) run('sway reload'.split(' '))
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