hotkeys.js 993 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { createLog } from "@/utils/logger";
  2. if (typeof nodeRequire !== "undefined") {
  3. console.log("考生端,disable key");
  4. createLog({
  5. page: "electron",
  6. action: "禁用key",
  7. });
  8. let remote = window.nodeRequire("electron").remote;
  9. // const { electron, dialog } = remote;
  10. // console.log(remote);
  11. // Module to control application life.
  12. // const app = remote.app;
  13. const { globalShortcut } = remote;
  14. // app.whenReady().then(() => {
  15. // Register a 'CommandOrControl+Y' shortcut listener.
  16. if (globalShortcut.isRegistered("Super+Y")) {
  17. console.log("reged");
  18. createLog({
  19. page: "electron",
  20. action: "reged->unreg",
  21. });
  22. globalShortcut.unregisterAll();
  23. }
  24. // globalShortcut.registerAll(["Super+Tab"], () => {
  25. globalShortcut.register("Super+Y", () => {
  26. console.log("key clicked");
  27. createLog({
  28. page: "electron",
  29. action: "禁用key-pressed",
  30. });
  31. // Do stuff when Y and either Command/Control is pressed.
  32. });
  33. }