fix monitors yaml parsing
This commit is contained in:
parent
536feac30a
commit
2cc74193e7
@ -2,7 +2,6 @@ import logging
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
import fabric2
|
import fabric2
|
||||||
import yaml
|
|
||||||
from fabric2 import Connection
|
from fabric2 import Connection
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@ -213,10 +212,7 @@ def change_monitors_config(connection: Connection, monitors_config: dict):
|
|||||||
if is_unix_system(connection):
|
if is_unix_system(connection):
|
||||||
command_parts = ["gnome-monitor-config", "set"]
|
command_parts = ["gnome-monitor-config", "set"]
|
||||||
|
|
||||||
# Convert str to dict (yaml)
|
for monitor, settings in monitors_config.items():
|
||||||
monitors_config = yaml.safe_load(monitors_config)
|
|
||||||
|
|
||||||
for monitor, settings in monitors_config.get('monitors', {}).items():
|
|
||||||
if settings.get('enabled', False):
|
if settings.get('enabled', False):
|
||||||
if 'primary' in settings and settings['primary']:
|
if 'primary' in settings and settings['primary']:
|
||||||
command_parts.append(f'-LpM {monitor}')
|
command_parts.append(f'-LpM {monitor}')
|
||||||
|
Loading…
Reference in New Issue
Block a user