Add mouse support to the TUI (tmux-style tile resize)
Enable mouse in the Bubble Tea program. In the layout grid editor: click a cell to assign a camera, or press on a tile and drag to resize its span (grid-snapped). Click-to-select on the menu/list screens and the camera picker. Works over SSH; edits the config, so it never fights the daemon geometry. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -60,6 +60,11 @@ type model struct {
|
||||
editLayout int // index into cfg.Layouts for edit/picker screens
|
||||
edCol, edRow int // grid-editor cursor position
|
||||
|
||||
// Mouse drag state for tmux-style tile resizing in the grid editor.
|
||||
dragging bool
|
||||
dragTile int
|
||||
dragMoved bool
|
||||
|
||||
status string
|
||||
isError bool
|
||||
}
|
||||
@@ -71,7 +76,7 @@ func Run(cfgPath string) error {
|
||||
return err
|
||||
}
|
||||
m := &model{cfgPath: cfgPath, cfg: cfg, screen: screenMenu}
|
||||
_, err = tea.NewProgram(m, tea.WithAltScreen()).Run()
|
||||
_, err = tea.NewProgram(m, tea.WithAltScreen(), tea.WithMouseCellMotion()).Run()
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -141,6 +146,8 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
m.setStatus("saved to "+m.cfgPath, false)
|
||||
}
|
||||
return m, nil
|
||||
case tea.MouseMsg:
|
||||
return m.handleMouse(msg)
|
||||
case tea.KeyMsg:
|
||||
return m.handleKey(msg)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user