feat: add configurable GPU acceleration toggle#2037
Draft
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a configurable GPU acceleration toggle to the MQTTX desktop app, allowing users to disable hardware acceleration to work around rendering issues on certain hardware. It also upgrades the CLI toolchain from Node.js 18 to Node.js 22.
Changes:
- Added a
disableHardwareAccelerationsetting backed by electron-store, with Vuex bindings, a UI toggle in the Settings page, and a restart prompt dialog - Added i18n translations (zh/en fully translated; tr/ja/hu use English placeholders) for the new setting and restart dialog
- Upgraded CLI Node.js target from 18 to 22, updated
tsconfig.jsonto ES2022, bumped@types/node, and fixedprocess.exitmock type signatures in tests
Reviewed changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/background.ts |
Reads GPU acceleration setting from electron-store before app.ready and calls app.disableHardwareAcceleration() when enabled; passes setting to sharedData |
src/store/modules/app.ts |
Adds Vuex state, mutation, and action for disableHardwareAcceleration, persisting to both settingData and electron-store |
src/store/getter.ts |
Adds disableHardwareAcceleration getter |
src/types/global.d.ts |
Adds disableHardwareAcceleration to the App type |
src/views/settings/index.vue |
Adds UI toggle with tooltip, restart prompt using remoteApp.relaunch()/exit(), and fixes queryAIAPIHost callback return type |
src/lang/settings.ts |
Adds i18n keys for the new setting, description, and restart dialog |
cli/package.json |
Upgrades Node.js engine from 18 to 22, updates @types/node and pkg targets |
cli/tsconfig.json |
Updates target to ES2022, adds skipLibCheck, updates lib and types |
cli/.nvmrc |
Updates nvm version from 18 to 22 |
cli/src/__tests__/utils/*.test.ts |
Fixes process.exit mock signatures to match updated @types/node |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+156
to
+197
| disableHardwareAcceleration: { | ||
| zh: '禁用 GPU 加速', | ||
| en: 'Disable GPU Acceleration', | ||
| tr: 'Disable GPU Acceleration', | ||
| ja: 'Disable GPU Acceleration', | ||
| hu: 'Disable GPU Acceleration', | ||
| }, | ||
| disableHardwareAccelerationDesc: { | ||
| zh: 'GPU 加速利用显卡硬件渲染界面,可使操作更流畅并降低 CPU 占用。如遇画面卡顿、花屏或兼容性问题,可尝试关闭此选项。', | ||
| en: 'GPU acceleration uses graphics hardware to render the UI, making operations smoother and reducing CPU usage. Disable this option if you experience screen lag, artifacts, or compatibility issues.', | ||
| tr: 'GPU acceleration uses graphics hardware to render the UI, making operations smoother and reducing CPU usage. Disable this option if you experience screen lag, artifacts, or compatibility issues.', | ||
| ja: 'GPU acceleration uses graphics hardware to render the UI, making operations smoother and reducing CPU usage. Disable this option if you experience screen lag, artifacts, or compatibility issues.', | ||
| hu: 'GPU acceleration uses graphics hardware to render the UI, making operations smoother and reducing CPU usage. Disable this option if you experience screen lag, artifacts, or compatibility issues.', | ||
| }, | ||
| restartRequired: { | ||
| zh: '需要重启', | ||
| en: 'Restart Required', | ||
| tr: 'Restart Required', | ||
| ja: 'Restart Required', | ||
| hu: 'Restart Required', | ||
| }, | ||
| restartRequiredDesc: { | ||
| zh: 'GPU 加速设置已更新。需要重启应用才能生效,是否立即重启?', | ||
| en: 'The GPU acceleration setting has been updated. Restart the app now to apply the change?', | ||
| tr: 'The GPU acceleration setting has been updated. Restart the app now to apply the change?', | ||
| ja: 'The GPU acceleration setting has been updated. Restart the app now to apply the change?', | ||
| hu: 'The GPU acceleration setting has been updated. Restart the app now to apply the change?', | ||
| }, | ||
| restartNow: { | ||
| zh: '立即重启', | ||
| en: 'Restart Now', | ||
| tr: 'Restart Now', | ||
| ja: 'Restart Now', | ||
| hu: 'Restart Now', | ||
| }, | ||
| restartLater: { | ||
| zh: '稍后重启', | ||
| en: 'Later', | ||
| tr: 'Later', | ||
| ja: 'Later', | ||
| hu: 'Later', | ||
| }, |
Comment on lines
+163
to
+168
| disableHardwareAccelerationDesc: { | ||
| zh: 'GPU 加速利用显卡硬件渲染界面,可使操作更流畅并降低 CPU 占用。如遇画面卡顿、花屏或兼容性问题,可尝试关闭此选项。', | ||
| en: 'GPU acceleration uses graphics hardware to render the UI, making operations smoother and reducing CPU usage. Disable this option if you experience screen lag, artifacts, or compatibility issues.', | ||
| tr: 'GPU acceleration uses graphics hardware to render the UI, making operations smoother and reducing CPU usage. Disable this option if you experience screen lag, artifacts, or compatibility issues.', | ||
| ja: 'GPU acceleration uses graphics hardware to render the UI, making operations smoother and reducing CPU usage. Disable this option if you experience screen lag, artifacts, or compatibility issues.', | ||
| hu: 'GPU acceleration uses graphics hardware to render the UI, making operations smoother and reducing CPU usage. Disable this option if you experience screen lag, artifacts, or compatibility issues.', |
b2a5511 to
a9e1a88
Compare
- Add disableHardwareAcceleration setting to electron-store - Add GPU toggle UI in settings page with tooltip - Show restart prompt when toggle changes - Add i18n support for 5 languages (zh/en/tr/ja/hu) - Update TypeScript types and Vuex store
a9e1a88 to
266e735
Compare
Add missing translations in settings.ts: - topicWhitespaceDetection - topicWhitespaceDetectionDesc - disableHardwareAcceleration - disableHardwareAccelerationDesc - restartRequired - restartRequiredDesc - restartNow - restartLater - jsonHighlight Fix incomplete translations: - help.ts: helpMQTT (tr) - common.ts: viewData, saveToLocal, msgType (hu)
Change 'Disable this option if...' to 'Enable this option if...' for clearer semantics. When users experience issues, they should ENABLE the 'Disable GPU Acceleration' toggle. Updated translations: - zh: 关闭此选项 -> 启用此选项 - en: Disable this option -> Enable this option - tr: devre dışı bırakın -> etkinleştirin - ja: 無効にしてください -> 有効にしてください - hu: tiltsa le -> engedélyezze
…celeration - Invert setting logic: ON/true = GPU enabled, OFF/false = GPU disabled - Add GPU support detection for Windows using getGPUFeatureStatus() - Change default to true (GPU enabled by default if supported) - Add migration from legacy disableHardwareAcceleration setting - Update all translations (zh/en/tr/ja/hu) Fixes inverted UX where switch ON was disabling GPU instead of enabling it. Includes automatic GPU capability detection to disable on unsupported Windows devices.
Remove LEGACY_DISABLE_HARDWARE_ACCELERATION_KEY and migration function. This is treated as a fresh setting - no backwards compatibility needed. Users with old disableHardwareAcceleration setting will get default behavior (GPU enabled if supported, disabled if not detected on Windows).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a configurable GPU acceleration toggle to the MQTTX desktop app, allowing users to disable hardware acceleration to work around rendering issues on certain hardware. It also upgrades the CLI toolchain from Node.js 18 to Node.js 22.
GPU Acceleration Toggle
disableHardwareAccelerationsetting backed by electron-store, with Vuex bindingsCLI Upgrade
tsconfig.jsonto ES2022@types/nodeto ^22.0.0pkgbuild targets to node22process.exitmock type signatures in tests