Skip to content
Snippets Groups Projects
Commit bb088233 authored by George Nachman's avatar George Nachman
Browse files

Add a session-created websocket API notification.

parent 617ad184
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -20,7 +20,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
name='api.proto',
package='iterm2',
syntax='proto2',
serialized_pb=_b('\n\tapi.proto\x12\x06iterm2\"\xea\x03\n\x07Request\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x34\n\x12get_buffer_request\x18\x64 \x01(\x0b\x32\x18.iterm2.GetBufferRequest\x12\x34\n\x12get_prompt_request\x18\x65 \x01(\x0b\x32\x18.iterm2.GetPromptRequest\x12\x37\n\x13transaction_request\x18\x66 \x01(\x0b\x32\x1a.iterm2.TransactionRequest\x12\x39\n\x14notification_request\x18g \x01(\x0b\x32\x1b.iterm2.NotificationRequest\x12:\n\x15register_tool_request\x18h \x01(\x0b\x32\x1b.iterm2.RegisterToolRequest\x12G\n\x1cset_profile_property_request\x18i \x01(\x0b\x32!.iterm2.SetProfilePropertyRequest\x12:\n\x15list_sessions_request\x18j \x01(\x0b\x32\x1b.iterm2.ListSessionsRequest\x12\x32\n\x11send_text_request\x18k \x01(\x0b\x32\x17.iterm2.SendTextRequest\"\xa8\x04\n\x08Response\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x36\n\x13get_buffer_response\x18\x64 \x01(\x0b\x32\x19.iterm2.GetBufferResponse\x12\x36\n\x13get_prompt_response\x18\x65 \x01(\x0b\x32\x19.iterm2.GetPromptResponse\x12\x39\n\x14transaction_response\x18\x66 \x01(\x0b\x32\x1b.iterm2.TransactionResponse\x12;\n\x15notification_response\x18g \x01(\x0b\x32\x1c.iterm2.NotificationResponse\x12<\n\x16register_tool_response\x18h \x01(\x0b\x32\x1c.iterm2.RegisterToolResponse\x12I\n\x1dset_profile_property_response\x18i \x01(\x0b\x32\".iterm2.SetProfilePropertyResponse\x12<\n\x16list_sessions_response\x18j \x01(\x0b\x32\x1c.iterm2.ListSessionsResponse\x12\x34\n\x12send_text_response\x18k \x01(\x0b\x32\x18.iterm2.SendTextResponse\x12+\n\x0cnotification\x18\xe8\x07 \x01(\x0b\x32\x14.iterm2.Notification\"\xd8\x01\n\x13RegisterToolRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\nidentifier\x18\x02 \x01(\t\x12+\n\x1creveal_if_already_registered\x18\x05 \x01(\x08:\x05\x66\x61lse\x12\x46\n\ttool_type\x18\x03 \x01(\x0e\x32$.iterm2.RegisterToolRequest.ToolType:\rWEB_VIEW_TOOL\x12\x0b\n\x03URL\x18\x04 \x01(\t\"\x1d\n\x08ToolType\x12\x11\n\rWEB_VIEW_TOOL\x10\x01\"\x8b\x01\n\x14RegisterToolResponse\x12\x33\n\x06status\x18\x01 \x01(\x0e\x32#.iterm2.RegisterToolResponse.Status\">\n\x06Status\x12\x06\n\x02OK\x10\x00\x12\x15\n\x11REQUEST_MALFORMED\x10\x01\x12\x15\n\x11PERMISSION_DENIED\x10\x02\"n\n\x13NotificationRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x11\n\tsubscribe\x18\x02 \x01(\x08\x12\x33\n\x11notification_type\x18\x03 \x01(\x0e\x32\x18.iterm2.NotificationType\"\xb7\x01\n\x14NotificationResponse\x12\x33\n\x06status\x18\x01 \x01(\x0e\x32#.iterm2.NotificationResponse.Status\"j\n\x06Status\x12\x06\n\x02OK\x10\x00\x12\x15\n\x11SESSION_NOT_FOUND\x10\x01\x12\x15\n\x11REQUEST_MALFORMED\x10\x02\x12\x12\n\x0eNOT_SUBSCRIBED\x10\x03\x12\x16\n\x12\x41LREADY_SUBSCRIBED\x10\x04\"\xed\x02\n\x0cNotification\x12=\n\x16keystroke_notification\x18\x01 \x01(\x0b\x32\x1d.iterm2.KeystrokeNotification\x12\x44\n\x1ascreen_update_notification\x18\x02 \x01(\x0b\x32 .iterm2.ScreenUpdateNotification\x12\x37\n\x13prompt_notification\x18\x03 \x01(\x0b\x32\x1a.iterm2.PromptNotification\x12H\n\x1clocation_change_notification\x18\x04 \x01(\x0b\x32\".iterm2.LocationChangeNotification\x12U\n#custom_escape_sequence_notification\x18\x05 \x01(\x0b\x32(.iterm2.CustomEscapeSequenceNotification\"\x86\x02\n\x15KeystrokeNotification\x12\x12\n\ncharacters\x18\x01 \x01(\t\x12#\n\x1b\x63haractersIgnoringModifiers\x18\x02 \x01(\t\x12:\n\tmodifiers\x18\x03 \x03(\x0e\x32\'.iterm2.KeystrokeNotification.Modifiers\x12\x0f\n\x07keyCode\x18\x04 \x01(\x05\x12\x0f\n\x07session\x18\x05 \x01(\t\"V\n\tModifiers\x12\x0b\n\x07\x43ONTROL\x10\x01\x12\n\n\x06OPTION\x10\x02\x12\x0b\n\x07\x43OMMAND\x10\x03\x12\t\n\x05SHIFT\x10\x04\x12\x0c\n\x08\x46UNCTION\x10\x05\x12\n\n\x06NUMPAD\x10\x06\"+\n\x18ScreenUpdateNotification\x12\x0f\n\x07session\x18\x01 \x01(\t\"%\n\x12PromptNotification\x12\x0f\n\x07session\x18\x01 \x01(\t\"f\n\x1aLocationChangeNotification\x12\x11\n\thost_name\x18\x01 \x01(\t\x12\x11\n\tuser_name\x18\x02 \x01(\t\x12\x11\n\tdirectory\x18\x03 \x01(\t\x12\x0f\n\x07session\x18\x04 \x01(\t\"]\n CustomEscapeSequenceNotification\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x17\n\x0fsender_identity\x18\x02 \x01(\t\x12\x0f\n\x07payload\x18\x03 \x01(\t\"J\n\x10GetBufferRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\x12%\n\nline_range\x18\x02 \x01(\x0b\x32\x11.iterm2.LineRange\"\xa6\x02\n\x11GetBufferResponse\x12\x34\n\x06status\x18\x01 \x01(\x0e\x32 .iterm2.GetBufferResponse.Status:\x02OK\x12\x1c\n\x05range\x18\x02 \x01(\x0b\x32\r.iterm2.Range\x12&\n\x08\x63ontents\x18\x03 \x03(\x0b\x32\x14.iterm2.LineContents\x12\x1d\n\x06\x63ursor\x18\x04 \x01(\x0b\x32\r.iterm2.Coord\x12\x1e\n\x16num_lines_above_screen\x18\x05 \x01(\x03\"V\n\x06Status\x12\x06\n\x02OK\x10\x00\x12\x15\n\x11SESSION_NOT_FOUND\x10\x01\x12\x16\n\x12INVALID_LINE_RANGE\x10\x02\x12\x15\n\x11REQUEST_MALFORMED\x10\x03\"#\n\x10GetPromptRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\"\xcc\x02\n\x11GetPromptResponse\x12\x34\n\x06status\x18\x01 \x01(\x0e\x32 .iterm2.GetPromptResponse.Status:\x02OK\x12(\n\x0cprompt_range\x18\x02 \x01(\x0b\x32\x12.iterm2.CoordRange\x12)\n\rcommand_range\x18\x03 \x01(\x0b\x32\x12.iterm2.CoordRange\x12(\n\x0coutput_range\x18\x04 \x01(\x0b\x32\x12.iterm2.CoordRange\x12\x19\n\x11working_directory\x18\x05 \x01(\t\x12\x0f\n\x07\x63ommand\x18\x06 \x01(\t\"V\n\x06Status\x12\x06\n\x02OK\x10\x00\x12\x15\n\x11SESSION_NOT_FOUND\x10\x01\x12\x15\n\x11REQUEST_MALFORMED\x10\x02\x12\x16\n\x12PROMPT_UNAVAILABLE\x10\x03\"M\n\x19SetProfilePropertyRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x0b\n\x03key\x18\x02 \x01(\t\x12\x12\n\njson_value\x18\x03 \x01(\t\"\x9b\x01\n\x1aSetProfilePropertyResponse\x12=\n\x06status\x18\x01 \x01(\x0e\x32).iterm2.SetProfilePropertyResponse.Status:\x02OK\">\n\x06Status\x12\x06\n\x02OK\x10\x00\x12\x15\n\x11SESSION_NOT_FOUND\x10\x01\x12\x15\n\x11REQUEST_MALFORMED\x10\x02\"#\n\x12TransactionRequest\x12\r\n\x05\x62\x65gin\x18\x01 \x01(\x08\"\x8f\x01\n\x13TransactionResponse\x12\x36\n\x06status\x18\x01 \x01(\x0e\x32\".iterm2.TransactionResponse.Status:\x02OK\"@\n\x06Status\x12\x06\n\x02OK\x10\x00\x12\x12\n\x0eNO_TRANSACTION\x10\x01\x12\x1a\n\x16\x41LREADY_IN_TRANSACTION\x10\x02\"A\n\tLineRange\x12\x1c\n\x14screen_contents_only\x18\x01 \x01(\x08\x12\x16\n\x0etrailing_lines\x18\x02 \x01(\x05\")\n\x05Range\x12\x10\n\x08location\x18\x01 \x01(\x03\x12\x0e\n\x06length\x18\x02 \x01(\x03\"F\n\nCoordRange\x12\x1c\n\x05start\x18\x01 \x01(\x0b\x32\r.iterm2.Coord\x12\x1a\n\x03\x65nd\x18\x02 \x01(\x0b\x32\r.iterm2.Coord\"\x1d\n\x05\x43oord\x12\t\n\x01x\x18\x01 \x01(\x05\x12\t\n\x01y\x18\x02 \x01(\x03\"\xeb\x01\n\x0cLineContents\x12\x0c\n\x04text\x18\x01 \x01(\t\x12\x37\n\x14\x63ode_points_per_cell\x18\x02 \x03(\x0b\x32\x19.iterm2.CodePointsPerCell\x12N\n\x0c\x63ontinuation\x18\x03 \x01(\x0e\x32!.iterm2.LineContents.Continuation:\x15\x43ONTINUATION_HARD_EOL\"D\n\x0c\x43ontinuation\x12\x19\n\x15\x43ONTINUATION_HARD_EOL\x10\x01\x12\x19\n\x15\x43ONTINUATION_SOFT_EOL\x10\x02\"@\n\x11\x43odePointsPerCell\x12\x1a\n\x0fnum_code_points\x18\x01 \x01(\x05:\x01\x31\x12\x0f\n\x07repeats\x18\x02 \x01(\x05\"\x15\n\x13ListSessionsRequest\"0\n\x0fSendTextRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x0c\n\x04text\x18\x02 \x01(\t\"l\n\x10SendTextResponse\x12/\n\x06status\x18\x01 \x01(\x0e\x32\x1f.iterm2.SendTextResponse.Status\"\'\n\x06Status\x12\x06\n\x02OK\x10\x00\x12\x15\n\x11SESSION_NOT_FOUND\x10\x01\"\xea\x01\n\x14ListSessionsResponse\x12\x34\n\x07windows\x18\x01 \x03(\x0b\x32#.iterm2.ListSessionsResponse.Window\x1a\x38\n\x06Window\x12.\n\x04tabs\x18\x01 \x03(\x0b\x32 .iterm2.ListSessionsResponse.Tab\x1a=\n\x03Tab\x12\x36\n\x08sessions\x18\x01 \x03(\x0b\x32$.iterm2.ListSessionsResponse.Session\x1a#\n\x07Session\x12\x18\n\x10uniqueIdentifier\x18\x01 \x01(\t*\xa3\x01\n\x10NotificationType\x12\x17\n\x13NOTIFY_ON_KEYSTROKE\x10\x01\x12\x1b\n\x17NOTIFY_ON_SCREEN_UPDATE\x10\x02\x12\x14\n\x10NOTIFY_ON_PROMPT\x10\x03\x12\x1d\n\x19NOTIFY_ON_LOCATION_CHANGE\x10\x04\x12$\n NOTIFY_ON_CUSTOM_ESCAPE_SEQUENCE\x10\x05\x42\x06\xa2\x02\x03ITM')
serialized_pb=_b('\n\tapi.proto\x12\x06iterm2\"\xea\x03\n\x07Request\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x34\n\x12get_buffer_request\x18\x64 \x01(\x0b\x32\x18.iterm2.GetBufferRequest\x12\x34\n\x12get_prompt_request\x18\x65 \x01(\x0b\x32\x18.iterm2.GetPromptRequest\x12\x37\n\x13transaction_request\x18\x66 \x01(\x0b\x32\x1a.iterm2.TransactionRequest\x12\x39\n\x14notification_request\x18g \x01(\x0b\x32\x1b.iterm2.NotificationRequest\x12:\n\x15register_tool_request\x18h \x01(\x0b\x32\x1b.iterm2.RegisterToolRequest\x12G\n\x1cset_profile_property_request\x18i \x01(\x0b\x32!.iterm2.SetProfilePropertyRequest\x12:\n\x15list_sessions_request\x18j \x01(\x0b\x32\x1b.iterm2.ListSessionsRequest\x12\x32\n\x11send_text_request\x18k \x01(\x0b\x32\x17.iterm2.SendTextRequest\"\xa8\x04\n\x08Response\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x36\n\x13get_buffer_response\x18\x64 \x01(\x0b\x32\x19.iterm2.GetBufferResponse\x12\x36\n\x13get_prompt_response\x18\x65 \x01(\x0b\x32\x19.iterm2.GetPromptResponse\x12\x39\n\x14transaction_response\x18\x66 \x01(\x0b\x32\x1b.iterm2.TransactionResponse\x12;\n\x15notification_response\x18g \x01(\x0b\x32\x1c.iterm2.NotificationResponse\x12<\n\x16register_tool_response\x18h \x01(\x0b\x32\x1c.iterm2.RegisterToolResponse\x12I\n\x1dset_profile_property_response\x18i \x01(\x0b\x32\".iterm2.SetProfilePropertyResponse\x12<\n\x16list_sessions_response\x18j \x01(\x0b\x32\x1c.iterm2.ListSessionsResponse\x12\x34\n\x12send_text_response\x18k \x01(\x0b\x32\x18.iterm2.SendTextResponse\x12+\n\x0cnotification\x18\xe8\x07 \x01(\x0b\x32\x14.iterm2.Notification\"\xd8\x01\n\x13RegisterToolRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\nidentifier\x18\x02 \x01(\t\x12+\n\x1creveal_if_already_registered\x18\x05 \x01(\x08:\x05\x66\x61lse\x12\x46\n\ttool_type\x18\x03 \x01(\x0e\x32$.iterm2.RegisterToolRequest.ToolType:\rWEB_VIEW_TOOL\x12\x0b\n\x03URL\x18\x04 \x01(\t\"\x1d\n\x08ToolType\x12\x11\n\rWEB_VIEW_TOOL\x10\x01\"\x8b\x01\n\x14RegisterToolResponse\x12\x33\n\x06status\x18\x01 \x01(\x0e\x32#.iterm2.RegisterToolResponse.Status\">\n\x06Status\x12\x06\n\x02OK\x10\x00\x12\x15\n\x11REQUEST_MALFORMED\x10\x01\x12\x15\n\x11PERMISSION_DENIED\x10\x02\"n\n\x13NotificationRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x11\n\tsubscribe\x18\x02 \x01(\x08\x12\x33\n\x11notification_type\x18\x03 \x01(\x0e\x32\x18.iterm2.NotificationType\"\xb7\x01\n\x14NotificationResponse\x12\x33\n\x06status\x18\x01 \x01(\x0e\x32#.iterm2.NotificationResponse.Status\"j\n\x06Status\x12\x06\n\x02OK\x10\x00\x12\x15\n\x11SESSION_NOT_FOUND\x10\x01\x12\x15\n\x11REQUEST_MALFORMED\x10\x02\x12\x12\n\x0eNOT_SUBSCRIBED\x10\x03\x12\x16\n\x12\x41LREADY_SUBSCRIBED\x10\x04\"\xaf\x03\n\x0cNotification\x12=\n\x16keystroke_notification\x18\x01 \x01(\x0b\x32\x1d.iterm2.KeystrokeNotification\x12\x44\n\x1ascreen_update_notification\x18\x02 \x01(\x0b\x32 .iterm2.ScreenUpdateNotification\x12\x37\n\x13prompt_notification\x18\x03 \x01(\x0b\x32\x1a.iterm2.PromptNotification\x12H\n\x1clocation_change_notification\x18\x04 \x01(\x0b\x32\".iterm2.LocationChangeNotification\x12U\n#custom_escape_sequence_notification\x18\x05 \x01(\x0b\x32(.iterm2.CustomEscapeSequenceNotification\x12@\n\x18new_session_notification\x18\x06 \x01(\x0b\x32\x1e.iterm2.NewSessionNotification\"\x86\x02\n\x15KeystrokeNotification\x12\x12\n\ncharacters\x18\x01 \x01(\t\x12#\n\x1b\x63haractersIgnoringModifiers\x18\x02 \x01(\t\x12:\n\tmodifiers\x18\x03 \x03(\x0e\x32\'.iterm2.KeystrokeNotification.Modifiers\x12\x0f\n\x07keyCode\x18\x04 \x01(\x05\x12\x0f\n\x07session\x18\x05 \x01(\t\"V\n\tModifiers\x12\x0b\n\x07\x43ONTROL\x10\x01\x12\n\n\x06OPTION\x10\x02\x12\x0b\n\x07\x43OMMAND\x10\x03\x12\t\n\x05SHIFT\x10\x04\x12\x0c\n\x08\x46UNCTION\x10\x05\x12\n\n\x06NUMPAD\x10\x06\"+\n\x18ScreenUpdateNotification\x12\x0f\n\x07session\x18\x01 \x01(\t\"%\n\x12PromptNotification\x12\x0f\n\x07session\x18\x01 \x01(\t\"f\n\x1aLocationChangeNotification\x12\x11\n\thost_name\x18\x01 \x01(\t\x12\x11\n\tuser_name\x18\x02 \x01(\t\x12\x11\n\tdirectory\x18\x03 \x01(\t\x12\x0f\n\x07session\x18\x04 \x01(\t\"]\n CustomEscapeSequenceNotification\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x17\n\x0fsender_identity\x18\x02 \x01(\t\x12\x0f\n\x07payload\x18\x03 \x01(\t\"2\n\x16NewSessionNotification\x12\x18\n\x10uniqueIdentifier\x18\x01 \x01(\t\"J\n\x10GetBufferRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\x12%\n\nline_range\x18\x02 \x01(\x0b\x32\x11.iterm2.LineRange\"\xa6\x02\n\x11GetBufferResponse\x12\x34\n\x06status\x18\x01 \x01(\x0e\x32 .iterm2.GetBufferResponse.Status:\x02OK\x12\x1c\n\x05range\x18\x02 \x01(\x0b\x32\r.iterm2.Range\x12&\n\x08\x63ontents\x18\x03 \x03(\x0b\x32\x14.iterm2.LineContents\x12\x1d\n\x06\x63ursor\x18\x04 \x01(\x0b\x32\r.iterm2.Coord\x12\x1e\n\x16num_lines_above_screen\x18\x05 \x01(\x03\"V\n\x06Status\x12\x06\n\x02OK\x10\x00\x12\x15\n\x11SESSION_NOT_FOUND\x10\x01\x12\x16\n\x12INVALID_LINE_RANGE\x10\x02\x12\x15\n\x11REQUEST_MALFORMED\x10\x03\"#\n\x10GetPromptRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\"\xcc\x02\n\x11GetPromptResponse\x12\x34\n\x06status\x18\x01 \x01(\x0e\x32 .iterm2.GetPromptResponse.Status:\x02OK\x12(\n\x0cprompt_range\x18\x02 \x01(\x0b\x32\x12.iterm2.CoordRange\x12)\n\rcommand_range\x18\x03 \x01(\x0b\x32\x12.iterm2.CoordRange\x12(\n\x0coutput_range\x18\x04 \x01(\x0b\x32\x12.iterm2.CoordRange\x12\x19\n\x11working_directory\x18\x05 \x01(\t\x12\x0f\n\x07\x63ommand\x18\x06 \x01(\t\"V\n\x06Status\x12\x06\n\x02OK\x10\x00\x12\x15\n\x11SESSION_NOT_FOUND\x10\x01\x12\x15\n\x11REQUEST_MALFORMED\x10\x02\x12\x16\n\x12PROMPT_UNAVAILABLE\x10\x03\"M\n\x19SetProfilePropertyRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x0b\n\x03key\x18\x02 \x01(\t\x12\x12\n\njson_value\x18\x03 \x01(\t\"\x9b\x01\n\x1aSetProfilePropertyResponse\x12=\n\x06status\x18\x01 \x01(\x0e\x32).iterm2.SetProfilePropertyResponse.Status:\x02OK\">\n\x06Status\x12\x06\n\x02OK\x10\x00\x12\x15\n\x11SESSION_NOT_FOUND\x10\x01\x12\x15\n\x11REQUEST_MALFORMED\x10\x02\"#\n\x12TransactionRequest\x12\r\n\x05\x62\x65gin\x18\x01 \x01(\x08\"\x8f\x01\n\x13TransactionResponse\x12\x36\n\x06status\x18\x01 \x01(\x0e\x32\".iterm2.TransactionResponse.Status:\x02OK\"@\n\x06Status\x12\x06\n\x02OK\x10\x00\x12\x12\n\x0eNO_TRANSACTION\x10\x01\x12\x1a\n\x16\x41LREADY_IN_TRANSACTION\x10\x02\"A\n\tLineRange\x12\x1c\n\x14screen_contents_only\x18\x01 \x01(\x08\x12\x16\n\x0etrailing_lines\x18\x02 \x01(\x05\")\n\x05Range\x12\x10\n\x08location\x18\x01 \x01(\x03\x12\x0e\n\x06length\x18\x02 \x01(\x03\"F\n\nCoordRange\x12\x1c\n\x05start\x18\x01 \x01(\x0b\x32\r.iterm2.Coord\x12\x1a\n\x03\x65nd\x18\x02 \x01(\x0b\x32\r.iterm2.Coord\"\x1d\n\x05\x43oord\x12\t\n\x01x\x18\x01 \x01(\x05\x12\t\n\x01y\x18\x02 \x01(\x03\"\xeb\x01\n\x0cLineContents\x12\x0c\n\x04text\x18\x01 \x01(\t\x12\x37\n\x14\x63ode_points_per_cell\x18\x02 \x03(\x0b\x32\x19.iterm2.CodePointsPerCell\x12N\n\x0c\x63ontinuation\x18\x03 \x01(\x0e\x32!.iterm2.LineContents.Continuation:\x15\x43ONTINUATION_HARD_EOL\"D\n\x0c\x43ontinuation\x12\x19\n\x15\x43ONTINUATION_HARD_EOL\x10\x01\x12\x19\n\x15\x43ONTINUATION_SOFT_EOL\x10\x02\"@\n\x11\x43odePointsPerCell\x12\x1a\n\x0fnum_code_points\x18\x01 \x01(\x05:\x01\x31\x12\x0f\n\x07repeats\x18\x02 \x01(\x05\"\x15\n\x13ListSessionsRequest\"0\n\x0fSendTextRequest\x12\x0f\n\x07session\x18\x01 \x01(\t\x12\x0c\n\x04text\x18\x02 \x01(\t\"l\n\x10SendTextResponse\x12/\n\x06status\x18\x01 \x01(\x0e\x32\x1f.iterm2.SendTextResponse.Status\"\'\n\x06Status\x12\x06\n\x02OK\x10\x00\x12\x15\n\x11SESSION_NOT_FOUND\x10\x01\"\xea\x01\n\x14ListSessionsResponse\x12\x34\n\x07windows\x18\x01 \x03(\x0b\x32#.iterm2.ListSessionsResponse.Window\x1a\x38\n\x06Window\x12.\n\x04tabs\x18\x01 \x03(\x0b\x32 .iterm2.ListSessionsResponse.Tab\x1a=\n\x03Tab\x12\x36\n\x08sessions\x18\x01 \x03(\x0b\x32$.iterm2.ListSessionsResponse.Session\x1a#\n\x07Session\x12\x18\n\x10uniqueIdentifier\x18\x01 \x01(\t*\xbe\x01\n\x10NotificationType\x12\x17\n\x13NOTIFY_ON_KEYSTROKE\x10\x01\x12\x1b\n\x17NOTIFY_ON_SCREEN_UPDATE\x10\x02\x12\x14\n\x10NOTIFY_ON_PROMPT\x10\x03\x12\x1d\n\x19NOTIFY_ON_LOCATION_CHANGE\x10\x04\x12$\n NOTIFY_ON_CUSTOM_ESCAPE_SEQUENCE\x10\x05\x12\x19\n\x15NOTIFY_ON_NEW_SESSION\x10\x06\x42\x06\xa2\x02\x03ITM')
)
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
 
Loading
Loading
@@ -50,11 +50,15 @@ _NOTIFICATIONTYPE = _descriptor.EnumDescriptor(
name='NOTIFY_ON_CUSTOM_ESCAPE_SEQUENCE', index=4, number=5,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='NOTIFY_ON_NEW_SESSION', index=5, number=6,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=4747,
serialized_end=4910,
serialized_start=4865,
serialized_end=5055,
)
_sym_db.RegisterEnumDescriptor(_NOTIFICATIONTYPE)
 
Loading
Loading
@@ -64,6 +68,7 @@ NOTIFY_ON_SCREEN_UPDATE = 2
NOTIFY_ON_PROMPT = 3
NOTIFY_ON_LOCATION_CHANGE = 4
NOTIFY_ON_CUSTOM_ESCAPE_SEQUENCE = 5
NOTIFY_ON_NEW_SESSION = 6
 
 
_REGISTERTOOLREQUEST_TOOLTYPE = _descriptor.EnumDescriptor(
Loading
Loading
@@ -177,8 +182,8 @@ _KEYSTROKENOTIFICATION_MODIFIERS = _descriptor.EnumDescriptor(
],
containing_type=None,
options=None,
serialized_start=2273,
serialized_end=2359,
serialized_start=2339,
serialized_end=2425,
)
_sym_db.RegisterEnumDescriptor(_KEYSTROKENOTIFICATION_MODIFIERS)
 
Loading
Loading
@@ -207,8 +212,8 @@ _GETBUFFERRESPONSE_STATUS = _descriptor.EnumDescriptor(
],
containing_type=None,
options=None,
serialized_start=2929,
serialized_end=3015,
serialized_start=3047,
serialized_end=3133,
)
_sym_db.RegisterEnumDescriptor(_GETBUFFERRESPONSE_STATUS)
 
Loading
Loading
@@ -237,8 +242,8 @@ _GETPROMPTRESPONSE_STATUS = _descriptor.EnumDescriptor(
],
containing_type=None,
options=None,
serialized_start=3301,
serialized_end=3387,
serialized_start=3419,
serialized_end=3505,
)
_sym_db.RegisterEnumDescriptor(_GETPROMPTRESPONSE_STATUS)
 
Loading
Loading
@@ -289,8 +294,8 @@ _TRANSACTIONRESPONSE_STATUS = _descriptor.EnumDescriptor(
],
containing_type=None,
options=None,
serialized_start=3743,
serialized_end=3807,
serialized_start=3861,
serialized_end=3925,
)
_sym_db.RegisterEnumDescriptor(_TRANSACTIONRESPONSE_STATUS)
 
Loading
Loading
@@ -311,8 +316,8 @@ _LINECONTENTS_CONTINUATION = _descriptor.EnumDescriptor(
],
containing_type=None,
options=None,
serialized_start=4190,
serialized_end=4258,
serialized_start=4308,
serialized_end=4376,
)
_sym_db.RegisterEnumDescriptor(_LINECONTENTS_CONTINUATION)
 
