mirror of https://github.com/xrehpicx/pee.git
fix: added option to auto select pane
This commit is contained in:
parent
d3d90ddb05
commit
cdeaed61f7
|
@ -30,6 +30,7 @@ type Configuration struct {
|
||||||
LastOpened time.Time
|
LastOpened time.Time
|
||||||
Attach bool `yaml:"attach"`
|
Attach bool `yaml:"attach"`
|
||||||
StartupWindow string `yaml:"startup_window"`
|
StartupWindow string `yaml:"startup_window"`
|
||||||
|
StartupPane int `yaml:"startup_pane"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var configDir string
|
var configDir string
|
||||||
|
|
|
@ -109,6 +109,16 @@ func CreateTmuxSession(config *projectconfig.Configuration) error {
|
||||||
}
|
}
|
||||||
log.Debug("Ran command", "command", selectWindowCmd.String())
|
log.Debug("Ran command", "command", selectWindowCmd.String())
|
||||||
|
|
||||||
|
// Select initial pane
|
||||||
|
if config.StartupPane > 0 {
|
||||||
|
defaultPane := fmt.Sprintf("%s:%d.%d", sessionName, config.StartupPane, 1)
|
||||||
|
selectPaneCmd := exec.Command("tmux", "select-pane", "-t", defaultPane)
|
||||||
|
if err := selectPaneCmd.Run(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
log.Debug("Ran command", "command", selectPaneCmd.String())
|
||||||
|
}
|
||||||
|
|
||||||
if config.Attach {
|
if config.Attach {
|
||||||
switchSessionCmd := exec.Command("tmux", "switch-client", "-t", sessionName)
|
switchSessionCmd := exec.Command("tmux", "switch-client", "-t", sessionName)
|
||||||
if err := switchSessionCmd.Run(); err != nil {
|
if err := switchSessionCmd.Run(); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue