hostty 0.1.2.alpha-aarch64-linux-gnu → 1.0.0-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/docs/assets/demo.svg +68 -13
- data/docs/development/README.md +2 -1
- data/docs/development/architecture.md +15 -11
- data/lib/hostty/cli.rb +1 -1
- data/lib/hostty/config/loader/process_definition.rb +56 -0
- data/lib/hostty/config/loader.rb +78 -0
- data/lib/hostty/config/rules/command.rb +22 -0
- data/lib/hostty/config/rules/domain.rb +24 -0
- data/lib/hostty/config/rules/env.rb +22 -0
- data/lib/hostty/config/rules/known_settings.rb +27 -0
- data/lib/hostty/config/rules/path_settings.rb +29 -0
- data/lib/hostty/config/rules/port_setting.rb +27 -0
- data/lib/hostty/config/rules/process_list.rb +24 -0
- data/lib/hostty/config/rules/process_settings.rb +22 -0
- data/lib/hostty/config/rules/settings_list.rb +22 -0
- data/lib/hostty/config/rules/skip_used_ports.rb +21 -0
- data/lib/hostty/config/rules/text.rb +21 -0
- data/lib/hostty/config/rules/unique_domains.rb +30 -0
- data/lib/hostty/config/validator.rb +22 -0
- data/lib/hostty/config.rb +4 -67
- data/lib/hostty/domains/nginx_options.rb +37 -0
- data/lib/hostty/domains.rb +1 -1
- data/lib/hostty/ghostty/cell_reader.rb +68 -0
- data/lib/hostty/ghostty/frame.rb +7 -149
- data/lib/hostty/ghostty/raw_cell.rb +43 -0
- data/lib/hostty/ghostty/screen.rb +3 -0
- data/lib/hostty/ghostty/style_decoder.rb +44 -0
- data/lib/hostty/process_config.rb +15 -67
- data/lib/hostty/terminal/cell.rb +2 -2
- data/lib/hostty/terminal/flyweight.rb +19 -0
- data/lib/hostty/terminal/style.rb +3 -5
- data/lib/hostty/tui/activity.rb +26 -0
- data/lib/hostty/tui/app.rb +43 -254
- data/lib/hostty/tui/bell.rb +30 -0
- data/lib/hostty/tui/blink.rb +36 -0
- data/lib/hostty/tui/canvas.rb +51 -0
- data/lib/hostty/tui/clock.rb +9 -0
- data/lib/hostty/tui/controls.rb +59 -0
- data/lib/hostty/tui/display.rb +27 -0
- data/lib/hostty/tui/events/focus.rb +19 -0
- data/lib/hostty/tui/events/interrupt.rb +19 -0
- data/lib/hostty/tui/events/keys.rb +19 -0
- data/lib/hostty/tui/events/mouse_report.rb +19 -0
- data/lib/hostty/tui/events/next_tab.rb +11 -0
- data/lib/hostty/tui/input.rb +7 -7
- data/lib/hostty/tui/layout.rb +8 -49
- data/lib/hostty/tui/lifecycle/exited.rb +20 -0
- data/lib/hostty/tui/lifecycle/pending.rb +17 -0
- data/lib/hostty/tui/lifecycle/restarting.rb +20 -0
- data/lib/hostty/tui/lifecycle/running.rb +20 -0
- data/lib/hostty/tui/lifecycle.rb +38 -0
- data/lib/hostty/tui/mouse/idle.rb +37 -0
- data/lib/hostty/tui/mouse/pointer.rb +45 -0
- data/lib/hostty/tui/mouse/selecting.rb +67 -0
- data/lib/hostty/tui/mouse/target.rb +78 -0
- data/lib/hostty/tui/outcome.rb +15 -0
- data/lib/hostty/tui/outer_modes.rb +29 -0
- data/lib/hostty/tui/pane.rb +30 -42
- data/lib/hostty/tui/reactor.rb +20 -0
- data/lib/hostty/tui/regions/help_bar.rb +48 -0
- data/lib/hostty/tui/regions/palette.rb +12 -0
- data/lib/hostty/tui/regions/pane_view.rb +60 -0
- data/lib/hostty/tui/regions/tab_bar.rb +100 -0
- data/lib/hostty/tui/renderer.rb +6 -67
- data/lib/hostty/tui/sources/manager_events.rb +31 -0
- data/lib/hostty/tui/sources/stdin.rb +33 -0
- data/lib/hostty/tui/tabs.rb +40 -0
- data/lib/hostty/tui/timer.rb +33 -0
- data/lib/hostty/tui/window.rb +32 -0
- data/lib/hostty/version.rb +1 -1
- data/lib/hostty.rb +50 -0
- metadata +54 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hostty
|
|
4
|
+
module Tui
|
|
5
|
+
module Regions
|
|
6
|
+
class HelpBar
|
|
7
|
+
def initialize(tabs:, layout:, manager:)
|
|
8
|
+
@tabs = tabs
|
|
9
|
+
@layout = layout
|
|
10
|
+
@manager = manager
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def cursor = nil
|
|
14
|
+
|
|
15
|
+
def rows
|
|
16
|
+
text = help_text[0, layout.cols].ljust(layout.cols)
|
|
17
|
+
["#{Palette::BAR}#{text.sub(RESTART_BUTTON, "\e[1;97m#{RESTART_BUTTON}#{Palette::BAR}")}#{Palette::RESET}"]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def press(row:, col:)
|
|
21
|
+
return false unless restart_at?(row:, col:)
|
|
22
|
+
|
|
23
|
+
selected.restart(manager)
|
|
24
|
+
true
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
RESTART_BUTTON = "[restart]"
|
|
30
|
+
private_constant :RESTART_BUTTON
|
|
31
|
+
|
|
32
|
+
attr_reader :tabs, :layout, :manager
|
|
33
|
+
|
|
34
|
+
def selected = tabs.selected
|
|
35
|
+
|
|
36
|
+
def restart_at?(row:, col:)
|
|
37
|
+
start = help_text.index(RESTART_BUTTON)
|
|
38
|
+
row == layout.rows - 1 && (start...(start + RESTART_BUTTON.length)).cover?(col)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def help_text
|
|
42
|
+
scroll = selected.offset.positive? ? "Scrolled up #{selected.offset}" : "Scroll: history"
|
|
43
|
+
" Switch: click or Shift+Tab | #{scroll} | #{RESTART_BUTTON} | Quit: Ctrl-C twice "
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hostty
|
|
4
|
+
module Tui
|
|
5
|
+
module Regions
|
|
6
|
+
class PaneView
|
|
7
|
+
def initialize(tabs:, layout:)
|
|
8
|
+
@tabs = tabs
|
|
9
|
+
@layout = layout
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def rows
|
|
13
|
+
pane = tabs.selected
|
|
14
|
+
pane.lines.each_with_index.map { |cells, row| line_text(cells, pane.selected_columns(row, cells.size)) }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def press(row:, col:)
|
|
18
|
+
return false unless layout.pane_row?(row)
|
|
19
|
+
|
|
20
|
+
point = layout.pane_point(row:, col:)
|
|
21
|
+
tabs.selected.select_from(**point)
|
|
22
|
+
yield point
|
|
23
|
+
true
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def cursor
|
|
27
|
+
pane = tabs.selected
|
|
28
|
+
position = pane.screen.cursor
|
|
29
|
+
return unless pane.running? && pane.offset.zero? && position
|
|
30
|
+
|
|
31
|
+
[position[0] + 1, position[1]]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
private
|
|
35
|
+
|
|
36
|
+
attr_reader :tabs, :layout
|
|
37
|
+
|
|
38
|
+
def line_text(cells, selected_columns)
|
|
39
|
+
style = nil
|
|
40
|
+
text = +""
|
|
41
|
+
|
|
42
|
+
cells.each_with_index do |cell, col|
|
|
43
|
+
next if cell.continuation?
|
|
44
|
+
|
|
45
|
+
cell_style = selected_columns&.cover?(col) ? highlight(cell.style) : cell.style
|
|
46
|
+
text << cell_style.sgr unless cell_style.equal?(style)
|
|
47
|
+
style = cell_style
|
|
48
|
+
text << cell.char
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
text << Palette::RESET
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def highlight(style)
|
|
55
|
+
Terminal::Style.shared(style.to_h.merge(inverse: !style.inverse))
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hostty
|
|
4
|
+
module Tui
|
|
5
|
+
module Regions
|
|
6
|
+
class TabBar
|
|
7
|
+
def initialize(tabs:, layout:, desktop:)
|
|
8
|
+
@tabs = tabs
|
|
9
|
+
@layout = layout
|
|
10
|
+
@desktop = desktop
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def cursor = nil
|
|
14
|
+
|
|
15
|
+
def rows
|
|
16
|
+
spans = tab_spans
|
|
17
|
+
[tab_row(spans, url_start(spans))]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def press(row:, col:)
|
|
21
|
+
return false unless row.zero?
|
|
22
|
+
|
|
23
|
+
spans = tab_spans
|
|
24
|
+
select_tab(spans, col) || open_url(spans, col)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def blink
|
|
28
|
+
@blink_hidden = !@blink_hidden
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
SELECTED_TAB = "\e[0;1;97;48;5;24m"
|
|
34
|
+
RUNNING_DOT = "\e[32m"
|
|
35
|
+
EXITED_DOT = "\e[31m"
|
|
36
|
+
BELL_DOT = "\e[33m"
|
|
37
|
+
private_constant :SELECTED_TAB, :RUNNING_DOT, :EXITED_DOT, :BELL_DOT
|
|
38
|
+
|
|
39
|
+
attr_reader :tabs, :layout, :desktop
|
|
40
|
+
|
|
41
|
+
def selected = tabs.selected
|
|
42
|
+
|
|
43
|
+
def tabs_width(spans) = spans.sum { |span| span[:width] }
|
|
44
|
+
|
|
45
|
+
def tab_spans
|
|
46
|
+
start = 0
|
|
47
|
+
|
|
48
|
+
tabs.each_with_index.filter_map do |pane, index|
|
|
49
|
+
width = pane.name.length + 4
|
|
50
|
+
next if start + width > layout.cols
|
|
51
|
+
|
|
52
|
+
{index:, pane:, start:, width:}.tap { start += width }
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def url_start(spans)
|
|
57
|
+
url = selected.url
|
|
58
|
+
return unless url
|
|
59
|
+
|
|
60
|
+
start = layout.cols - url.length - 1
|
|
61
|
+
start if start > tabs_width(spans)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def tab_row(spans, start)
|
|
65
|
+
text = spans.map { |span| tab_label(span[:pane]) }.join
|
|
66
|
+
return "#{text}#{Palette::BAR}#{" " * (layout.cols - tabs_width(spans))}#{Palette::RESET}" unless start
|
|
67
|
+
|
|
68
|
+
"#{text}#{Palette::BAR}#{" " * (start - tabs_width(spans))}#{selected.url} #{Palette::RESET}"
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def tab_label(pane)
|
|
72
|
+
style = pane.equal?(selected) ? SELECTED_TAB : Palette::BAR
|
|
73
|
+
"#{style} #{dot(pane)}#{style} #{pane.name} "
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def dot(pane)
|
|
77
|
+
return "#{BELL_DOT}#{@blink_hidden ? " " : "●"}" if pane.bell?
|
|
78
|
+
|
|
79
|
+
"#{pane.running? ? RUNNING_DOT : EXITED_DOT}●"
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def select_tab(spans, col)
|
|
83
|
+
span = spans.find { |candidate| (candidate[:start]...candidate[:start] + candidate[:width]).cover?(col) }
|
|
84
|
+
return false unless span
|
|
85
|
+
|
|
86
|
+
tabs.select_at(span[:index])
|
|
87
|
+
true
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def open_url(spans, col)
|
|
91
|
+
start = url_start(spans)
|
|
92
|
+
return false unless start && (start...(start + selected.url.length)).cover?(col)
|
|
93
|
+
|
|
94
|
+
desktop.open(selected.url)
|
|
95
|
+
true
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
data/lib/hostty/tui/renderer.rb
CHANGED
|
@@ -12,83 +12,22 @@ module Hostty
|
|
|
12
12
|
@previous = []
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
def
|
|
16
|
-
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def render(layout:, panes:, selected:)
|
|
20
|
-
rows = [tab_row(layout, panes, selected), *pane_rows(selected), help_row(layout, selected)]
|
|
15
|
+
def render(display)
|
|
16
|
+
rows = display.rows
|
|
21
17
|
frame = +""
|
|
22
18
|
rows.each_with_index { |row, index| frame << "\e[#{index + 1};1H#{row}" unless @previous[index] == row }
|
|
23
19
|
@previous = rows
|
|
24
|
-
io.write(frame << cursor(
|
|
20
|
+
io.write(frame << cursor(display.cursor))
|
|
25
21
|
end
|
|
26
22
|
|
|
27
23
|
private
|
|
28
24
|
|
|
29
|
-
BAR = "\e[0;37;48;5;236m"
|
|
30
|
-
SELECTED_TAB = "\e[0;1;97;48;5;24m"
|
|
31
|
-
RUNNING_DOT = "\e[32m"
|
|
32
|
-
EXITED_DOT = "\e[31m"
|
|
33
|
-
BELL_DOT = "\e[33m"
|
|
34
|
-
RESET = "\e[0m"
|
|
35
|
-
private_constant :BAR, :SELECTED_TAB, :RUNNING_DOT, :EXITED_DOT, :BELL_DOT, :RESET
|
|
36
|
-
|
|
37
25
|
attr_reader :io
|
|
38
26
|
|
|
39
|
-
def
|
|
40
|
-
|
|
41
|
-
start = layout.url_start(selected.url)
|
|
42
|
-
return "#{text}#{BAR}#{" " * (layout.cols - layout.tabs_width)}#{RESET}" unless start
|
|
43
|
-
|
|
44
|
-
"#{text}#{BAR}#{" " * (start - layout.tabs_width)}#{selected.url} #{RESET}"
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def tab_label(pane, selected)
|
|
48
|
-
style = pane.equal?(selected) ? SELECTED_TAB : BAR
|
|
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}●"
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def pane_rows(pane)
|
|
59
|
-
pane.lines.each_with_index.map { |cells, row| line_text(cells, pane.selected_columns(row, cells.size)) }
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
def line_text(cells, selected_columns)
|
|
63
|
-
style = nil
|
|
64
|
-
text = +""
|
|
65
|
-
|
|
66
|
-
cells.each_with_index do |cell, col|
|
|
67
|
-
next if cell.continuation?
|
|
68
|
-
|
|
69
|
-
cell_style = selected_columns&.cover?(col) ? highlight(cell.style) : cell.style
|
|
70
|
-
text << cell_style.sgr unless cell_style.equal?(style)
|
|
71
|
-
style = cell_style
|
|
72
|
-
text << cell.char
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
text << RESET
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
def highlight(style)
|
|
79
|
-
Terminal::Style.shared(style.to_h.merge(inverse: !style.inverse))
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def help_row(layout, pane)
|
|
83
|
-
text = layout.help_text(offset: pane.offset)[0, layout.cols].ljust(layout.cols)
|
|
84
|
-
"#{BAR}#{text.sub(Layout::RESTART_BUTTON, "\e[1;97m#{Layout::RESTART_BUTTON}#{BAR}")}#{RESET}"
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def cursor(pane)
|
|
88
|
-
position = pane.screen.cursor
|
|
89
|
-
return "\e[?25l" unless pane.running? && pane.offset.zero? && position
|
|
27
|
+
def cursor(position)
|
|
28
|
+
return "\e[?25l" unless position
|
|
90
29
|
|
|
91
|
-
"\e[#{position[0] +
|
|
30
|
+
"\e[#{position[0] + 1};#{position[1] + 1}H\e[?25h"
|
|
92
31
|
end
|
|
93
32
|
end
|
|
94
33
|
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hostty
|
|
4
|
+
module Tui
|
|
5
|
+
module Sources
|
|
6
|
+
class ManagerEvents
|
|
7
|
+
def initialize(manager:, tabs:, canvas:, outcome:)
|
|
8
|
+
@manager = manager
|
|
9
|
+
@tabs = tabs
|
|
10
|
+
@canvas = canvas
|
|
11
|
+
@outcome = outcome
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def io = manager.wakeup_io
|
|
15
|
+
|
|
16
|
+
def read
|
|
17
|
+
while (event = manager.next_event(timeout: 0))
|
|
18
|
+
return outcome.decide(event.exit_code) if event.interrupt?
|
|
19
|
+
|
|
20
|
+
tabs.named(event.name).exited(event.exit_code, manager:)
|
|
21
|
+
canvas.invalidate
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
attr_reader :manager, :tabs, :canvas, :outcome
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hostty
|
|
4
|
+
module Tui
|
|
5
|
+
module Sources
|
|
6
|
+
class Stdin
|
|
7
|
+
attr_reader :io
|
|
8
|
+
|
|
9
|
+
def initialize(io:, controls:, canvas:, outcome:)
|
|
10
|
+
@io = io
|
|
11
|
+
@controls = controls
|
|
12
|
+
@canvas = canvas
|
|
13
|
+
@outcome = outcome
|
|
14
|
+
@input = Input.new
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def read
|
|
18
|
+
data = io.read_nonblock(4096, exception: false)
|
|
19
|
+
return if data == :wait_readable
|
|
20
|
+
return outcome.decide(0) unless data
|
|
21
|
+
|
|
22
|
+
input.parse(data).each { |event| event.apply(controls) }
|
|
23
|
+
outcome.decide(0) if controls.quit?
|
|
24
|
+
canvas.invalidate
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
attr_reader :controls, :canvas, :outcome, :input
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hostty
|
|
4
|
+
module Tui
|
|
5
|
+
class Tabs
|
|
6
|
+
include Enumerable
|
|
7
|
+
|
|
8
|
+
def initialize
|
|
9
|
+
@panes = []
|
|
10
|
+
@index = 0
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def selected?(pane) = selected.equal?(pane)
|
|
14
|
+
|
|
15
|
+
def selected = panes[index]
|
|
16
|
+
|
|
17
|
+
def each(&) = panes.each(&)
|
|
18
|
+
|
|
19
|
+
def add(pane)
|
|
20
|
+
panes << pane
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def select_next
|
|
24
|
+
@index = (index + 1) % panes.size
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def select_at(position)
|
|
28
|
+
@index = position
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def named(name)
|
|
32
|
+
find { |pane| pane.name == name }
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
private
|
|
36
|
+
|
|
37
|
+
attr_reader :panes, :index
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hostty
|
|
4
|
+
module Tui
|
|
5
|
+
class Timer
|
|
6
|
+
def initialize(seconds:, clock:)
|
|
7
|
+
@seconds = seconds
|
|
8
|
+
@clock = clock
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def wait
|
|
12
|
+
return 0 unless fired_at
|
|
13
|
+
|
|
14
|
+
(fired_at + seconds - clock.now).clamp(0, seconds)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def fire
|
|
18
|
+
return unless due?
|
|
19
|
+
|
|
20
|
+
yield
|
|
21
|
+
@fired_at = clock.now
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
attr_reader :seconds, :clock, :fired_at
|
|
27
|
+
|
|
28
|
+
def due?
|
|
29
|
+
fired_at.nil? || clock.now - fired_at >= seconds
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hostty
|
|
4
|
+
module Tui
|
|
5
|
+
class Window
|
|
6
|
+
def initialize(io:, layout:, tabs:, canvas:)
|
|
7
|
+
@io = io
|
|
8
|
+
@layout = layout
|
|
9
|
+
@tabs = tabs
|
|
10
|
+
@canvas = canvas
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def wait = IDLE_SECONDS
|
|
14
|
+
|
|
15
|
+
def tick
|
|
16
|
+
rows, cols = io.winsize
|
|
17
|
+
return if [rows, cols] == [layout.rows, layout.cols]
|
|
18
|
+
|
|
19
|
+
layout.resize(rows:, cols:)
|
|
20
|
+
tabs.each { |pane| pane.resize(rows: layout.pane_rows, cols:) }
|
|
21
|
+
canvas.reset
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
IDLE_SECONDS = 0.25
|
|
27
|
+
private_constant :IDLE_SECONDS
|
|
28
|
+
|
|
29
|
+
attr_reader :io, :layout, :tabs, :canvas
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
data/lib/hostty/version.rb
CHANGED
data/lib/hostty.rb
CHANGED
|
@@ -13,8 +13,25 @@ require_relative "hostty/port_chooser"
|
|
|
13
13
|
require_relative "hostty/nginx_template"
|
|
14
14
|
require_relative "hostty/process_config"
|
|
15
15
|
require_relative "hostty/config"
|
|
16
|
+
require_relative "hostty/config/validator"
|
|
17
|
+
require_relative "hostty/config/rules/text"
|
|
18
|
+
require_relative "hostty/config/rules/settings_list"
|
|
19
|
+
require_relative "hostty/config/rules/process_list"
|
|
20
|
+
require_relative "hostty/config/rules/known_settings"
|
|
21
|
+
require_relative "hostty/config/rules/skip_used_ports"
|
|
22
|
+
require_relative "hostty/config/rules/process_settings"
|
|
23
|
+
require_relative "hostty/config/rules/command"
|
|
24
|
+
require_relative "hostty/config/rules/port_setting"
|
|
25
|
+
require_relative "hostty/config/rules/domain"
|
|
26
|
+
require_relative "hostty/config/rules/path_settings"
|
|
27
|
+
require_relative "hostty/config/rules/env"
|
|
28
|
+
require_relative "hostty/config/rules/unique_domains"
|
|
29
|
+
require_relative "hostty/config/loader/process_definition"
|
|
30
|
+
require_relative "hostty/config/loader"
|
|
16
31
|
require_relative "hostty/output"
|
|
32
|
+
require_relative "hostty/domains/nginx_options"
|
|
17
33
|
require_relative "hostty/domains"
|
|
34
|
+
require_relative "hostty/terminal/flyweight"
|
|
18
35
|
require_relative "hostty/terminal/style"
|
|
19
36
|
require_relative "hostty/terminal/cell"
|
|
20
37
|
require_relative "hostty/manager/events"
|
|
@@ -24,13 +41,46 @@ require_relative "hostty/manager/child"
|
|
|
24
41
|
require_relative "hostty/manager"
|
|
25
42
|
require_relative "hostty/plain/pipe"
|
|
26
43
|
require_relative "hostty/plain/app"
|
|
44
|
+
require_relative "hostty/tui/clock"
|
|
45
|
+
require_relative "hostty/tui/timer"
|
|
46
|
+
require_relative "hostty/tui/outcome"
|
|
27
47
|
require_relative "hostty/tui/pty"
|
|
28
48
|
require_relative "hostty/tui/selection"
|
|
29
49
|
require_relative "hostty/tui/desktop"
|
|
50
|
+
require_relative "hostty/tui/bell"
|
|
51
|
+
require_relative "hostty/tui/lifecycle/pending"
|
|
52
|
+
require_relative "hostty/tui/lifecycle/running"
|
|
53
|
+
require_relative "hostty/tui/lifecycle/restarting"
|
|
54
|
+
require_relative "hostty/tui/lifecycle/exited"
|
|
55
|
+
require_relative "hostty/tui/lifecycle"
|
|
30
56
|
require_relative "hostty/tui/pane"
|
|
31
57
|
require_relative "hostty/tui/layout"
|
|
58
|
+
require_relative "hostty/tui/regions/palette"
|
|
59
|
+
require_relative "hostty/tui/regions/tab_bar"
|
|
60
|
+
require_relative "hostty/tui/regions/pane_view"
|
|
61
|
+
require_relative "hostty/tui/regions/help_bar"
|
|
62
|
+
require_relative "hostty/tui/display"
|
|
32
63
|
require_relative "hostty/tui/mouse_event"
|
|
64
|
+
require_relative "hostty/tui/tabs"
|
|
65
|
+
require_relative "hostty/tui/events/keys"
|
|
66
|
+
require_relative "hostty/tui/events/interrupt"
|
|
67
|
+
require_relative "hostty/tui/events/next_tab"
|
|
68
|
+
require_relative "hostty/tui/events/focus"
|
|
69
|
+
require_relative "hostty/tui/events/mouse_report"
|
|
70
|
+
require_relative "hostty/tui/mouse/target"
|
|
71
|
+
require_relative "hostty/tui/mouse/idle"
|
|
72
|
+
require_relative "hostty/tui/mouse/selecting"
|
|
73
|
+
require_relative "hostty/tui/mouse/pointer"
|
|
74
|
+
require_relative "hostty/tui/controls"
|
|
33
75
|
require_relative "hostty/tui/input"
|
|
34
76
|
require_relative "hostty/tui/renderer"
|
|
77
|
+
require_relative "hostty/tui/outer_modes"
|
|
78
|
+
require_relative "hostty/tui/canvas"
|
|
79
|
+
require_relative "hostty/tui/blink"
|
|
80
|
+
require_relative "hostty/tui/window"
|
|
81
|
+
require_relative "hostty/tui/activity"
|
|
82
|
+
require_relative "hostty/tui/sources/stdin"
|
|
83
|
+
require_relative "hostty/tui/sources/manager_events"
|
|
84
|
+
require_relative "hostty/tui/reactor"
|
|
35
85
|
require_relative "hostty/tui/app"
|
|
36
86
|
require_relative "hostty/cli"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hostty
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: aarch64-linux-gnu
|
|
6
6
|
authors:
|
|
7
7
|
- Bert McCutchen
|
|
@@ -71,13 +71,32 @@ files:
|
|
|
71
71
|
- lib/hostty.rb
|
|
72
72
|
- lib/hostty/cli.rb
|
|
73
73
|
- lib/hostty/config.rb
|
|
74
|
+
- lib/hostty/config/loader.rb
|
|
75
|
+
- lib/hostty/config/loader/process_definition.rb
|
|
76
|
+
- lib/hostty/config/rules/command.rb
|
|
77
|
+
- lib/hostty/config/rules/domain.rb
|
|
78
|
+
- lib/hostty/config/rules/env.rb
|
|
79
|
+
- lib/hostty/config/rules/known_settings.rb
|
|
80
|
+
- lib/hostty/config/rules/path_settings.rb
|
|
81
|
+
- lib/hostty/config/rules/port_setting.rb
|
|
82
|
+
- lib/hostty/config/rules/process_list.rb
|
|
83
|
+
- lib/hostty/config/rules/process_settings.rb
|
|
84
|
+
- lib/hostty/config/rules/settings_list.rb
|
|
85
|
+
- lib/hostty/config/rules/skip_used_ports.rb
|
|
86
|
+
- lib/hostty/config/rules/text.rb
|
|
87
|
+
- lib/hostty/config/rules/unique_domains.rb
|
|
88
|
+
- lib/hostty/config/validator.rb
|
|
74
89
|
- lib/hostty/domains.rb
|
|
90
|
+
- lib/hostty/domains/nginx_options.rb
|
|
75
91
|
- lib/hostty/exceptions.rb
|
|
92
|
+
- lib/hostty/ghostty/cell_reader.rb
|
|
76
93
|
- lib/hostty/ghostty/frame.rb
|
|
77
94
|
- lib/hostty/ghostty/libghostty-vt.so
|
|
78
95
|
- lib/hostty/ghostty/library.rb
|
|
79
96
|
- lib/hostty/ghostty/mouse.rb
|
|
97
|
+
- lib/hostty/ghostty/raw_cell.rb
|
|
80
98
|
- lib/hostty/ghostty/screen.rb
|
|
99
|
+
- lib/hostty/ghostty/style_decoder.rb
|
|
81
100
|
- lib/hostty/manager.rb
|
|
82
101
|
- lib/hostty/manager/child.rb
|
|
83
102
|
- lib/hostty/manager/events.rb
|
|
@@ -92,16 +111,50 @@ files:
|
|
|
92
111
|
- lib/hostty/templates/proxy.conf.erb
|
|
93
112
|
- lib/hostty/templates/rails.conf.erb
|
|
94
113
|
- lib/hostty/terminal/cell.rb
|
|
114
|
+
- lib/hostty/terminal/flyweight.rb
|
|
95
115
|
- lib/hostty/terminal/style.rb
|
|
116
|
+
- lib/hostty/tui/activity.rb
|
|
96
117
|
- lib/hostty/tui/app.rb
|
|
118
|
+
- lib/hostty/tui/bell.rb
|
|
119
|
+
- lib/hostty/tui/blink.rb
|
|
120
|
+
- lib/hostty/tui/canvas.rb
|
|
121
|
+
- lib/hostty/tui/clock.rb
|
|
122
|
+
- lib/hostty/tui/controls.rb
|
|
97
123
|
- lib/hostty/tui/desktop.rb
|
|
124
|
+
- lib/hostty/tui/display.rb
|
|
125
|
+
- lib/hostty/tui/events/focus.rb
|
|
126
|
+
- lib/hostty/tui/events/interrupt.rb
|
|
127
|
+
- lib/hostty/tui/events/keys.rb
|
|
128
|
+
- lib/hostty/tui/events/mouse_report.rb
|
|
129
|
+
- lib/hostty/tui/events/next_tab.rb
|
|
98
130
|
- lib/hostty/tui/input.rb
|
|
99
131
|
- lib/hostty/tui/layout.rb
|
|
132
|
+
- lib/hostty/tui/lifecycle.rb
|
|
133
|
+
- lib/hostty/tui/lifecycle/exited.rb
|
|
134
|
+
- lib/hostty/tui/lifecycle/pending.rb
|
|
135
|
+
- lib/hostty/tui/lifecycle/restarting.rb
|
|
136
|
+
- lib/hostty/tui/lifecycle/running.rb
|
|
137
|
+
- lib/hostty/tui/mouse/idle.rb
|
|
138
|
+
- lib/hostty/tui/mouse/pointer.rb
|
|
139
|
+
- lib/hostty/tui/mouse/selecting.rb
|
|
140
|
+
- lib/hostty/tui/mouse/target.rb
|
|
100
141
|
- lib/hostty/tui/mouse_event.rb
|
|
142
|
+
- lib/hostty/tui/outcome.rb
|
|
143
|
+
- lib/hostty/tui/outer_modes.rb
|
|
101
144
|
- lib/hostty/tui/pane.rb
|
|
102
145
|
- lib/hostty/tui/pty.rb
|
|
146
|
+
- lib/hostty/tui/reactor.rb
|
|
147
|
+
- lib/hostty/tui/regions/help_bar.rb
|
|
148
|
+
- lib/hostty/tui/regions/palette.rb
|
|
149
|
+
- lib/hostty/tui/regions/pane_view.rb
|
|
150
|
+
- lib/hostty/tui/regions/tab_bar.rb
|
|
103
151
|
- lib/hostty/tui/renderer.rb
|
|
104
152
|
- lib/hostty/tui/selection.rb
|
|
153
|
+
- lib/hostty/tui/sources/manager_events.rb
|
|
154
|
+
- lib/hostty/tui/sources/stdin.rb
|
|
155
|
+
- lib/hostty/tui/tabs.rb
|
|
156
|
+
- lib/hostty/tui/timer.rb
|
|
157
|
+
- lib/hostty/tui/window.rb
|
|
105
158
|
- lib/hostty/version.rb
|
|
106
159
|
- sig/hostty.rbs
|
|
107
160
|
homepage: https://github.com/bert-mccutchen/hostty
|