Loading
Loading
@@ -731,6 +736,13 @@ _NOTIFICATION = _descriptor.Descriptor(
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='new_session_notification', full_name='iterm2.Notification.new_session_notification', index=5,
number=6, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
Loading
Loading
@@ -744,7 +756,7 @@ _NOTIFICATION = _descriptor.Descriptor(
oneofs=[
],
serialized_start=1729,
serialized_end=2094,
serialized_end=2160,
)
 
 
Loading
Loading
@@ -803,8 +815,8 @@ _KEYSTROKENOTIFICATION = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=2097,
serialized_end=2359,
serialized_start=2163,
serialized_end=2425,
)
 
 
Loading
Loading
@@ -834,8 +846,8 @@ _SCREENUPDATENOTIFICATION = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=2361,
serialized_end=2404,
serialized_start=2427,
serialized_end=2470,
)
 
 
Loading
Loading
@@ -865,8 +877,8 @@ _PROMPTNOTIFICATION = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=2406,
serialized_end=2443,
serialized_start=2472,
serialized_end=2509,
)
 
 
Loading
Loading
@@ -917,8 +929,8 @@ _LOCATIONCHANGENOTIFICATION = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=2445,
serialized_end=2547,
serialized_start=2511,
serialized_end=2613,
)
 
 
Loading
Loading
@@ -962,8 +974,39 @@ _CUSTOMESCAPESEQUENCENOTIFICATION = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=2549,
serialized_end=2642,
serialized_start=2615,
serialized_end=2708,
)
_NEWSESSIONNOTIFICATION = _descriptor.Descriptor(
name='NewSessionNotification',
full_name='iterm2.NewSessionNotification',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='uniqueIdentifier', full_name='iterm2.NewSessionNotification.uniqueIdentifier', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=2710,
serialized_end=2760,
)
 
 
Loading
Loading
@@ -1000,8 +1043,8 @@ _GETBUFFERREQUEST = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=2644,
serialized_end=2718,
serialized_start=2762,
serialized_end=2836,
)
 
 
Loading
Loading
@@ -1060,8 +1103,8 @@ _GETBUFFERRESPONSE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=2721,
serialized_end=3015,
serialized_start=2839,
serialized_end=3133,
)
 
 
Loading
Loading
@@ -1091,8 +1134,8 @@ _GETPROMPTREQUEST = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=3017,
serialized_end=3052,
serialized_start=3135,
serialized_end=3170,
)
 
 
Loading
Loading
@@ -1158,8 +1201,8 @@ _GETPROMPTRESPONSE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=3055,
serialized_end=3387,
serialized_start=3173,
serialized_end=3505,
)
 
 
Loading
Loading
@@ -1203,8 +1246,8 @@ _SETPROFILEPROPERTYREQUEST = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=3389,
serialized_end=3466,
serialized_start=3507,
serialized_end=3584,
)
 
 
Loading
Loading
@@ -1235,8 +1278,8 @@ _SETPROFILEPROPERTYRESPONSE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=3469,
serialized_end=3624,
serialized_start=3587,
serialized_end=3742,
)
 
 
Loading
Loading
@@ -1266,8 +1309,8 @@ _TRANSACTIONREQUEST = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=3626,
serialized_end=3661,
serialized_start=3744,
serialized_end=3779,
)
 
 
Loading
Loading
@@ -1298,8 +1341,8 @@ _TRANSACTIONRESPONSE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=3664,
serialized_end=3807,
serialized_start=3782,
serialized_end=3925,
)
 
 
Loading
Loading
@@ -1336,8 +1379,8 @@ _LINERANGE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=3809,
serialized_end=3874,
serialized_start=3927,
serialized_end=3992,
)
 
 
Loading
Loading
@@ -1374,8 +1417,8 @@ _RANGE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=3876,
serialized_end=3917,
serialized_start=3994,
serialized_end=4035,
)
 
 
Loading
Loading
@@ -1412,8 +1455,8 @@ _COORDRANGE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=3919,
serialized_end=3989,
serialized_start=4037,
serialized_end=4107,
)
 
 
Loading
Loading
@@ -1450,8 +1493,8 @@ _COORD = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=3991,
serialized_end=4020,
serialized_start=4109,
serialized_end=4138,
)
 
 
Loading
Loading
@@ -1496,8 +1539,8 @@ _LINECONTENTS = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=4023,
serialized_end=4258,
serialized_start=4141,
serialized_end=4376,
)
 
 
Loading
Loading
@@ -1534,8 +1577,8 @@ _CODEPOINTSPERCELL = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=4260,
serialized_end=4324,
serialized_start=4378,
serialized_end=4442,
)
 
 
Loading
Loading
@@ -1558,8 +1601,8 @@ _LISTSESSIONSREQUEST = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=4326,
serialized_end=4347,
serialized_start=4444,
serialized_end=4465,
)
 
 
Loading
Loading
@@ -1596,8 +1639,8 @@ _SENDTEXTREQUEST = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=4349,
serialized_end=4397,
serialized_start=4467,
serialized_end=4515,
)
 
 
Loading
Loading
@@ -1628,8 +1671,8 @@ _SENDTEXTRESPONSE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=4399,
serialized_end=4507,
serialized_start=4517,
serialized_end=4625,
)
 
 
Loading
Loading
@@ -1659,8 +1702,8 @@ _LISTSESSIONSRESPONSE_WINDOW = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=4588,
serialized_end=4644,
serialized_start=4706,
serialized_end=4762,
)
 
