Skip to content

feat: add configurable GPU acceleration toggle#2037

Draft
ysfscream wants to merge 5 commits intomainfrom
feature/disable-gpu-acceleration
Draft

feat: add configurable GPU acceleration toggle#2037
ysfscream wants to merge 5 commits intomainfrom
feature/disable-gpu-acceleration

Conversation

@ysfscream
Copy link
Copy Markdown
Member

@ysfscream ysfscream commented Mar 17, 2026

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

  • Added a disableHardwareAcceleration setting backed by electron-store, with Vuex bindings
  • Added a UI toggle in the Settings page with tooltip
  • Added a restart prompt dialog when the toggle changes
  • Added i18n translations for all supported languages (zh/en/tr/ja/hu)

CLI Upgrade

  • Upgraded CLI Node.js target from 18 to 22
  • Updated tsconfig.json to ES2022
  • Updated @types/node to ^22.0.0
  • Changed pkg build targets to node22
  • Fixed process.exit mock type signatures in tests

Copilot AI review requested due to automatic review settings March 17, 2026 15:03
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 disableHardwareAcceleration setting 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.json to ES2022, bumped @types/node, and fixed process.exit mock 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 thread src/lang/settings.ts Outdated
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 thread cli/.nvmrc Outdated
Comment thread src/lang/settings.ts Outdated
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.',
@ysfscream ysfscream force-pushed the feature/disable-gpu-acceleration branch 2 times, most recently from b2a5511 to a9e1a88 Compare March 17, 2026 15:09
- 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
@ysfscream ysfscream force-pushed the feature/disable-gpu-acceleration branch from a9e1a88 to 266e735 Compare March 17, 2026 15:09
@ysfscream ysfscream marked this pull request as draft March 17, 2026 15:16
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants