Add keybindings configuration in JSON and YAML formats; remove obsolete YAML file

This commit is contained in:
2025-08-20 00:48:27 +02:00
parent 8451ac7913
commit 0141063baa
4 changed files with 63 additions and 33 deletions
+10 -4
View File
@@ -2,12 +2,18 @@
# The key_pressed method is called when a key is pressed, and it contains the logic for handling different key presses.
import random
import yaml
import os
import json
# read yaml config file
bindings = {}
with open("conf/keybindings.yaml", "r") as f:
bindings = yaml.safe_load(f)
if os.path.exists("conf/keybindings.json"):
with open("conf/keybindings.json", "r") as f:
bindings = json.load(f)
else:
import yaml
# read yaml config file
with open("conf/keybindings.yaml", "r") as f:
bindings = yaml.safe_load(f)
class KeyBindings:
def trigger(self, action):