Compare commits
No commits in common. "ec545d5e11d873215f8de1f5486b468b868300c5" and "5a18b172cc7695bf7d907c511236018fb5e156cb" have entirely different histories.
ec545d5e11
...
5a18b172cc
14
bang.py
14
bang.py
|
@ -53,13 +53,10 @@ def list_bangs(config):
|
|||
print(f"- {handle}: {name}")
|
||||
|
||||
|
||||
def run_rofi(config, input_text="", title="bang", no_lines=False):
|
||||
def run_rofi(config, input_text="", title="bang"):
|
||||
rofi_path = config.get("rofi_path", "rofi")
|
||||
args = ["-dmenu", "-p", title]
|
||||
if no_lines:
|
||||
args += ["-l", "0"]
|
||||
completed_process = subprocess.run(
|
||||
[rofi_path] + args,
|
||||
[rofi_path, "-dmenu", "-p", title],
|
||||
text=True,
|
||||
capture_output=True,
|
||||
input=input_text,
|
||||
|
@ -114,10 +111,7 @@ def main():
|
|||
queries.append(" ".join(bang_args[1:]))
|
||||
# Else show a Rofi with the list of available bangs.
|
||||
else:
|
||||
process_input = "\n".join(
|
||||
i["handle"]
|
||||
for i in sorted(config["bangs"], key=lambda bang: bang["handle"])
|
||||
) + "\n"
|
||||
process_input = "\n".join(i["handle"] for i in config["bangs"]) + "\n"
|
||||
output = run_rofi(config, input_text=process_input)
|
||||
parts = output.split(maxsplit=1)
|
||||
if len(parts) < 1:
|
||||
|
@ -128,7 +122,7 @@ def main():
|
|||
|
||||
# If no queries were obtained during options parsing, show Rofi now to get a single query.
|
||||
if not queries:
|
||||
queries.append(run_rofi(config, title=handle, no_lines=True))
|
||||
queries.append(run_rofi(config, title=handle))
|
||||
|
||||
for query in queries:
|
||||
open_bang(config, handle, query)
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
#!/usr/bin/env sh
|
||||
# From https://github.com/alacritty/alacritty-theme, license Apache 2.0.
|
||||
printf "|039| \033[39mDefault \033[m |049| \033[49mDefault \033[m |037| \033[37mLight gray \033[m |047| \033[47mLight gray \033[m\n"
|
||||
printf "|030| \033[30mBlack \033[m |040| \033[40mBlack \033[m |090| \033[90mDark gray \033[m |100| \033[100mDark gray \033[m\n"
|
||||
printf "|031| \033[31mRed \033[m |041| \033[41mRed \033[m |091| \033[91mLight red \033[m |101| \033[101mLight red \033[m\n"
|
||||
printf "|032| \033[32mGreen \033[m |042| \033[42mGreen \033[m |092| \033[92mLight green \033[m |102| \033[102mLight green \033[m\n"
|
||||
printf "|033| \033[33mYellow \033[m |043| \033[43mYellow \033[m |093| \033[93mLight yellow \033[m |103| \033[103mLight yellow \033[m\n"
|
||||
printf "|034| \033[34mBlue \033[m |044| \033[44mBlue \033[m |094| \033[94mLight blue \033[m |104| \033[104mLight blue \033[m\n"
|
||||
printf "|035| \033[35mMagenta \033[m |045| \033[45mMagenta \033[m |095| \033[95mLight magenta \033[m |105| \033[105mLight magenta \033[m\n"
|
||||
printf "|036| \033[36mCyan \033[m |046| \033[46mCyan \033[m |096| \033[96mLight cyan \033[m |106| \033[106mLight cyan \033[m\n"
|
Loading…
Reference in a new issue