Compare commits

...
6 Commits
Author SHA1 Message Date
stefankoelle a0b937e882 release v0.3.3
Fix Windows Terminal mode issues.

- Fix split direction: use -H for top/bottom layout (opposite of tmux)
- Fix command quoting: use cmd /c to avoid Windows file-not-found errors
- Remove confusing tmux session closed message in wt mode
2026-09-16 21:44:37 +02:00
stefankoelle d32ccd5952 fix: avoid confusing tmux message in wt mode
Use c.Start() instead of tea.ExecProcess in startWtSession() to prevent
tmux session closed message from appearing in the main window.
2026-09-16 21:44:23 +02:00
stefankoelle 3729a0301d release v0.3.2
Windows Terminal native split-pane option.

- Add multiplexer config option to switch between tmux/psmux (default) and Windows Terminal's native split-pane
- Avoids the psmux focus-freeze issue when switching away from the terminal window on Windows
- Config: multiplexer: "tmux" (default) or "wt" for Windows Terminal
2026-09-16 21:12:26 +02:00
stefankoelle a1760b7b01 feat: add Windows Terminal native split-pane option
Add multiplexer config option to switch between tmux/psmux (default) and
Windows Terminal's native split-pane on Windows. This avoids the
psmux focus-freeze issue when switching away from the terminal window.

- Add Multiplexer field to config with MultiplexerBackend() getter
- Add startWtSession() using wt.exe split-pane command
- Dispatch startTmuxSession() based on OS and config
- Document option in config.example.yaml
2026-09-16 21:10:36 +02:00
stefankoelle bd23403e6c release v0.3.1
Compact menu layout and cross-env namespace discovery.