_LISTSESSIONSRESPONSE_TAB = _descriptor.Descriptor(
Loading
Loading
@@ -1689,8 +1732,8 @@ _LISTSESSIONSRESPONSE_TAB = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=4646,
serialized_end=4707,
serialized_start=4764,
serialized_end=4825,
)
 
_LISTSESSIONSRESPONSE_SESSION = _descriptor.Descriptor(
Loading
Loading
@@ -1719,8 +1762,8 @@ _LISTSESSIONSRESPONSE_SESSION = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=4709,
serialized_end=4744,
serialized_start=4827,
serialized_end=4862,
)
 
_LISTSESSIONSRESPONSE = _descriptor.Descriptor(
Loading
Loading
@@ -1749,8 +1792,8 @@ _LISTSESSIONSRESPONSE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=4510,
serialized_end=4744,
serialized_start=4628,
serialized_end=4862,
)
 
_REQUEST.fields_by_name['get_buffer_request'].message_type = _GETBUFFERREQUEST
Loading
Loading
@@ -1782,6 +1825,7 @@ _NOTIFICATION.fields_by_name['screen_update_notification'].message_type = _SCREE
_NOTIFICATION.fields_by_name['prompt_notification'].message_type = _PROMPTNOTIFICATION
_NOTIFICATION.fields_by_name['location_change_notification'].message_type = _LOCATIONCHANGENOTIFICATION
_NOTIFICATION.fields_by_name['custom_escape_sequence_notification'].message_type = _CUSTOMESCAPESEQUENCENOTIFICATION
_NOTIFICATION.fields_by_name['new_session_notification'].message_type = _NEWSESSIONNOTIFICATION
_KEYSTROKENOTIFICATION.fields_by_name['modifiers'].enum_type = _KEYSTROKENOTIFICATION_MODIFIERS
_KEYSTROKENOTIFICATION_MODIFIERS.containing_type = _KEYSTROKENOTIFICATION
_GETBUFFERREQUEST.fields_by_name['line_range'].message_type = _LINERANGE
Loading
Loading
@@ -1824,6 +1868,7 @@ DESCRIPTOR.message_types_by_name['ScreenUpdateNotification'] = _SCREENUPDATENOTI
DESCRIPTOR.message_types_by_name['PromptNotification'] = _PROMPTNOTIFICATION
DESCRIPTOR.message_types_by_name['LocationChangeNotification'] = _LOCATIONCHANGENOTIFICATION
DESCRIPTOR.message_types_by_name['CustomEscapeSequenceNotification'] = _CUSTOMESCAPESEQUENCENOTIFICATION
DESCRIPTOR.message_types_by_name['NewSessionNotification'] = _NEWSESSIONNOTIFICATION
DESCRIPTOR.message_types_by_name['GetBufferRequest'] = _GETBUFFERREQUEST
DESCRIPTOR.message_types_by_name['GetBufferResponse'] = _GETBUFFERRESPONSE
DESCRIPTOR.message_types_by_name['GetPromptRequest'] = _GETPROMPTREQUEST
Loading
Loading
@@ -1928,6 +1973,13 @@ CustomEscapeSequenceNotification = _reflection.GeneratedProtocolMessageType('Cus
))
_sym_db.RegisterMessage(CustomEscapeSequenceNotification)
 
