1 Commits

Author SHA1 Message Date
9020fc0459 temp! 2024-04-09 00:37:00 +01:00

View File

@@ -108,31 +108,26 @@ def run_module():
# manipulate or modify the state as needed (this is going to be the
# part where your module will do what it needs to do)
keybinding_entries = []
keys = []
for index, keybinding in enumerate(module.params["keybindings"]):
keybinding_entries.append(
{
"key": f"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom{index}",
"value": "\n".join(
[
f"binding='{keybinding['binding']}'",
f"command='{keybinding['command']}'",
f"name='{keybinding['name']}'",
]
),
}
)
key = f"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom{index}"
for value in ["binding", "command", "name"]:
subprocess.check_call(
["dconf", "write", f"/{key}{value}", f"'{keybinding[value]}'"]
)
keys.append(key)
custom_keybindings = {
"key": "[org/gnome/settings-daemon/plugins/media-keys]",
"value": f"['{"', '".join([entry["key"] for entry in keybinding_entries])}']",
}
subprocess.check_call(
[
"dconf",
"write",
"/org/gnome/settings-daemon/plugins/media-keys",
f"['{"', '".join(keys)}']",
]
)
for conf in keybinding_entries + [custom_keybindings]:
subprocess.check_call(['dconf', 'write', conf.key, conf.value])
result['original_message'] = str(keybinding_entries)
result["message"] = str(custom_keybindings)
# result['original_message'] = str(keybinding_entries)
# result["message"] = str(custom_keybindings)
# use whatever logic you need to determine whether or not this module
# made any modifications to your target