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 # 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)
keybinding_entries = [] keys = []
for index, keybinding in enumerate(module.params["keybindings"]): for index, keybinding in enumerate(module.params["keybindings"]):
keybinding_entries.append( key = f"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom{index}"
{ for value in ["binding", "command", "name"]:
"key": f"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom{index}", subprocess.check_call(
"value": "\n".join( ["dconf", "write", f"/{key}{value}", f"'{keybinding[value]}'"]
)
keys.append(key)
subprocess.check_call(
[ [
f"binding='{keybinding['binding']}'", "dconf",
f"command='{keybinding['command']}'", "write",
f"name='{keybinding['name']}'", "/org/gnome/settings-daemon/plugins/media-keys",
f"['{"', '".join(keys)}']",
] ]
),
}
) )
custom_keybindings = { # result['original_message'] = str(keybinding_entries)
"key": "[org/gnome/settings-daemon/plugins/media-keys]", # result["message"] = str(custom_keybindings)
"value": f"['{"', '".join([entry["key"] for entry in keybinding_entries])}']",
}
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)
# 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