mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-04 18:59:08 +01:00
addressed feedback
This commit is contained in:
parent
8884d5f6d3
commit
3490dcbedb
@ -512,7 +512,7 @@ electron.ipcMain.on("toggle-developer-tools", (event) => {
|
|||||||
event.returnValue = true;
|
event.returnValue = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
electron.ipcMain.on("minimize-window", (event) => {
|
electron.ipcMain.on("hide-window", (event) => {
|
||||||
if (MainWindow != null) {
|
if (MainWindow != null) {
|
||||||
MainWindow.hide();
|
MainWindow.hide();
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
let { contextBridge, ipcRenderer } = require("electron");
|
let { contextBridge, ipcRenderer } = require("electron");
|
||||||
|
|
||||||
contextBridge.exposeInMainWorld("api", {
|
contextBridge.exposeInMainWorld("api", {
|
||||||
minimizeWindow: () => ipc.Renderer.send("minimize-window"),
|
hideWindow: () => ipc.Renderer.send("hide-window"),
|
||||||
toggleDeveloperTools: () => ipcRenderer.send("toggle-developer-tools"),
|
toggleDeveloperTools: () => ipcRenderer.send("toggle-developer-tools"),
|
||||||
getId: () => ipcRenderer.sendSync("get-id"),
|
getId: () => ipcRenderer.sendSync("get-id"),
|
||||||
getPlatform: () => ipcRenderer.sendSync("get-platform"),
|
getPlatform: () => ipcRenderer.sendSync("get-platform"),
|
||||||
|
@ -223,7 +223,7 @@ class Model {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
this.keybindManager.registerKeybinding("system", "electron", "system:minimizeWindow", (waveEvent) => {
|
this.keybindManager.registerKeybinding("system", "electron", "system:minimizeWindow", (waveEvent) => {
|
||||||
getApi().minimizeWindow();
|
getApi().hideWindow();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
2
src/types/custom.d.ts
vendored
2
src/types/custom.d.ts
vendored
@ -880,7 +880,7 @@ declare global {
|
|||||||
};
|
};
|
||||||
|
|
||||||
type ElectronApi = {
|
type ElectronApi = {
|
||||||
minimizeWindow: () => void;
|
hideWindow: () => void;
|
||||||
toggleDeveloperTools: () => void;
|
toggleDeveloperTools: () => void;
|
||||||
getId: () => string;
|
getId: () => string;
|
||||||
getIsDev: () => boolean;
|
getIsDev: () => boolean;
|
||||||
|
@ -3564,6 +3564,7 @@ func SessionSetCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (s
|
|||||||
}
|
}
|
||||||
|
|
||||||
func SleepCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (scbus.UpdatePacket, error) {
|
func SleepCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (scbus.UpdatePacket, error) {
|
||||||
|
sleepTimeLimit := 10000
|
||||||
if len(pk.Args) < 1 {
|
if len(pk.Args) < 1 {
|
||||||
return nil, fmt.Errorf("no argument found - usage: /sleep [ms]")
|
return nil, fmt.Errorf("no argument found - usage: /sleep [ms]")
|
||||||
}
|
}
|
||||||
@ -3572,8 +3573,8 @@ func SleepCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (scbus.
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("couldn't parse sleep arg: %v", err)
|
return nil, fmt.Errorf("couldn't parse sleep arg: %v", err)
|
||||||
}
|
}
|
||||||
if sleepArgInt > 10000 {
|
if sleepArgInt > sleepTimeLimit {
|
||||||
return nil, fmt.Errorf("sleep arg is too long, max value is 1000")
|
return nil, fmt.Errorf("sleep arg is too long, max value is %v", sleepTimeLimit)
|
||||||
}
|
}
|
||||||
time.Sleep(time.Duration(sleepArgInt) * time.Millisecond)
|
time.Sleep(time.Duration(sleepArgInt) * time.Millisecond)
|
||||||
update := scbus.MakeUpdatePacket()
|
update := scbus.MakeUpdatePacket()
|
||||||
|
Loading…
Reference in New Issue
Block a user