Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show transformed keys in output #107

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions xkeysnail/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ def on_key(key, action, wm_class=None, quiet=False):
def transform_key(key, action, wm_class=None, quiet=False):
global _mode_maps
global _toplevel_keymaps
transformed = False

combo = Combo(get_pressed_modifiers(), key)

Expand All @@ -456,19 +457,22 @@ def transform_key(key, action, wm_class=None, quiet=False):
if not quiet:
print("WM_CLASS '{}' | active keymaps = [{}]".format(wm_class, ", ".join(keymap_names)))

if not quiet:
print(combo)

# _mode_maps: [global_map, local_1, local_2, ...]
for mappings in _mode_maps:
if combo not in mappings:
continue
# Found key in "mappings". Execute commands defined for the key.
reset_mode = handle_commands(mappings[combo], key, action)
if not quiet:
print("{} => {}".format(combo,mappings[combo]))
transformed = True
if reset_mode:
_mode_maps = None
return

if not quiet and not transformed:
print(combo)

# Not found in all keymaps
if is_top_level:
# If it's top-level, pass through keys
Expand Down