mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-07 15:59:26 -05:00
nicer cheatsheet (#607)
This commit is contained in:
@@ -7,6 +7,7 @@ from typing import Dict, List
|
||||
TITLE_REGEX = "#+!"
|
||||
HIDE_COMMENT = "[hidden]"
|
||||
MOD_SEPARATORS = ['+', ' ']
|
||||
COMMENT_BIND_PATTERN = "#/#"
|
||||
|
||||
parser = argparse.ArgumentParser(description='Hyprland keybind reader')
|
||||
parser.add_argument('--path', type=str, default="$HOME/.config/hypr/hyprland.conf", help='path to keybind file (sourcing isn\'t supported)')
|
||||
@@ -56,7 +57,7 @@ def autogenerate_comment(dispatcher: str, params: str = "") -> str:
|
||||
}.get(params, "null"))
|
||||
|
||||
case "pin":
|
||||
return "Pin window"
|
||||
return "Window: pin (show on all workspaces)"
|
||||
|
||||
case "splitratio":
|
||||
return "Window split ratio {}".format(params)
|
||||
@@ -124,7 +125,7 @@ def autogenerate_comment(dispatcher: str, params: str = "") -> str:
|
||||
return "Window: move to workspace {}".format(params)
|
||||
|
||||
case "togglespecialworkspace":
|
||||
return "Toggle special workspace"
|
||||
return "Workspace: toggle special"
|
||||
|
||||
case "exec":
|
||||
return "Execute: {}".format(params)
|
||||
@@ -132,7 +133,7 @@ def autogenerate_comment(dispatcher: str, params: str = "") -> str:
|
||||
case _:
|
||||
return ""
|
||||
|
||||
def get_keybind_at_line(line_number):
|
||||
def get_keybind_at_line(line_number, line_start = 0):
|
||||
global content_lines
|
||||
line = content_lines[line_number]
|
||||
_, keys = line.split("=", 1)
|
||||
@@ -186,6 +187,11 @@ def get_binds_recursive(current_content, scope):
|
||||
reading_line += 1
|
||||
current_content["children"].append(get_binds_recursive(Section([], [], section_name), heading_scope))
|
||||
|
||||
elif line.startswith(COMMENT_BIND_PATTERN):
|
||||
keybind = get_keybind_at_line(reading_line, line_start=len(COMMENT_BIND_PATTERN))
|
||||
if(keybind != None):
|
||||
current_content["keybinds"].append(keybind)
|
||||
|
||||
elif line == "" or line.startswith("$") or line.startswith("#"): # Comment, ignore
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user