mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
72ea58267d
Adds a new app menu for creating a new workspace or switching to an existing one. This required adding a new WPS event any time a workspace gets updated, since the Electron app menus are static. This also fixes a bug where closing a workspace could delete it if it didn't have both a pinned and an unpinned tab.
50 lines
1.3 KiB
Go
50 lines
1.3 KiB
Go
package wps
|
|
|
|
import "github.com/wavetermdev/waveterm/pkg/util/utilfn"
|
|
|
|
const (
|
|
Event_BlockClose = "blockclose"
|
|
Event_ConnChange = "connchange"
|
|
Event_SysInfo = "sysinfo"
|
|
Event_ControllerStatus = "controllerstatus"
|
|
Event_WaveObjUpdate = "waveobj:update"
|
|
Event_BlockFile = "blockfile"
|
|
Event_Config = "config"
|
|
Event_UserInput = "userinput"
|
|
Event_RouteGone = "route:gone"
|
|
Event_WorkspaceUpdate = "workspace:update"
|
|
)
|
|
|
|
type WaveEvent struct {
|
|
Event string `json:"event"`
|
|
Scopes []string `json:"scopes,omitempty"`
|
|
Sender string `json:"sender,omitempty"`
|
|
Persist int `json:"persist,omitempty"`
|
|
Data any `json:"data,omitempty"`
|
|
}
|
|
|
|
func (e WaveEvent) HasScope(scope string) bool {
|
|
return utilfn.ContainsStr(e.Scopes, scope)
|
|
}
|
|
|
|
type SubscriptionRequest struct {
|
|
Event string `json:"event"`
|
|
Scopes []string `json:"scopes,omitempty"`
|
|
AllScopes bool `json:"allscopes,omitempty"`
|
|
}
|
|
|
|
const (
|
|
FileOp_Create = "create"
|
|
FileOp_Delete = "delete"
|
|
FileOp_Append = "append"
|
|
FileOp_Truncate = "truncate"
|
|
FileOp_Invalidate = "invalidate"
|
|
)
|
|
|
|
type WSFileEventData struct {
|
|
ZoneId string `json:"zoneid"`
|
|
FileName string `json:"filename"`
|
|
FileOp string `json:"fileop"`
|
|
Data64 string `json:"data64"`
|
|
}
|