Compare commits
1 Commits
gnome-shel
...
359ae0ecf9
| Author | SHA1 | Date | |
|---|---|---|---|
| 359ae0ecf9 |
@@ -108,26 +108,31 @@ 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)
|
||||
|
||||
keys = []
|
||||
keybinding_entries = []
|
||||
for index, keybinding in enumerate(module.params["keybindings"]):
|
||||
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)
|
||||
|
||||
subprocess.check_call(
|
||||
keybinding_entries.append(
|
||||
{
|
||||
"key": f"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom{index}",
|
||||
"value": "\n".join(
|
||||
[
|
||||
"dconf",
|
||||
"write",
|
||||
"/org/gnome/settings-daemon/plugins/media-keys",
|
||||
f"['{"', '".join(keys)}']",
|
||||
f"binding='{keybinding['binding']}'",
|
||||
f"command='{keybinding['command']}'",
|
||||
f"name='{keybinding['name']}'",
|
||||
]
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
# result['original_message'] = str(keybinding_entries)
|
||||
# result["message"] = str(custom_keybindings)
|
||||
custom_keybindings = {
|
||||
"key": "[org/gnome/settings-daemon/plugins/media-keys]",
|
||||
"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
|
||||
# made any modifications to your target
|
||||
|
||||
Reference in New Issue
Block a user