1- from talon import Module , actions
1+ from talon import Context , Module , actions
22
33mod = Module ()
44
77 "Application supporting cursorless commands" ,
88)
99
10+ global_ctx = Context ()
11+
12+ cursorless_ctx = Context ()
13+ cursorless_ctx .matches = r"""
14+ tag: user.cursorless
15+ """
16+
1017
1118@mod .action_class
1219class Actions :
@@ -16,8 +23,67 @@ def private_cursorless_show_settings_in_ide():
1623 def private_cursorless_show_sidebar ():
1724 """Show Cursorless-specific settings in ide"""
1825
26+ def private_cursorless_notify_docs_opened ():
27+ """Notify the ide that the docs were opened in case the tutorial is waiting for that event"""
28+ ...
29+
1930 def private_cursorless_show_command_statistics ():
2031 """Show Cursorless command statistics"""
2132 actions .user .private_cursorless_run_rpc_command_no_wait (
2233 "cursorless.analyzeCommandHistory"
2334 )
35+
36+ def private_cursorless_start_tutorial ():
37+ """Start the introductory Cursorless tutorial"""
38+ actions .user .private_cursorless_run_rpc_command_no_wait (
39+ "cursorless.tutorial.start" , "unit-1-basics"
40+ )
41+
42+ def private_cursorless_tutorial_next ():
43+ """Cursorless tutorial: next"""
44+ actions .user .private_cursorless_run_rpc_command_no_wait (
45+ "cursorless.tutorial.next"
46+ )
47+
48+ def private_cursorless_tutorial_previous ():
49+ """Cursorless tutorial: previous"""
50+ actions .user .private_cursorless_run_rpc_command_no_wait (
51+ "cursorless.tutorial.previous"
52+ )
53+
54+ def private_cursorless_tutorial_restart ():
55+ """Cursorless tutorial: restart"""
56+ actions .user .private_cursorless_run_rpc_command_no_wait (
57+ "cursorless.tutorial.restart"
58+ )
59+
60+ def private_cursorless_tutorial_resume ():
61+ """Cursorless tutorial: resume"""
62+ actions .user .private_cursorless_run_rpc_command_no_wait (
63+ "cursorless.tutorial.resume"
64+ )
65+
66+ def private_cursorless_tutorial_list ():
67+ """Cursorless tutorial: list all available tutorials"""
68+ actions .user .private_cursorless_run_rpc_command_no_wait (
69+ "cursorless.tutorial.list"
70+ )
71+
72+ def private_cursorless_tutorial_start_by_number (number : int ): # pyright: ignore [reportGeneralTypeIssues]
73+ """Start Cursorless tutorial by number"""
74+ actions .user .private_cursorless_run_rpc_command_no_wait (
75+ "cursorless.tutorial.start" , number - 1
76+ )
77+
78+
79+ @global_ctx .action_class ("user" )
80+ class GlobalActions :
81+ def private_cursorless_notify_docs_opened ():
82+ # Do nothing if we're not in a Cursorless context
83+ pass
84+
85+
86+ @cursorless_ctx .action_class ("user" )
87+ class CursorlessActions :
88+ def private_cursorless_notify_docs_opened ():
89+ actions .user .private_cursorless_run_rpc_command_no_wait ("cursorless.docsOpened" )
0 commit comments