-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbackend.go
More file actions
36 lines (28 loc) · 734 Bytes
/
Copy pathbackend.go
File metadata and controls
36 lines (28 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main
import (
"strings"
"github.com/lmorg/murex/utils/which"
"github.com/lmorg/ttyphoon/tmux"
"github.com/lmorg/ttyphoon/window/backend"
)
func startBackend(a *WApp) error {
renderer, size := backend.Initialise()
if which.Which("tmux") == "" {
panic("tmux not in $PATH")
}
tmuxClient, err := tmux.NewStartSession(renderer, size, tmux.START_ATTACH_SESSION)
if err != nil {
if !strings.HasPrefix(err.Error(), "no sessions") {
//log.Println(err)
return err
}
cdHome()
tmuxClient, err = tmux.NewStartSession(renderer, size, tmux.START_NEW_SESSION)
if err != nil {
//log.Println(err)
return err
}
}
backend.Start(renderer, tmuxClient.GetTermTiles(), tmuxClient, a.ctx, a)
return nil
}