mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-04 18:59:08 +01:00
added mainview slashcommand
This commit is contained in:
parent
dd24323296
commit
4ece667aaa
@ -42,11 +42,12 @@
|
||||
{
|
||||
"command": "app:openConnectionsView",
|
||||
"keys": [],
|
||||
"commandStr": "/remote:show"
|
||||
"commandStr": "/mainview connections"
|
||||
},
|
||||
{
|
||||
"command": "app:openSettingsView",
|
||||
"keys": []
|
||||
"keys": [],
|
||||
"commandStr": "/mainview clientsettings"
|
||||
},
|
||||
{
|
||||
"command": "app:newTab",
|
||||
|
@ -240,10 +240,7 @@ class Model {
|
||||
return true;
|
||||
});
|
||||
this.keybindManager.registerKeybinding("app", "model", "app:openConnectionsView", null);
|
||||
this.keybindManager.registerKeybinding("app", "model", "app:openSettingsView", (waveEvent) => {
|
||||
this.onOpenSettingsViewPressed();
|
||||
return true;
|
||||
});
|
||||
this.keybindManager.registerKeybinding("app", "model", "app:openSettingsView", null);
|
||||
}
|
||||
|
||||
static getInstance(): Model {
|
||||
@ -1005,6 +1002,12 @@ class Model {
|
||||
console.warn("invalid bookmarksview in update:", update.mainview);
|
||||
}
|
||||
break;
|
||||
case "clientsettings":
|
||||
this.activeMainView.set("clientsettings");
|
||||
break;
|
||||
case "connections":
|
||||
this.activeMainView.set("connections");
|
||||
break;
|
||||
case "plugins":
|
||||
this.pluginsModel.showPluginsView();
|
||||
break;
|
||||
|
@ -172,6 +172,8 @@ func init() {
|
||||
registerCmdFn("signal", SignalCommand)
|
||||
registerCmdFn("sync", SyncCommand)
|
||||
|
||||
registerCmdFn("mainview", MainViewCommand)
|
||||
|
||||
registerCmdFn("session", SessionCommand)
|
||||
registerCmdFn("session:open", SessionOpenCommand)
|
||||
registerCmdAlias("session:new", SessionOpenCommand)
|
||||
@ -3560,6 +3562,28 @@ func SessionSetCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (s
|
||||
return update, nil
|
||||
}
|
||||
|
||||
func MainViewCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (scbus.UpdatePacket, error) {
|
||||
if len(pk.Args) < 1 {
|
||||
return nil, fmt.Errorf("no argument found - usage: /mainview [view]")
|
||||
}
|
||||
update := scbus.MakeUpdatePacket()
|
||||
mainViewArg := pk.Args[0]
|
||||
if mainViewArg == sstore.MainViewSession {
|
||||
update.AddUpdate(&sstore.MainViewUpdate{MainView: sstore.MainViewSession})
|
||||
} else if mainViewArg == sstore.MainViewConnections {
|
||||
update.AddUpdate(&sstore.MainViewUpdate{MainView: sstore.MainViewConnections})
|
||||
} else if mainViewArg == sstore.MainViewSettings {
|
||||
update.AddUpdate(&sstore.MainViewUpdate{MainView: sstore.MainViewSettings})
|
||||
} else if mainViewArg == sstore.MainViewHistory {
|
||||
return nil, fmt.Errorf("use /history instead")
|
||||
} else if mainViewArg == sstore.MainViewBookmarks {
|
||||
return nil, fmt.Errorf("use /bookmarks instead")
|
||||
} else {
|
||||
return nil, fmt.Errorf("unrecognized main view")
|
||||
}
|
||||
return update, nil
|
||||
}
|
||||
|
||||
func SessionCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (scbus.UpdatePacket, error) {
|
||||
ids, err := resolveUiIds(ctx, pk, 0)
|
||||
if err != nil {
|
||||
|
@ -71,9 +71,11 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
MainViewSession = "session"
|
||||
MainViewBookmarks = "bookmarks"
|
||||
MainViewHistory = "history"
|
||||
MainViewSession = "session"
|
||||
MainViewBookmarks = "bookmarks"
|
||||
MainViewHistory = "history"
|
||||
MainViewConnections = "connections"
|
||||
MainViewSettings = "clientsettings"
|
||||
)
|
||||
|
||||
const (
|
||||
|
Loading…
Reference in New Issue
Block a user