1 Commits

Author SHA1 Message Date
359ae0ecf9 temp! 2024-04-08 23:55:27 +01:00

View File

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