NewSessionNotification = _reflection.GeneratedProtocolMessageType('NewSessionNotification', (_message.Message,), dict(
DESCRIPTOR = _NEWSESSIONNOTIFICATION,
__module__ = 'api_pb2'
# @@protoc_insertion_point(class_scope:iterm2.NewSessionNotification)
))
_sym_db.RegisterMessage(NewSessionNotification)
GetBufferRequest = _reflection.GeneratedProtocolMessageType('GetBufferRequest', (_message.Message,), dict(
DESCRIPTOR = _GETBUFFERREQUEST,
__module__ = 'api_pb2'
Loading
Loading
Loading
Loading
@@ -10,30 +10,44 @@ import time
import websocket
 
callbacks = []
DEBUG=0
 
def SendRPC(ws, message, callback):
if DEBUG > 0:
print(">>> " + str(message))
ws.send(message.SerializeToString(), opcode=websocket.ABNF.OPCODE_BINARY)
callbacks.append(callback)
 
def handle_notification(notification):
def handle_notification(ws, notification):
def handle_custom_escape_sequence_notification(custom_escape_sequence_notification):
# -- Your logic goes here --
print(custom_escape_sequence_notification.sender_identity + " sends message " + custom_escape_sequence_notification.payload)
 
def handle_new_session_notification(new_session_notification):
subscribe_to_custom_escape_sequence(ws, new_session_notification.uniqueIdentifier)
if notification.HasField('custom_escape_sequence_notification'):
handle_custom_escape_sequence_notification(notification.custom_escape_sequence_notification)
elif notification.HasField('new_session_notification'):
handle_new_session_notification(notification.new_session_notification)
def handle_notification_response(response):
if not response.HasField('notification_response'):
print("Malformed notification response")
print(str(response))
return
if response.notification_response.status != api_pb2.NotificationResponse.OK:
print("Bad status in notification response")
print(str(response))
return
def subscribe_to_new_sessions(ws):
request = api_pb2.Request()
request.notification_request.subscribe = True
request.notification_request.notification_type = api_pb2.NOTIFY_ON_NEW_SESSION
SendRPC(ws, request, handle_notification_response)
 
def subscribe_to_custom_escape_sequence(ws, session):
def handle_notification_response(response):
if not response.HasField('notification_response'):
print("Malformed notification response")
print(str(response))
return
if response.notification_response.status != api_pb2.NotificationResponse.OK:
print("Bad status in notification response")
print(str(response))
return
request = api_pb2.Request()
request.notification_request.subscribe = True
request.notification_request.session = session
Loading
Loading
@@ -44,8 +58,10 @@ def main(argv):
def on_message(ws, message):
response = api_pb2.Response()
response.ParseFromString(message)
if DEBUG > 0:
print("<<< " + str(response))
if response.HasField('notification'):
handle_notification(response.notification)
handle_notification(ws, response.notification)
else:
global callbacks
callback = callbacks[0]
Loading
Loading
@@ -69,6 +85,7 @@ def main(argv):
request.list_sessions_request.SetInParent()
SendRPC(ws, request, callback)
 
subscribe_to_new_sessions(ws)
list_sessions(ws)
 
#websocket.enableTrace(True)
Loading
Loading
Loading
Loading
@@ -51,7 +51,7 @@ typedef NSModalResponse (^WarningBlockType)(NSAlert *alert, NSString *identifier
}
 
- (void)setUp {
_session = [[PTYSession alloc] init];
_session = [[PTYSession alloc] initSynthetic:NO];
_fakePasteHelper = [[[FakePasteHelper alloc] init] autorelease];
[_session setPasteHelper:_fakePasteHelper];
_warningIdentifiers = [[NSMutableSet alloc] init];
Loading
Loading
Loading
Loading
@@ -603,7 +603,7 @@ static NSString *const kDiffScriptPath = @"/tmp/diffs";
 
- (PTYSession *)sessionWithProfileOverrides:(NSDictionary *)profileOverrides
size:(VT100GridSize)size {
PTYSession *session = [[[PTYSession alloc] init] autorelease];
PTYSession *session = [[[PTYSession alloc] initSynthetic:NO] autorelease];
NSString* plistFile = [[NSBundle bundleForClass:[self class]]
pathForResource:@"DefaultBookmark"
ofType:@"plist"];
Loading
Loading
Loading
Loading
@@ -71,11 +71,15 @@ message RegisterToolResponse {
}
 
enum NotificationType {
// Notifications that use the `session` parameter.
NOTIFY_ON_KEYSTROKE = 1;
NOTIFY_ON_SCREEN_UPDATE = 2;
NOTIFY_ON_PROMPT = 3;
NOTIFY_ON_LOCATION_CHANGE = 4;
NOTIFY_ON_CUSTOM_ESCAPE_SEQUENCE = 5;
// Notifications that ignore the `session` parameter.
NOTIFY_ON_NEW_SESSION = 6;
}
 
message NotificationRequest {
Loading
Loading
@@ -106,6 +110,7 @@ message Notification {
optional PromptNotification prompt_notification = 3;
optional LocationChangeNotification location_change_notification=4;
optional CustomEscapeSequenceNotification custom_escape_sequence_notification=5;
optional NewSessionNotification new_session_notification=6;
}
 
message KeystrokeNotification {
Loading
Loading
@@ -146,6 +151,10 @@ message CustomEscapeSequenceNotification {
optional string payload = 3;
}
 
message NewSessionNotification {
optional string uniqueIdentifier = 1;
}
// Requests the contents of a range of lines.
message GetBufferRequest {
// Leave this empty to use the current session, if any.
Loading
Loading
Loading
Loading
@@ -27,6 +27,8 @@ extern NSString *const kPTYSessionTmuxFontDidChange;
// Called when captured output for the current session changes.
extern NSString *const kPTYSessionCapturedOutputDidChange;
 
extern NSString *const PTYSessionCreatedNotification;
@class CapturedOutput;
@class FakeWindow;
@class iTermAnnouncementViewController;
Loading
Loading
@@ -456,6 +458,9 @@ typedef enum {
// called after startup activities are done.
+ (void)removeAllRegisteredSessions;
 
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initSynthetic:(BOOL)synthetic NS_DESIGNATED_INITIALIZER;
// Jump to a particular point in time.
- (long long)irSeekToAtLeast:(long long)timestamp;
 
Loading
Loading
Loading
Loading
@@ -100,6 +100,8 @@ static NSString *const PTYSessionDidRepairSavedArrangement = @"PTYSessionDidRepa
// outdated key mappings for a give profile. The %@ is replaced with the profile's GUID.
static NSString *const kAskAboutOutdatedKeyMappingKeyFormat = @"AskAboutOutdatedKeyMappingForGuid%@";
 
NSString *const PTYSessionCreatedNotification = @"PTYSessionCreatedNotification";
NSString *const kPTYSessionTmuxFontDidChange = @"kPTYSessionTmuxFontDidChange";
NSString *const kPTYSessionCapturedOutputDidChange = @"kPTYSessionCapturedOutputDidChange";
static NSString *const kSuppressAnnoyingBellOffer = @"NoSyncSuppressAnnyoingBellOffer";
Loading
Loading
@@ -490,7 +492,7 @@ static const NSUInteger kMaxHosts = 100;
[gRegisteredSessionContents removeAllObjects];
}
 
- (instancetype)init {
- (instancetype)initSynthetic:(BOOL)synthetic {
self = [super init];
if (self) {
_autoLogId = arc4random();
Loading
Loading
@@ -596,6 +598,10 @@ static const NSUInteger kMaxHosts = 100;
name:NSWindowDidEndLiveResizeNotification
object:nil];
[self updateVariables];
if (!synthetic) {
[[NSNotificationCenter defaultCenter] postNotificationName:PTYSessionCreatedNotification object:self];
}
}
return self;
}
Loading
Loading
@@ -944,7 +950,7 @@ ITERM_WEAKLY_REFERENCEABLE
withDelegate:(id<PTYSessionDelegate>)delegate
forObjectType:(iTermObjectType)objectType {
DLog(@"Restoring session from arrangement");
PTYSession* aSession = [[[PTYSession alloc] init] autorelease];
PTYSession* aSession = [[[PTYSession alloc] initSynthetic:NO] autorelease];
aSession.view = sessionView;
 
[[sessionView findViewController] setDelegate:aSession];
Loading
Loading
@@ -9156,6 +9162,11 @@ ITERM_WEAKLY_REFERENCEABLE
case ITMNotificationType_NotifyOnCustomEscapeSequence:
subscriptions = _customEscapeSequenceNotifications;
break;
case ITMNotificationType_NotifyOnNewSession:
// We won't get called for this
assert(NO);
break;
}
if (!subscriptions) {
response.status = ITMNotificationResponse_Status_RequestMalformed;
Loading
Loading
Loading
Loading
@@ -4881,7 +4881,7 @@ ITERM_WEAKLY_REFERENCEABLE
PTYSession *newSession;
 
// Initialize a new session
newSession = [[[PTYSession alloc] init] autorelease];
newSession = [[[PTYSession alloc] initSynthetic:YES] autorelease];
// NSLog(@"New session for IR view is at %p", newSession);
 
// set our preferences
Loading
Loading
@@ -7287,7 +7287,7 @@ ITERM_WEAKLY_REFERENCEABLE
PTYSession *aSession;
 
// Initialize a new session
aSession = [[PTYSession alloc] init];
aSession = [[PTYSession alloc] initSynthetic:NO];
 
[[aSession screen] setUnlimitedScrollback:[[bookmark objectForKey:KEY_UNLIMITED_SCROLLBACK] boolValue]];
[[aSession screen] setMaxScrollbackLines:[[bookmark objectForKey:KEY_SCROLLBACK_LINES] intValue]];
Loading
Loading
@@ -7425,7 +7425,7 @@ ITERM_WEAKLY_REFERENCEABLE
}
 
// Initialize a new session
PTYSession *aSession = [[[PTYSession alloc] init] autorelease];
PTYSession *aSession = [[[PTYSession alloc] initSynthetic:NO] autorelease];
[[aSession screen] setUnlimitedScrollback:[[profile objectForKey:KEY_UNLIMITED_SCROLLBACK] boolValue]];
[[aSession screen] setMaxScrollbackLines:[[profile objectForKey:KEY_SCROLLBACK_LINES] intValue]];
 
Loading
Loading
@@ -7567,7 +7567,7 @@ ITERM_WEAKLY_REFERENCEABLE
PTYSession *aSession;
 
// Initialize a new session
aSession = [[[PTYSession alloc] init] autorelease];
aSession = [[[PTYSession alloc] initSynthetic:NO] autorelease];
[[aSession screen] setUnlimitedScrollback:[profile[KEY_UNLIMITED_SCROLLBACK] boolValue]];
[[aSession screen] setMaxScrollbackLines:[profile[KEY_SCROLLBACK_LINES] intValue]];
// set our preferences
Loading
Loading
Loading
Loading
@@ -193,6 +193,7 @@ static const NSTimeInterval kOneMonth = 30 * 24 * 60 * 60;
iTermAPIServer *_apiServer;
 
NSArray<NSDictionary *> *_buriedSessionsState;
NSMutableDictionary<id, ITMNotificationRequest *> *_newSessionSubscriptions;
}
 
- (instancetype)init {
Loading
Loading
@@ -241,6 +242,10 @@ static const NSTimeInterval kOneMonth = 30 * 24 * 60 * 60;
selector:@selector(currentSessionDidChange)
name:kCurrentSessionDidChange
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(sessionCreated:)
name:PTYSessionCreatedNotification
object:nil];
[[NSAppleEventManager sharedAppleEventManager] setEventHandler:self
andSelector:@selector(getUrl:withReplyEvent:)
forEventClass:kInternetEventClass
Loading
Loading
@@ -257,6 +262,7 @@ static const NSTimeInterval kOneMonth = 30 * 24 * 60 * 60;
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self];
[_appNapStoppingActivity release];
[_newSessionSubscriptions release];
[super dealloc];
}
 
Loading
Loading
@@ -1094,6 +1100,16 @@ static const NSTimeInterval kOneMonth = 30 * 24 * 60 * 60;
[menuItem setState:newState];
}
 
- (void)sessionCreated:(NSNotification *)notification {
PTYSession *session = notification.object;
[_newSessionSubscriptions enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, ITMNotificationRequest * _Nonnull obj, BOOL * _Nonnull stop) {
ITMNotification *notification = [[[ITMNotification alloc] init] autorelease];
notification.newSessionNotification = [[[ITMNewSessionNotification alloc] init] autorelease];
notification.newSessionNotification.uniqueIdentifier = session.guid;
[[[iTermApplication sharedApplication] delegate] postAPINotification:notification toConnection:key];
}];
}
- (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent {
NSString *urlStr = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
NSURL *url = [NSURL URLWithString:urlStr];
Loading
Loading
@@ -2275,16 +2291,47 @@ static const NSTimeInterval kOneMonth = 30 * 24 * 60 * 60;
}
}
 
- (ITMNotificationResponse *)handleAPINotificationRequest:(ITMNotificationRequest *)request connection:(id)connection {
ITMNotificationResponse *response = [[ITMNotificationResponse alloc] init];
if (!request.hasSubscribe) {
response.status = ITMNotificationResponse_Status_RequestMalformed;
return response;
}
if (!_newSessionSubscriptions) {
_newSessionSubscriptions = [[NSMutableDictionary alloc] init];
}
if (request.subscribe) {
if (_newSessionSubscriptions[connection]) {
response.status = ITMNotificationResponse_Status_AlreadySubscribed;
return response;
}
_newSessionSubscriptions[connection] = request;
} else {
if (!_newSessionSubscriptions[connection]) {
response.status = ITMNotificationResponse_Status_NotSubscribed;
return response;
}
[_newSessionSubscriptions removeObjectForKey:connection];
}
response.status = ITMNotificationResponse_Status_Ok;
return response;
}
- (void)apiServerNotification:(ITMNotificationRequest *)request
connection:(id)connection
handler:(void (^)(ITMNotificationResponse *))handler {
PTYSession *session = [self sessionForAPIIdentifier:request.hasSession ? request.session : nil];
if (!session) {
ITMNotificationResponse *response = [[[ITMNotificationResponse alloc] init] autorelease];
response.status = ITMNotificationResponse_Status_SessionNotFound;
handler(response);
if (request.notificationType == ITMNotificationType_NotifyOnNewSession) {
handler([self handleAPINotificationRequest:request connection:connection]);
} else {
handler([session handleAPINotificationRequest:request connection:connection]);
PTYSession *session = [self sessionForAPIIdentifier:request.hasSession ? request.session : nil];
if (!session) {
ITMNotificationResponse *response = [[[ITMNotificationResponse alloc] init] autorelease];
response.status = ITMNotificationResponse_Status_SessionNotFound;
handler(response);
} else {
handler([session handleAPINotificationRequest:request connection:connection]);
}
}
}
 
Loading
Loading
Loading
Loading
@@ -44,6 +44,7 @@ CF_EXTERN_C_BEGIN
@class ITMListSessionsResponse_Tab;
@class ITMListSessionsResponse_Window;
@class ITMLocationChangeNotification;
@class ITMNewSessionNotification;
@class ITMNotification;
@class ITMNotificationRequest;
@class ITMNotificationResponse;
Loading
Loading
@@ -64,11 +65,15 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Enum ITMNotificationType
 
typedef GPB_ENUM(ITMNotificationType) {
/** Notifications that use the `session` parameter. */
ITMNotificationType_NotifyOnKeystroke = 1,
ITMNotificationType_NotifyOnScreenUpdate = 2,
ITMNotificationType_NotifyOnPrompt = 3,
ITMNotificationType_NotifyOnLocationChange = 4,
ITMNotificationType_NotifyOnCustomEscapeSequence = 5,
/** Notifications that ignore the `session` parameter. */
ITMNotificationType_NotifyOnNewSession = 6,
};
 
GPBEnumDescriptor *ITMNotificationType_EnumDescriptor(void);
Loading
Loading
@@ -487,6 +492,7 @@ typedef GPB_ENUM(ITMNotification_FieldNumber) {
ITMNotification_FieldNumber_PromptNotification = 3,
ITMNotification_FieldNumber_LocationChangeNotification = 4,
ITMNotification_FieldNumber_CustomEscapeSequenceNotification = 5,
ITMNotification_FieldNumber_NewSessionNotification = 6,
};
 
@interface ITMNotification : GPBMessage
Loading
Loading
@@ -511,6 +517,10 @@ typedef GPB_ENUM(ITMNotification_FieldNumber) {
/** Test to see if @c customEscapeSequenceNotification has been set. */
@property(nonatomic, readwrite) BOOL hasCustomEscapeSequenceNotification;
 
@property(nonatomic, readwrite, strong, null_resettable) ITMNewSessionNotification *newSessionNotification NS_RETURNS_NOT_RETAINED;
/** Test to see if @c newSessionNotification has been set. */
@property(nonatomic, readwrite) BOOL hasNewSessionNotification;
@end
 
#pragma mark - ITMKeystrokeNotification
Loading
Loading
@@ -631,6 +641,20 @@ typedef GPB_ENUM(ITMCustomEscapeSequenceNotification_FieldNumber) {
 
@end
 
#pragma mark - ITMNewSessionNotification
typedef GPB_ENUM(ITMNewSessionNotification_FieldNumber) {
ITMNewSessionNotification_FieldNumber_UniqueIdentifier = 1,
};
@interface ITMNewSessionNotification : GPBMessage
@property(nonatomic, readwrite, copy, null_resettable) NSString *uniqueIdentifier;
/** Test to see if @c uniqueIdentifier has been set. */
@property(nonatomic, readwrite) BOOL hasUniqueIdentifier;
@end
#pragma mark - ITMGetBufferRequest
 
typedef GPB_ENUM(ITMGetBufferRequest_FieldNumber) {
Loading
Loading
Loading
Loading
@@ -51,13 +51,15 @@ GPBEnumDescriptor *ITMNotificationType_EnumDescriptor(void) {
static const char *valueNames =
"NotifyOnKeystroke\000NotifyOnScreenUpdate\000N"
"otifyOnPrompt\000NotifyOnLocationChange\000Not"
"ifyOnCustomEscapeSequence\000";
"ifyOnCustomEscapeSequence\000NotifyOnNewSes"
"sion\000";
static const int32_t values[] = {
ITMNotificationType_NotifyOnKeystroke,
ITMNotificationType_NotifyOnScreenUpdate,
ITMNotificationType_NotifyOnPrompt,
ITMNotificationType_NotifyOnLocationChange,
ITMNotificationType_NotifyOnCustomEscapeSequence,
ITMNotificationType_NotifyOnNewSession,
};
GPBEnumDescriptor *worker =
[GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(ITMNotificationType)
Loading
Loading
@@ -79,6 +81,7 @@ BOOL ITMNotificationType_IsValidValue(int32_t value__) {
case ITMNotificationType_NotifyOnPrompt:
case ITMNotificationType_NotifyOnLocationChange:
case ITMNotificationType_NotifyOnCustomEscapeSequence:
case ITMNotificationType_NotifyOnNewSession:
return YES;
default:
return NO;
Loading
Loading
@@ -725,6 +728,7 @@ BOOL ITMNotificationResponse_Status_IsValidValue(int32_t value__) {
@dynamic hasPromptNotification, promptNotification;
@dynamic hasLocationChangeNotification, locationChangeNotification;
@dynamic hasCustomEscapeSequenceNotification, customEscapeSequenceNotification;
@dynamic hasNewSessionNotification, newSessionNotification;
 
typedef struct ITMNotification__storage_ {
uint32_t _has_storage_[1];
Loading
Loading
@@ -733,6 +737,7 @@ typedef struct ITMNotification__storage_ {
ITMPromptNotification *promptNotification;
ITMLocationChangeNotification *locationChangeNotification;
ITMCustomEscapeSequenceNotification *customEscapeSequenceNotification;
ITMNewSessionNotification *newSessionNotification;
} ITMNotification__storage_;
 
// This method is threadsafe because it is initially called
Loading
Loading
@@ -786,6 +791,15 @@ typedef struct ITMNotification__storage_ {
.flags = GPBFieldOptional,
.dataType = GPBDataTypeMessage,
},
{
.name = "newSessionNotification",
.dataTypeSpecific.className = GPBStringifySymbol(ITMNewSessionNotification),
.number = ITMNotification_FieldNumber_NewSessionNotification,
.hasIndex = 5,
.offset = (uint32_t)offsetof(ITMNotification__storage_, newSessionNotification),
.flags = GPBFieldOptional,
.dataType = GPBDataTypeMessage,
},
};
GPBDescriptor *localDescriptor =
[GPBDescriptor allocDescriptorForClass:[ITMNotification class]
Loading
Loading
@@ -1165,6 +1179,54 @@ typedef struct ITMCustomEscapeSequenceNotification__storage_ {
 
@end
 
#pragma mark - ITMNewSessionNotification
@implementation ITMNewSessionNotification
@dynamic hasUniqueIdentifier, uniqueIdentifier;
typedef struct ITMNewSessionNotification__storage_ {
uint32_t _has_storage_[1];
NSString *uniqueIdentifier;
} ITMNewSessionNotification__storage_;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+ (GPBDescriptor *)descriptor {
static GPBDescriptor *descriptor = nil;
if (!descriptor) {
static GPBMessageFieldDescription fields[] = {
{
.name = "uniqueIdentifier",
.dataTypeSpecific.className = NULL,
.number = ITMNewSessionNotification_FieldNumber_UniqueIdentifier,
.hasIndex = 0,
.offset = (uint32_t)offsetof(ITMNewSessionNotification__storage_, uniqueIdentifier),
.flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom),
.dataType = GPBDataTypeString,
},
};
GPBDescriptor *localDescriptor =
[GPBDescriptor allocDescriptorForClass:[ITMNewSessionNotification class]
rootClass:[ITMApiRoot class]
file:ITMApiRoot_FileDescriptor()
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(ITMNewSessionNotification__storage_)
flags:GPBDescriptorInitializationFlag_None];
#if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
static const char *extraTextFormatInfo =
"\001\001\020\000";
[localDescriptor setupExtraTextInfo:extraTextFormatInfo];
#endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
NSAssert(descriptor == nil, @"Startup recursed!");
descriptor = localDescriptor;
}
return descriptor;
}
@end
#pragma mark - ITMGetBufferRequest
 
@implementation ITMGetBufferRequest
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment