File: main.py

package info (click to toggle)
kitty 0.44.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 29,540 kB
  • sloc: ansic: 84,052; python: 57,643; objc: 5,365; sh: 1,319; xml: 364; makefile: 144; javascript: 78
file content (47 lines) | stat: -rw-r--r-- 1,291 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>


from kitty.typing_compat import BossType

from ..tui.handler import result_handler

help_text = 'Input a Unicode character'
usage = ''
OPTIONS = '''
--emoji-variation
type=choices
default=none
choices=none,graphic,text
Whether to use the textual or the graphical form for emoji. By default the
default form specified in the Unicode standard for the symbol is used.


--tab
type=choices
default=previous
choices=previous,code,name,emoticons,favorites
The initial tab to display. Defaults to using the tab from the previous kitten invocation.


'''.format


@result_handler(has_ready_notification=True)
def handle_result(args: list[str], current_char: str, target_window_id: int, boss: BossType) -> None:
    w = boss.window_id_map.get(target_window_id)
    if w is not None:
        w.paste_text(current_char)

def main(args: list[str]) -> str | None:
    raise SystemExit('This should be run as kitten unicode_input')

if __name__ == '__main__':
    main([])
elif __name__ == '__doc__':
    import sys
    cd = sys.cli_docs  # type: ignore
    cd['usage'] = usage
    cd['options'] = OPTIONS
    cd['help_text'] = help_text
    cd['short_desc'] = 'Browse and select unicode characters by name'