hostty 0.1.0.alpha-aarch64-linux-gnu → 0.1.1.alpha-aarch64-linux-gnu
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.hostty.yml +1 -0
- data/docs/features/tabs.md +2 -0
- data/docs/features/terminal-emulator.md +3 -1
- data/lib/hostty/ghostty/library.rb +2 -0
- data/lib/hostty/ghostty/screen.rb +11 -2
- data/lib/hostty/tui/app.rb +34 -3
- data/lib/hostty/tui/desktop.rb +4 -0
- data/lib/hostty/tui/input.rb +6 -2
- data/lib/hostty/tui/pane.rb +22 -1
- data/lib/hostty/tui/renderer.rb +13 -3
- data/lib/hostty/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a493fcaad15a3a9380925faccfb7aba00644bff7ae696973e2789928700f07bd
|
|
4
|
+
data.tar.gz: 9cad5a5821d40408613f05bcf457bca7b9928d8f2022545fc14dd0a5f555a0a3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 82610c10fa489ee834dae4cdfa0442db812cc40a304cd17e4862d97951b8a9513f0a283ae46a0d3c746d7a11bdcb72778e1a7a8d9ad727cee832da6013040062
|
|
7
|
+
data.tar.gz: f77acf5fa8814af0d488467c81a2b8837dbacf25f1eb1734dfb952d8c2402df2225b0ce4dce0d49888adf0f054aafdb033f3ae6e10c98cd579de98a90f51d948
|
data/.hostty.yml
CHANGED
data/docs/features/tabs.md
CHANGED
|
@@ -39,6 +39,8 @@ Use Ctrl-C to stop
|
|
|
39
39
|
|
|
40
40
|
- The top row shows a tab per process. The selected tab is blue.
|
|
41
41
|
- The dot in each tab is green while the process runs and red after it exits.
|
|
42
|
+
- When a process in another tab rings the bell, the dot of its tab blinks yellow until you select that tab.
|
|
43
|
+
- When a process rings the bell while your terminal window is out of focus, hostty also rings your terminal's bell. Your terminal clears its own bell mark when you return to the window.
|
|
42
44
|
- When the selected process has a [domain](./domains.md), the right end of the top row shows its URL. Click the URL to open it in your browser.
|
|
43
45
|
- The middle rows show the selected process, as a terminal would show it.
|
|
44
46
|
- The bottom row is the help bar. `[restart]` is a button.
|
|
@@ -42,6 +42,8 @@ Hostty draws these from the screen:
|
|
|
42
42
|
| Screens | The main screen with its scrollback, and the alternate screen. |
|
|
43
43
|
| Resize | Wrapped lines on the main screen reflow when the window changes width. |
|
|
44
44
|
| Replies | libghostty-vt answers queries such as the cursor position and the device attributes, and Hostty writes the answer back to the process. |
|
|
45
|
+
| The bell | Hostty marks the tab, and it rings your terminal's bell while the window is out of focus. See [the screen of the tabs](./tabs.md#the-screen). |
|
|
46
|
+
| Focus changes | A program that asks for focus changes, such as `vim`, gets them while its tab is selected. |
|
|
45
47
|
|
|
46
48
|
## What Hostty Does Not Pass On
|
|
47
49
|
|
|
@@ -53,7 +55,7 @@ libghostty-vt tracks more than Hostty draws or forwards:
|
|
|
53
55
|
| Images, such as Kitty graphics | Nothing in the place of the image. |
|
|
54
56
|
| Links | The link text, without a link. |
|
|
55
57
|
| Cursor shape | Your terminal's own cursor. |
|
|
56
|
-
| Window titles
|
|
58
|
+
| Window titles and clipboard writes | Nothing. |
|
|
57
59
|
| Keyboard modes other than application cursor keys and bracketed paste | Keys arrive in the form your terminal sends them. |
|
|
58
60
|
|
|
59
61
|
## Speed
|
|
@@ -17,6 +17,7 @@ module Hostty
|
|
|
17
17
|
OUT_OF_SPACE = -3
|
|
18
18
|
|
|
19
19
|
TERMINAL_OPT_WRITE_PTY = 2
|
|
20
|
+
TERMINAL_OPT_BELL = 3
|
|
20
21
|
TERMINAL_OPT_SCROLLBACK_MAX_BYTES = 28
|
|
21
22
|
TERMINAL_OPT_SCROLLBACK_MAX_LINES = 29
|
|
22
23
|
|
|
@@ -29,6 +30,7 @@ module Hostty
|
|
|
29
30
|
TERMINAL_DATA_MODE = 37
|
|
30
31
|
|
|
31
32
|
MODE_CURSOR_KEYS = 1
|
|
33
|
+
MODE_FOCUS_EVENTS = 1004
|
|
32
34
|
MODE_BRACKETED_PASTE = 2004
|
|
33
35
|
|
|
34
36
|
TERMINAL_SCREEN_ALTERNATE = 1
|
|
@@ -7,8 +7,9 @@ require_relative "mouse"
|
|
|
7
7
|
module Hostty
|
|
8
8
|
module Ghostty
|
|
9
9
|
class Screen
|
|
10
|
-
def initialize(rows:, cols:, reply: nil)
|
|
10
|
+
def initialize(rows:, cols:, reply: nil, bell: nil)
|
|
11
11
|
@reply = reply
|
|
12
|
+
@bell = bell
|
|
12
13
|
@rows = rows
|
|
13
14
|
@cols = cols
|
|
14
15
|
@terminal = Library.create(:ghostty_terminal_new, :ghostty_terminal_free, cols, rows)
|
|
@@ -16,12 +17,15 @@ module Hostty
|
|
|
16
17
|
@mouse = Mouse.new(terminal:)
|
|
17
18
|
limit_scrollback
|
|
18
19
|
send_replies
|
|
20
|
+
send_bells
|
|
19
21
|
end
|
|
20
22
|
|
|
21
23
|
def application_cursor_keys? = mode?(Library::MODE_CURSOR_KEYS)
|
|
22
24
|
|
|
23
25
|
def bracketed_paste? = mode?(Library::MODE_BRACKETED_PASTE)
|
|
24
26
|
|
|
27
|
+
def focus_events? = mode?(Library::MODE_FOCUS_EVENTS)
|
|
28
|
+
|
|
25
29
|
def mouse_tracking? = !read(:uint8, Library::TERMINAL_DATA_MOUSE_TRACKING).zero?
|
|
26
30
|
|
|
27
31
|
def scrollback_size = read(:size_t, Library::TERMINAL_DATA_SCROLLBACK_ROWS)
|
|
@@ -63,7 +67,7 @@ module Hostty
|
|
|
63
67
|
CELL_HEIGHT = 16
|
|
64
68
|
private_constant :SCROLLBACK_LINES, :SCROLLBACK_BYTES, :CELL_WIDTH, :CELL_HEIGHT
|
|
65
69
|
|
|
66
|
-
attr_reader :reply, :rows, :cols, :terminal, :frame, :mouse
|
|
70
|
+
attr_reader :reply, :bell, :rows, :cols, :terminal, :frame, :mouse
|
|
67
71
|
|
|
68
72
|
def limit_scrollback
|
|
69
73
|
set_size(Library::TERMINAL_OPT_SCROLLBACK_MAX_LINES, SCROLLBACK_LINES)
|
|
@@ -82,6 +86,11 @@ module Hostty
|
|
|
82
86
|
Library.ghostty_terminal_set(terminal, Library::TERMINAL_OPT_WRITE_PTY, @write_pty)
|
|
83
87
|
end
|
|
84
88
|
|
|
89
|
+
def send_bells
|
|
90
|
+
@ring = FFI::Function.new(:void, %i[pointer pointer]) { |_terminal, _userdata| bell&.call }
|
|
91
|
+
Library.ghostty_terminal_set(terminal, Library::TERMINAL_OPT_BELL, @ring)
|
|
92
|
+
end
|
|
93
|
+
|
|
85
94
|
def read(type, data)
|
|
86
95
|
value = FFI::MemoryPointer.new(type)
|
|
87
96
|
Library.ghostty_terminal_get(terminal, data, value)
|
data/lib/hostty/tui/app.rb
CHANGED
|
@@ -13,6 +13,7 @@ module Hostty
|
|
|
13
13
|
@input = Input.new
|
|
14
14
|
@renderer = Renderer.new(io: stdout)
|
|
15
15
|
@outer_modes = {}
|
|
16
|
+
@focused = true
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
def launch_for(process)
|
|
@@ -24,6 +25,7 @@ module Hostty
|
|
|
24
25
|
until @exit_code
|
|
25
26
|
wait_for_io(manager)
|
|
26
27
|
autoscroll_when_due
|
|
28
|
+
blink_when_due
|
|
27
29
|
check_size
|
|
28
30
|
render_when_due
|
|
29
31
|
end
|
|
@@ -41,15 +43,18 @@ module Hostty
|
|
|
41
43
|
AUTOSCROLL_SECONDS = 0.025
|
|
42
44
|
AUTOSCROLL_SPEEDUP_SECONDS = 0.5
|
|
43
45
|
AUTOSCROLL_MAX_LINES = 10
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
BLINK_SECONDS = 0.5
|
|
47
|
+
ENTER = "\e[?1049h\e[?1002h\e[?1006h\e[?1004h\e[?25l\e[2J"
|
|
48
|
+
LEAVE = "\e[?1004l\e[?1006l\e[?1002l\e[?2004l\e[?1l\e[0m\e[?25h\e[?1049l"
|
|
46
49
|
OUTER_MODES = {application_cursor_keys?: 1, bracketed_paste?: 2004}.freeze
|
|
47
|
-
private_constant :FRAME_SECONDS, :IDLE_SECONDS, :DOUBLE_PRESS_SECONDS, :SCROLL_LINES, :AUTOSCROLL_SECONDS, :AUTOSCROLL_SPEEDUP_SECONDS, :AUTOSCROLL_MAX_LINES, :ENTER, :LEAVE, :OUTER_MODES
|
|
50
|
+
private_constant :FRAME_SECONDS, :IDLE_SECONDS, :DOUBLE_PRESS_SECONDS, :SCROLL_LINES, :AUTOSCROLL_SECONDS, :AUTOSCROLL_SPEEDUP_SECONDS, :AUTOSCROLL_MAX_LINES, :BLINK_SECONDS, :ENTER, :LEAVE, :OUTER_MODES
|
|
48
51
|
|
|
49
52
|
attr_reader :stdin, :stdout, :desktop, :rows, :cols, :panes, :input, :renderer
|
|
50
53
|
|
|
51
54
|
def selected = panes[@selected]
|
|
52
55
|
|
|
56
|
+
def bell? = panes.any?(&:bell?)
|
|
57
|
+
|
|
53
58
|
def layout
|
|
54
59
|
@layout ||= Layout.new(names: panes.map(&:name), rows:, cols:)
|
|
55
60
|
end
|
|
@@ -94,6 +99,9 @@ module Hostty
|
|
|
94
99
|
interrupt(bytes)
|
|
95
100
|
in [:next_tab]
|
|
96
101
|
@selected = (@selected + 1) % panes.size
|
|
102
|
+
in [:focus, focused]
|
|
103
|
+
@focused = focused
|
|
104
|
+
selected.send_focus(focused)
|
|
97
105
|
in [:keys, bytes]
|
|
98
106
|
selected.write(bytes)
|
|
99
107
|
in [:mouse, mouse]
|
|
@@ -147,6 +155,18 @@ module Hostty
|
|
|
147
155
|
@dirty = true
|
|
148
156
|
end
|
|
149
157
|
|
|
158
|
+
def blink_when_due
|
|
159
|
+
return unless bell? && clock - @blinked_at.to_f >= BLINK_SECONDS
|
|
160
|
+
|
|
161
|
+
@blinked_at = clock
|
|
162
|
+
renderer.blink
|
|
163
|
+
@dirty = true
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
def blink_wait
|
|
167
|
+
(@blinked_at.to_f + BLINK_SECONDS - clock).clamp(0, BLINK_SECONDS)
|
|
168
|
+
end
|
|
169
|
+
|
|
150
170
|
def autoscroll_lines
|
|
151
171
|
(1 + ((clock - @autoscroll_started_at) / AUTOSCROLL_SPEEDUP_SECONDS).floor).clamp(1, AUTOSCROLL_MAX_LINES)
|
|
152
172
|
end
|
|
@@ -213,6 +233,7 @@ module Hostty
|
|
|
213
233
|
|
|
214
234
|
pane = panes.find { |candidate| candidate.name == event.name }
|
|
215
235
|
pane.exited(event.exit_code)
|
|
236
|
+
relay_bell(pane)
|
|
216
237
|
manager.start(pane.name) if pane.take_restart_request
|
|
217
238
|
@dirty = true
|
|
218
239
|
end
|
|
@@ -222,6 +243,14 @@ module Hostty
|
|
|
222
243
|
return unless pane
|
|
223
244
|
|
|
224
245
|
@dirty = true if pane.read && pane.equal?(selected)
|
|
246
|
+
relay_bell(pane)
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
def relay_bell(pane)
|
|
250
|
+
return unless pane.take_ring
|
|
251
|
+
|
|
252
|
+
desktop.ring unless @focused
|
|
253
|
+
@dirty = true
|
|
225
254
|
end
|
|
226
255
|
|
|
227
256
|
def quit
|
|
@@ -243,6 +272,7 @@ module Hostty
|
|
|
243
272
|
return unless @dirty && frame_due?
|
|
244
273
|
|
|
245
274
|
sync_outer_modes
|
|
275
|
+
selected.clear_bell
|
|
246
276
|
renderer.render(layout:, panes:, selected:)
|
|
247
277
|
@dirty = false
|
|
248
278
|
@rendered_at = clock
|
|
@@ -254,6 +284,7 @@ module Hostty
|
|
|
254
284
|
|
|
255
285
|
def select_timeout
|
|
256
286
|
return AUTOSCROLL_SECONDS if @selecting && @autoscroll && !@dirty
|
|
287
|
+
return blink_wait if bell? && !@dirty
|
|
257
288
|
return IDLE_SECONDS unless @dirty
|
|
258
289
|
|
|
259
290
|
[FRAME_SECONDS - (clock - (@rendered_at || 0)), 0].max
|
data/lib/hostty/tui/desktop.rb
CHANGED
data/lib/hostty/tui/input.rb
CHANGED
|
@@ -18,13 +18,15 @@ module Hostty
|
|
|
18
18
|
|
|
19
19
|
CTRL_C = "\x03".b
|
|
20
20
|
SHIFT_TAB = "\e[Z".b
|
|
21
|
-
|
|
21
|
+
FOCUS_IN = "\e[I".b
|
|
22
|
+
FOCUS_OUT = "\e[O".b
|
|
23
|
+
SPECIAL = /\x03|\e\[<|\e\[[ZIO]/n
|
|
22
24
|
MOUSE = /\A\e\[<(\d+);(\d+);(\d+)([Mm])/n
|
|
23
25
|
INCOMPLETE_MOUSE = /\A\e\[<[\d;]*\z/n
|
|
24
26
|
BUTTONS = [:left, :middle, :right, nil].freeze
|
|
25
27
|
WHEEL_BUTTONS = [:wheel_up, :wheel_down, nil, nil].freeze
|
|
26
28
|
MODIFIER_BITS = {shift: 4, alt: 8, ctrl: 16}.freeze
|
|
27
|
-
private_constant :CTRL_C, :SHIFT_TAB, :SPECIAL, :MOUSE, :INCOMPLETE_MOUSE, :BUTTONS, :WHEEL_BUTTONS, :MODIFIER_BITS
|
|
29
|
+
private_constant :CTRL_C, :SHIFT_TAB, :FOCUS_IN, :FOCUS_OUT, :SPECIAL, :MOUSE, :INCOMPLETE_MOUSE, :BUTTONS, :WHEEL_BUTTONS, :MODIFIER_BITS
|
|
28
30
|
|
|
29
31
|
def incomplete_mouse?
|
|
30
32
|
INCOMPLETE_MOUSE.match?(@pending)
|
|
@@ -35,6 +37,8 @@ module Hostty
|
|
|
35
37
|
return [:keys, take(index || @pending.size)] unless index&.zero?
|
|
36
38
|
return [:interrupt, take(1)] if @pending.start_with?(CTRL_C)
|
|
37
39
|
return take(SHIFT_TAB.size) && [:next_tab] if @pending.start_with?(SHIFT_TAB)
|
|
40
|
+
return take(FOCUS_IN.size) && [:focus, true] if @pending.start_with?(FOCUS_IN)
|
|
41
|
+
return take(FOCUS_OUT.size) && [:focus, false] if @pending.start_with?(FOCUS_OUT)
|
|
38
42
|
|
|
39
43
|
match = MOUSE.match(@pending)
|
|
40
44
|
return [:keys, take(@pending.size)] unless match
|
data/lib/hostty/tui/pane.rb
CHANGED
|
@@ -11,13 +11,17 @@ module Hostty
|
|
|
11
11
|
@rows = rows
|
|
12
12
|
@cols = cols
|
|
13
13
|
@pty = Pty.new
|
|
14
|
-
@screen = Ghostty::Screen.new(rows:, cols:, reply: pty)
|
|
14
|
+
@screen = Ghostty::Screen.new(rows:, cols:, reply: pty, bell: method(:ring))
|
|
15
15
|
@offset = 0
|
|
16
16
|
@running = false
|
|
17
|
+
@bell = false
|
|
18
|
+
@rang = false
|
|
17
19
|
end
|
|
18
20
|
|
|
19
21
|
def running? = @running
|
|
20
22
|
|
|
23
|
+
def bell? = @bell
|
|
24
|
+
|
|
21
25
|
def io = pty.reader
|
|
22
26
|
|
|
23
27
|
def start(process)
|
|
@@ -43,6 +47,10 @@ module Hostty
|
|
|
43
47
|
pty.write(data)
|
|
44
48
|
end
|
|
45
49
|
|
|
50
|
+
def send_focus(focused)
|
|
51
|
+
pty.write(focused ? "\e[I" : "\e[O") if screen.focus_events?
|
|
52
|
+
end
|
|
53
|
+
|
|
46
54
|
def send_mouse(event)
|
|
47
55
|
bytes = screen.encode_mouse(event)
|
|
48
56
|
write(bytes) unless bytes.empty?
|
|
@@ -79,6 +87,14 @@ module Hostty
|
|
|
79
87
|
@restart_requested.tap { @restart_requested = false }
|
|
80
88
|
end
|
|
81
89
|
|
|
90
|
+
def take_ring
|
|
91
|
+
@rang.tap { @rang = false }
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def clear_bell
|
|
95
|
+
@bell = false
|
|
96
|
+
end
|
|
97
|
+
|
|
82
98
|
def scroll(lines)
|
|
83
99
|
@offset = (offset + lines).clamp(0, screen.scrollback_size)
|
|
84
100
|
end
|
|
@@ -117,6 +133,11 @@ module Hostty
|
|
|
117
133
|
end
|
|
118
134
|
end
|
|
119
135
|
|
|
136
|
+
def ring
|
|
137
|
+
@bell = true
|
|
138
|
+
@rang = true
|
|
139
|
+
end
|
|
140
|
+
|
|
120
141
|
def notify(text)
|
|
121
142
|
screen.feed("\e[0m\r\n#{text}\e[0m\r\n")
|
|
122
143
|
end
|
data/lib/hostty/tui/renderer.rb
CHANGED
|
@@ -12,6 +12,10 @@ module Hostty
|
|
|
12
12
|
@previous = []
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
+
def blink
|
|
16
|
+
@blink_hidden = !@blink_hidden
|
|
17
|
+
end
|
|
18
|
+
|
|
15
19
|
def render(layout:, panes:, selected:)
|
|
16
20
|
rows = [tab_row(layout, panes, selected), *pane_rows(selected), help_row(layout, selected)]
|
|
17
21
|
frame = +""
|
|
@@ -26,8 +30,9 @@ module Hostty
|
|
|
26
30
|
SELECTED_TAB = "\e[0;1;97;48;5;24m"
|
|
27
31
|
RUNNING_DOT = "\e[32m"
|
|
28
32
|
EXITED_DOT = "\e[31m"
|
|
33
|
+
BELL_DOT = "\e[33m"
|
|
29
34
|
RESET = "\e[0m"
|
|
30
|
-
private_constant :BAR, :SELECTED_TAB, :RUNNING_DOT, :EXITED_DOT, :RESET
|
|
35
|
+
private_constant :BAR, :SELECTED_TAB, :RUNNING_DOT, :EXITED_DOT, :BELL_DOT, :RESET
|
|
31
36
|
|
|
32
37
|
attr_reader :io
|
|
33
38
|
|
|
@@ -41,8 +46,13 @@ module Hostty
|
|
|
41
46
|
|
|
42
47
|
def tab_label(pane, selected)
|
|
43
48
|
style = pane.equal?(selected) ? SELECTED_TAB : BAR
|
|
44
|
-
dot
|
|
45
|
-
|
|
49
|
+
"#{style} #{dot(pane)}#{style} #{pane.name} "
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def dot(pane)
|
|
53
|
+
return "#{BELL_DOT}#{@blink_hidden ? " " : "●"}" if pane.bell?
|
|
54
|
+
|
|
55
|
+
"#{pane.running? ? RUNNING_DOT : EXITED_DOT}●"
|
|
46
56
|
end
|
|
47
57
|
|
|
48
58
|
def pane_rows(pane)
|
data/lib/hostty/version.rb
CHANGED