def render(args: argparse.Namespace) -> int: kbutil_dll = get_kbutil_dll_path() output_path = "case" for piece in ["left", "center", "right"]: input_path = "layout/triad_{}.xml".format(piece) ret = generate_svg(kbutil_dll, input_path, output_path) if ret != 0: print("Failed to generate SVG") return ret bearings_path = "./temp/bearings_{}.json".format(piece) bearings_debug_path = "./temp/bearings_{}.svg".format(piece) mkdir(os.path.dirname(bearings_path)) ret = generate_bearings( kbutil_dll, input_path, bearings_path, bearings_debug_path ) if ret != 0: print("Failed to switch bearings") return ret if args.open: sh( [ "inkscape", os.path.join(output_path, "triad_left.svg"), os.path.join(output_path, "triad_right.svg"), os.path.join(output_path, "triad_center.svg"), ] ) return 0
def generate_bearings(kbutil_dll_path, input_path, output_path, debug_path): return sh( [ "dotnet", kbutil_dll_path, "gen-key-bearings", input_path, output_path, "--debug-svg={}".format(debug_path), ] )
def ponoko(args: argparse.Namespace) -> int: kbutil_dll = get_kbutil_dll_path() output_path = os.path.join(get_triad_repo_dir(), "case", "ponoko") mkdir(output_path) for piece in ["left", "center", "right"]: print(piece) input_path = "layout/triad_{}.xml".format(piece) ret = generate_svg(kbutil_dll, input_path, output_path) if ret != 0: print("Failed to generate SVG") return ret if args.open: sh([ "inkscape", os.path.join(output_path, "triad_left.svg"), os.path.join(output_path, "triad_right.svg"), os.path.join(output_path, "triad_center.svg"), ]) return 0
def generate_svg(kbutil_dll_path, input_path, output_path): return sh( [ "dotnet", kbutil_dll_path, "gen-svg", "--visual-switch-cutouts", "--keycap-overlays", "--keycap-legends", # "--squash", input_path, output_path, ] )
def generate_svg(kbutil_dll_path, input_path, output_path): return sh(["dotnet", kbutil_dll_path, "gen-svg", input_path, output_path])
def make_scratchpad(modifiers, *entries): keys = [] name = util.random_string() dropdowns = [] for key, command in entries: dd_name = "{}-{}".format(name, key) new_key = Key(modifiers, key, lazy.group[name].dropdown_toggle(dd_name)) keys.append(new_key) new_dropdown = DropDown(dd_name, command, x=0, y=0, width=0.999, height=0.5) dropdowns.append(new_dropdown) return ScratchPad(name, dropdowns), keys workspaces, workspace_keys = make_workspaces([consts.MODKEY], "asdfgzxcvb") scratchpad, scratchpad_keys = make_scratchpad( [consts.MODKEY], ("e", "emacs"), ("8", util.sh("cd ~/src/emacs-nougat; bin/build-elisp.sh ldlework")), ("9", util.sh("switch")), ("0", util.sh("hm-switch")), ("semicolon", "urxvt -e ranger")) groups = workspaces + [scratchpad] keys = workspace_keys + scratchpad_keys