diff --git a/CHANGELOG.md b/CHANGELOG.md index 6283e61..1ea7161 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * 新增開機時自動啟動的設定 (https://github.com/ExpTechTW/TREM-tauri/pull/30) * 新增最小化至系統匣的設定 (https://github.com/ExpTechTW/TREM-tauri/pull/30) * 新增啟動參數 `--quiet` 在開啟程式時隱藏視窗 (https://github.com/ExpTechTW/TREM-tauri/pull/30) +* 停用瀏覽器內建快捷鍵 (https://github.com/ExpTechTW/TREM-tauri/pull/31) * 自動抓取並更新地震報告 (https://github.com/ExpTechTW/TREM-tauri/pull/32) **完整變更紀錄**: https://github.com/ExpTechTW/TREM-tauri/compare/v0.0.0-alpha.2...v0.0.0-alpha.3 diff --git a/src/main.ts b/src/main.ts index 9583293..e247cd2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -426,3 +426,32 @@ browserWindow.onCloseRequested((event) => { browserWindow.hide(); } }); + +document.addEventListener("keydown", (ev) => { + // Disabling keyboard shortcuts + ev.preventDefault(); + + if (ev.ctrlKey && !ev.shiftKey && !ev.altKey) { + switch (ev.code) { + case "Digit1": + instance.changeView("home"); + break; + + case "Digit2": + instance.changeView("report-list"); + break; + + case "Digit3": + case "KeyO": + instance.changeView("setting"); + break; + + case "KeyR": + location.reload(); + break; + + default: + break; + } + } +}); \ No newline at end of file diff --git a/src/styles.css b/src/styles.css index a18c148..705adac 100644 --- a/src/styles.css +++ b/src/styles.css @@ -5,11 +5,10 @@ :root { font-family: "Lato", "Noto Sans TC", sans-serif; - font-synthesis: none; text-rendering: optimizeLegibility; - user-select: none; -webkit-user-select: none; -moz-user-select: none; + user-select: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; @@ -31,6 +30,8 @@ } body { + position: fixed; + inset: 0; margin: 0; background-color: hsl(var(--background-hsl)); color: #fff;