Compare commits
2 commits
5a18b172cc
...
ec545d5e11
Author | SHA1 | Date | |
---|---|---|---|
ec545d5e11 | |||
e1cb770709 |
14
bang.py
14
bang.py
|
@ -53,10 +53,13 @@ def list_bangs(config):
|
|||
print(f"- {handle}: {name}")
|
||||
|
||||
|
||||
def run_rofi(config, input_text="", title="bang"):
|
||||
def run_rofi(config, input_text="", title="bang", no_lines=False):
|
||||
rofi_path = config.get("rofi_path", "rofi")
|
||||
args = ["-dmenu", "-p", title]
|
||||
if no_lines:
|
||||
args += ["-l", "0"]
|
||||
completed_process = subprocess.run(
|
||||
[rofi_path, "-dmenu", "-p", title],
|
||||
[rofi_path] + args,
|
||||
text=True,
|
||||
capture_output=True,
|
||||
input=input_text,
|
||||
|
@ -111,7 +114,10 @@ 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 config["bangs"]) + "\n"
|
||||
process_input = "\n".join(
|
||||
i["handle"]
|
||||
for i in sorted(config["bangs"], key=lambda bang: bang["handle"])
|
||||
) + "\n"
|
||||
output = run_rofi(config, input_text=process_input)
|
||||
parts = output.split(maxsplit=1)
|
||||
if len(parts) < 1:
|
||||
|
@ -122,7 +128,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))
|
||||
queries.append(run_rofi(config, title=handle, no_lines=True))
|
||||
|
||||
for query in queries:
|
||||
open_bang(config, handle, query)
|
||||
|
|
10
print-colors.sh
Executable file
10
print-colors.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/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