added stderr for error messages, config parser, sample configuration file. STILL A WIP. THE PROGRAM WILL JUST SPIT OUT THE EVENTS AND NOT ACTUALLY USE YOUR DEFINED EVENTS.
parent
5813eeb6ee
commit
f7da66a1a7
@ -0,0 +1,14 @@
|
||||
SAMPLE JSON CONFIG
|
||||
First XDG_CONFIG_HOME/swhkd/config.json is checked
|
||||
and then ~/.config/swhkd/config.kson
|
||||
Delete the first 4 lines before using this file.
|
||||
[
|
||||
{
|
||||
"combo": ["KEY_ENTER", "KEY_LEFTMETA"],
|
||||
"action": "foot -e ranger"
|
||||
},
|
||||
{
|
||||
"combo": ["KEY_ENTER", "KEY_LEFTCTRL"],
|
||||
"action": "pcmanfm"
|
||||
}
|
||||
]
|
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/python3
|
||||
import json
|
||||
from . log import LOG_UTILS
|
||||
|
||||
class CONFIG_PARSER:
|
||||
def __init__(self):
|
||||
self.LOG_UTILS = LOG_UTILS()
|
||||
|
||||
async def parse(self,config_file):
|
||||
output=[]
|
||||
with open(config_file, 'r') as file:
|
||||
contents = json.loads(file.read())
|
||||
for arr in contents:
|
||||
pair=[]
|
||||
for key, value in arr.items():
|
||||
pair.append(value)
|
||||
output.append(pair)
|
||||
return output
|
Loading…
Reference in new issue