- Reduce menu item height from 3 rows to 1 (no description, no spacing) for denser display
- Merge namespaces from all configured envs so namespace-only-in-prod is no longer missing
2026-09-16 12:21:41 +02:00
stefankoelle 6a0405640d feat: compact menu layout and merge namespaces across all envs
- Reduce menu item height from 3 rows to 1 (no description, no spacing)
- Merge namespaces from all configured envs so namespace-only-in-prod is no longer missing
2026-09-16 12:18:17 +02:00
5 changed files with 98 additions and 20 deletions
+65 -18
View File
@@ -7,6 +7,7 @@ import (
"fmt"
"os"
"os/exec"
"runtime"
"sort"
tea "github.com/charmbracelet/bubbletea"
@@ -47,7 +48,7 @@ type fullModel struct {
}
func newFullModel() *fullModel {
l := list.New(nil, list.NewDefaultDelegate(), 0, 0)
l := list.New(nil, newCompactDelegate(), 0, 0)
l.Title = "kctl-tui"
l.SetShowStatusBar(false)
l.SetFilteringEnabled(false)
@@ -197,7 +198,11 @@ func (m *fullModel) handleSelect() (tea.Model, tea.Cmd) {
case screenNamespace:
m.selectedNamespace = item.value
if err := kubeexec.CheckTool("tmux"); err != nil {
tool := "tmux"
if runtime.GOOS == "windows" && m.cfg.MultiplexerBackend() == "wt" {
tool = "wt"
}
if err := kubeexec.CheckTool(tool); err != nil {
m.err = err
return m, nil
}
@@ -210,23 +215,21 @@ func (m *fullModel) handleSelect() (tea.Model, tea.Cmd) {
return m, nil
}
// bootstrapContext resolves a kubectl context purely to discover
// namespaces/labels for the team/namespace screens. The first configured
// env is used as a stable default for this discovery step, since
// namespace names are assumed to be identical across envs.
func (m *fullModel) bootstrapContext() string {
if len(m.cfg.Envs) == 0 {
return ""
}
return m.cfg.ResolveContext(m.cfg.Envs[0], m.selectedContext)
}
func (m *fullModel) loadTeams() tea.Msg {
namespaces, err := kubeexec.GetNamespacesWithLabels(m.bootstrapContext())
merged := map[string]map[string]string{}
for _, env := range m.cfg.Envs {
ctx := m.cfg.ResolveContext(env, m.selectedContext)
namespaces, err := kubeexec.GetNamespacesWithLabels(ctx)
if err != nil {
return errMsg{err}
continue
}
return *toTeamsLoadedMsg(namespaces, m.cfg.TeamLabelKey)
for ns, labels := range namespaces {
if _, exists := merged[ns]; !exists {
merged[ns] = labels
}
}
}
return *toTeamsLoadedMsg(merged, m.cfg.TeamLabelKey)
}
func (m *fullModel) loadTeamsFor(namespaces map[string]map[string]string) tea.Cmd {
@@ -264,12 +267,21 @@ func (m *fullModel) loadNamespacesFor(teamValue string) tea.Cmd {
}
}
// startTmuxSession builds the 3-pane tmux command: the control pane runs
// startTmuxSession builds the 3-pane session: the control pane runs
// this binary in "panel" mode (letting the user pick an env and an
// action), and the two status panes run k9s against the first two
// configured envs, resolved via the context template, so both are
// visible side by side.
// visible side by side. On Windows with multiplexer: "wt", this uses
// Windows Terminal's native split-pane instead of tmux/psmux.
func (m *fullModel) startTmuxSession() tea.Cmd {
if runtime.GOOS == "windows" && m.cfg.MultiplexerBackend() == "wt" {
return m.startWtSession()
}
return m.startTmuxSessionTmux()
}
// startTmuxSessionTmux creates the session using tmux/psmux.
func (m *fullModel) startTmuxSessionTmux() tea.Cmd {
selfPath, err := os.Executable()
if err != nil {
selfPath = "kctl-tui" // fallback to PATH lookup
@@ -321,6 +333,41 @@ func (m *fullModel) startTmuxSession() tea.Cmd {
})
}
// startWtSession creates the session using Windows Terminal's native
// split-pane feature. This avoids the psmux focus-freeze issue on Windows.
// Note: In Windows Terminal, -H (horizontal) stacks panes top/bottom,
// while -V (vertical) places them side by side — opposite of tmux.
func (m *fullModel) startWtSession() tea.Cmd {
selfPath, err := os.Executable()
if err != nil {
selfPath = "kctl-tui"
}
panelCmd := fmt.Sprintf("%s panel --context=%s --ns=%s --team=%s",
selfPath, m.selectedContext, m.selectedNamespace, m.selectedTeam)
envA := m.cfg.Envs[0]
ctxA := m.cfg.ResolveContext(envA, m.selectedContext)
k9sCmdA := fmt.Sprintf("k9s --context %s --namespace %s --command pods", ctxA, m.selectedNamespace)
kubeexec.VerboseLog("[debug] selfPath=%s\n", selfPath)
kubeexec.VerboseLog("[debug] panelCmd=%s\n", panelCmd)
kubeexec.VerboseLog("[debug] k9sCmdA=%s\n", k9sCmdA)
wtCmd := fmt.Sprintf("wt new-tab %s ; split-pane -H %s", panelCmd, k9sCmdA)
if len(m.cfg.Envs) > 1 {
envB := m.cfg.Envs[1]
ctxB := m.cfg.ResolveContext(envB, m.selectedContext)
k9sCmdB := fmt.Sprintf("k9s --context %s --namespace %s --command pods", ctxB, m.selectedNamespace)
kubeexec.VerboseLog("[debug] k9sCmdB=%s\n", k9sCmdB)
wtCmd += fmt.Sprintf(" ; split-pane -H %s", k9sCmdB)
}
c := exec.Command("cmd", "/c", wtCmd)
_ = c.Start()
return nil
}
func (m *fullModel) View() string {
view := m.list.View()
if m.statusMessage != "" {
+12
View File
@@ -3,6 +3,8 @@
package main
import "github.com/charmbracelet/bubbles/list"
// simpleItem is a minimal implementation of list.Item used for all
// selection screens (contexts, teams, namespaces, menu actions).
type simpleItem struct {
@@ -13,3 +15,13 @@ type simpleItem struct {
func (i simpleItem) Title() string { return i.label }
func (i simpleItem) Description() string { return "" }
func (i simpleItem) FilterValue() string { return i.label }
// newCompactDelegate returns a list delegate that renders each item as a
// single line with no extra spacing, maximizing the number of visible
// entries in the terminal.
func newCompactDelegate() list.DefaultDelegate {
d := list.NewDefaultDelegate()
d.ShowDescription = false
d.SetSpacing(0)
return d
}
+1 -1
View File
@@ -83,7 +83,7 @@ func newPanelModel(context, ns, team string) *panelModel {
cfgPath, _ := config.DefaultPath()
cfg, loadErr := config.Load(cfgPath)
l := list.New(nil, list.NewDefaultDelegate(), 0, 0)
l := list.New(nil, newCompactDelegate(), 0, 0)
l.SetShowStatusBar(false)
l.SetFilteringEnabled(false)
+5
View File
@@ -72,3 +72,8 @@ aws_sso_login_command: "aws sso login"
# Check for updates on startup and prompt to update if a newer version is
# available. Set to false to disable. Defaults to true if omitted.
# auto_update_check: true
# Terminal multiplexer backend. "tmux" (default) uses tmux/psmux.
# "wt" uses Windows Terminal's native split-pane — avoids the psmux
# focus-freeze issue on Windows. Only effective on Windows.
# multiplexer: "tmux"
+14
View File
@@ -73,6 +73,11 @@ type Config struct {
// AutoUpdateCheck controls whether kctl-tui checks for updates on
// startup. Defaults to true when omitted.
AutoUpdateCheck *bool `yaml:"auto_update_check"`
// Multiplexer selects the terminal multiplexer for the session.
// "tmux" (default) uses tmux/psmux. "wt" uses Windows Terminal's
// native split-pane (only effective on Windows).
Multiplexer string `yaml:"multiplexer"`
}
// IsAutoUpdateCheckEnabled returns true unless the user has explicitly set
@@ -84,6 +89,15 @@ func (c Config) IsAutoUpdateCheckEnabled() bool {
return *c.AutoUpdateCheck
}
// MultiplexerBackend returns the configured multiplexer backend,
// falling back to "tmux" if not set.
func (c Config) MultiplexerBackend() string {
if c.Multiplexer == "" {
return "tmux"
}
return c.Multiplexer
}
// LoginCommand returns the configured AWS SSO login command, falling back
// to DefaultAWSSSOLoginCommand if none is set.
func (c Config) LoginCommand() string {