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]}'"]
[ )
f"binding='{keybinding['binding']}'", keys.append(key)
f"command='{keybinding['command']}'",
f"name='{keybinding['name']}'",
]
),
}
)
custom_keybindings = { subprocess.check_call(
"key": "[org/gnome/settings-daemon/plugins/media-keys]", [
"value": f"['{"', '".join([entry["key"] for entry in keybinding_entries])}']", "dconf",
} "write",
"/org/gnome/settings-daemon/plugins/media-keys",
f"['{"', '".join(keys)}']",
]
)
for conf in keybinding_entries + [custom_keybindings]: # result['original_message'] = str(keybinding_entries)
subprocess.check_call(['dconf', 'write', conf.key, conf.value]) # 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 # use whatever logic you need to determine whether or not this module
# made any modifications to your target # made any modifications to your target