Compare commits
2 Commits
44b209a56d
...
b010ffb1ed
Author | SHA1 | Date |
---|---|---|
Daniel Carrillo | b010ffb1ed | |
Daniel Carrillo | 4ef1b6ab1a |
|
@ -6,10 +6,10 @@
|
||||||
#: individual font faces and even specify special fonts for particular
|
#: individual font faces and even specify special fonts for particular
|
||||||
#: characters.
|
#: characters.
|
||||||
|
|
||||||
font_family "Roboto Mono Regular"
|
font_family Roboto Mono Regular
|
||||||
bold_font auto
|
bold_font Roboto Mono Bold
|
||||||
italic_font auto
|
italic_font Roboto Mono Italic
|
||||||
bold_italic_font auto
|
bold_italic_font Roboto Mono Bold Italic
|
||||||
|
|
||||||
#: You can specify different fonts for the bold/italic/bold-italic
|
#: You can specify different fonts for the bold/italic/bold-italic
|
||||||
#: variants. To get a full list of supported fonts use the `kitty
|
#: variants. To get a full list of supported fonts use the `kitty
|
||||||
|
@ -1249,7 +1249,7 @@ map kitty_mod+f show_scrollback
|
||||||
|
|
||||||
#: Window management {{{
|
#: Window management {{{
|
||||||
|
|
||||||
map kitty_mod+enter new_window
|
map kitty_mod+enter launch --cwd=current
|
||||||
|
|
||||||
#: You can open a new window running an arbitrary program, for
|
#: You can open a new window running an arbitrary program, for
|
||||||
#: example::
|
#: example::
|
||||||
|
|
|
@ -1,23 +1,37 @@
|
||||||
from contextlib import closing
|
from contextlib import closing
|
||||||
|
|
||||||
from typing import Dict, List
|
from typing import Dict, List, Optional
|
||||||
|
|
||||||
from simple_term_menu import TerminalMenu
|
from prompt_toolkit.application.current import get_app
|
||||||
|
from prompt_toolkit import PromptSession
|
||||||
|
from prompt_toolkit.completion import WordCompleter
|
||||||
|
|
||||||
import secretstorage
|
import secretstorage
|
||||||
|
|
||||||
from kitty.boss import Boss
|
from kitty.boss import Boss
|
||||||
|
|
||||||
|
|
||||||
def main(args: List[str]) -> str:
|
def main(args: List[str]) -> Optional[str]:
|
||||||
options = get_secret_names(args[1], args[2])
|
secrets = get_secret_names(args[1], args[2])
|
||||||
terminal_menu = TerminalMenu(options)
|
entries = WordCompleter(secrets)
|
||||||
menu_entry_index = terminal_menu.show()
|
session = PromptSession(completer=entries)
|
||||||
|
try:
|
||||||
|
entry = session.prompt('> ', pre_run=expand_prompt)
|
||||||
|
except (KeyboardInterrupt, EOFError):
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
return secrets[entry]
|
||||||
|
|
||||||
if menu_entry_index is not None:
|
return None
|
||||||
return list(options.values())[menu_entry_index]
|
|
||||||
|
|
||||||
return ''
|
|
||||||
|
def expand_prompt() -> None:
|
||||||
|
app = get_app()
|
||||||
|
buffer = app.current_buffer
|
||||||
|
if buffer.complete_state:
|
||||||
|
buffer.complete_next()
|
||||||
|
else:
|
||||||
|
buffer.start_completion(select_first=False)
|
||||||
|
|
||||||
|
|
||||||
def get_secret_names(attribute: str, value: str) -> Dict[str, str]:
|
def get_secret_names(attribute: str, value: str) -> Dict[str, str]:
|
||||||
|
|
Loading…
Reference in New Issue