summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien <contact@julienpro.com>2023-07-12 10:19:23 +0200
committerJulien <contact@julienpro.com>2023-07-12 10:19:23 +0200
commit86145dea370ff85a7b78e8f633235101f3365ec8 (patch)
tree7c9b5f529a67835a59320d1b68d9af802eb20e75
parentfc7669112c68e4dcb3ea97df4a4344d3b6865546 (diff)
Rename callback to callback_parser in db.py
-rw-r--r--db.py20
-rwxr-xr-xlidecli.py9
-rw-r--r--parsing_callbacks.py (renamed from callbacks.py)0
3 files changed, 15 insertions, 14 deletions
diff --git a/db.py b/db.py
index e162539..b42362d 100644
--- a/db.py
+++ b/db.py
@@ -75,7 +75,7 @@ def commands():
"versions_working": [("x11", "all")],
"versions_not_working": [],
"command": "xprop -id #1#",
- "callback": {
+ "callback_parser": {
"function": "xprop_parser",
"output_key": "win_maximized"
},
@@ -90,7 +90,7 @@ def commands():
"versions_working": [("x11", "all")],
"versions_not_working": [],
"command": "xprop -id #1#",
- "callback": {
+ "callback_parser": {
"function": "xprop_parser",
"output_key": "win_maximized_horizontal"
},
@@ -105,7 +105,7 @@ def commands():
"versions_working": [("x11", "all")],
"versions_not_working": [],
"command": "xprop -id #1#",
- "callback": {
+ "callback_parser": {
"function": "xprop_parser",
"output_key": "win_maximized_vertical"
},
@@ -120,7 +120,7 @@ def commands():
"versions_working": [("x11", "all")],
"versions_not_working": [],
"command": "xprop -id #1#",
- "callback": {
+ "callback_parser": {
"function": "xprop_parser",
"output_key": "win_minimized"
},
@@ -135,7 +135,7 @@ def commands():
"versions_working": [("x11", "all")],
"versions_not_working": [],
"command": "xprop -id #1#",
- "callback": {
+ "callback_parser": {
"function": "xprop_parser",
"output_key": "win_modal"
},
@@ -150,7 +150,7 @@ def commands():
"versions_working": [("x11", "all")],
"versions_not_working": [],
"command": "xprop -id #1#",
- "callback": {
+ "callback_parser": {
"function": "xprop_parser",
"output_key": "win_sticky"
},
@@ -165,7 +165,7 @@ def commands():
"versions_working": [("x11", "all")],
"versions_not_working": [],
"command": "xprop -id #1#",
- "callback": {
+ "callback_parser": {
"function": "xprop_parser",
"output_key": "win_shaded"
},
@@ -180,7 +180,7 @@ def commands():
"versions_working": [("x11", "all")],
"versions_not_working": [],
"command": "xprop -id #1#",
- "callback": {
+ "callback_parser": {
"function": "xprop_parser",
"output_key": "win_fullscreen"
},
@@ -195,7 +195,7 @@ def commands():
"versions_working": [("x11", "all")],
"versions_not_working": [],
"command": "xprop -id #1#",
- "callback": {
+ "callback_parser": {
"function": "xprop_parser",
"output_key": "win_above"
},
@@ -210,7 +210,7 @@ def commands():
"versions_working": [("x11", "all")],
"versions_not_working": [],
"command": "xprop -id #1#",
- "callback": {
+ "callback_parser": {
"function": "xprop_parser",
"output_key": "win_below"
},
diff --git a/lidecli.py b/lidecli.py
index 83c2ada..aa717ec 100755
--- a/lidecli.py
+++ b/lidecli.py
@@ -6,7 +6,7 @@ import sys
import json
import os
import configparser
-import callbacks
+import parsing_callbacks
import db
version = "1.0.2"
@@ -112,10 +112,11 @@ def exec_command(args):
print("Command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output))
return
ret = ret.decode('utf-8')
- if "callback" in command:
- function = getattr(callbacks, command["callback"]["function"])
+ if "callback_parser" in command:
+ function = getattr(parsing_callbacks, command["callback_parser"]["function"])
ret = function(ret)
- print(ret["win_maximized"], end='')
+ ret = ret[command['callback_parser']['output_key']]
+ # print(ret["win_maximized"], end='')
else:
print(ret, end='')
if (args.store):
diff --git a/callbacks.py b/parsing_callbacks.py
index 70ea1da..70ea1da 100644
--- a/callbacks.py
+++ b/parsing_callbacks.py