Start work on the notify kitten

This commit is contained in:
Kovid Goyal 2024-07-28 20:41:01 +05:30
parent eca487d15f
commit 5c1af0fcb1
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
5 changed files with 52 additions and 2 deletions

View file

@ -466,7 +466,7 @@ def generate_extra_cli_parser(name: str, spec: str) -> None:
def kitten_clis() -> None:
from kittens.runner import get_kitten_conf_docs, get_kitten_extra_cli_parsers
for kitten in wrapped_kittens() + ('pager',):
for kitten in wrapped_kittens() + ('pager', 'notify',):
defn = get_kitten_conf_docs(kitten)
if defn is not None:
generate_conf_parser(kitten, defn)

View file

17
kittens/notify/main.go Normal file
View file

@ -0,0 +1,17 @@
package notify
import (
"fmt"
"kitty/tools/cli"
)
var _ = fmt.Print
func main(_ *cli.Command, opts_ *Options, args []string) (rc int, err error) {
return
}
func EntryPoint(parent *cli.Command) {
create_cmd(parent, main)
}

30
kittens/notify/main.py Normal file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env python
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
import sys
OPTIONS = r'''
--identifier -i
The identifier of this notification. If a notification with the same identifier
is already displayed, it is replaced/updated.
--wait-till-closed
type=bool-set
Wait until the notification is closed. If the user activates the notification,
"activated" is printed to STDOUT before quitting.
'''.format
help_text = '''\
Send notifications to the user that are displayed to them via the
desktop environment's notifications service. Works over SSH as well.
'''
usage = 'TITLE [BODY ...]'
if __name__ == '__main__':
raise SystemExit('This should be run as kitten clipboard')
elif __name__ == '__doc__':
cd = sys.cli_docs # type: ignore
cd['usage'] = usage
cd['options'] = OPTIONS
cd['help_text'] = help_text
cd['short_desc'] = 'Send notifications to the user'

View file

@ -12,6 +12,7 @@ import (
"kitty/kittens/hints"
"kitty/kittens/hyperlinked_grep"
"kitty/kittens/icat"
"kitty/kittens/notify"
"kitty/kittens/query_terminal"
"kitty/kittens/show_key"
"kitty/kittens/ssh"
@ -70,8 +71,10 @@ func KittyToolEntryPoints(root *cli.Command) {
ask.EntryPoint(root)
// hints
hints.EntryPoint(root)
// hints
// diff
diff.EntryPoint(root)
// notify
notify.EntryPoint(root)
// themes
themes.EntryPoint(root)
themes.ParseEntryPoint(root)