Add "Show controller connection status" setting

This commit is contained in:
redphx 2024-07-02 17:08:40 +07:00
parent 385fd71e86
commit 277c777121
5 changed files with 13 additions and 4 deletions

View File

@ -303,8 +303,10 @@ function main() {
disablePwa();
// Show a toast when connecting/disconecting controller
window.addEventListener('gamepadconnected', e => showGamepadToast(e.gamepad));
window.addEventListener('gamepaddisconnected', e => showGamepadToast(e.gamepad));
if (getPref(PrefKey.CONTROLLER_SHOW_CONNECTION_STATUS)) {
window.addEventListener('gamepadconnected', e => showGamepadToast(e.gamepad));
window.addEventListener('gamepaddisconnected', e => showGamepadToast(e.gamepad));
}
// Preload Remote Play
if (getPref(PrefKey.REMOTE_PLAY_ENABLED)) {

View File

@ -1,6 +1,5 @@
import { PrefKey } from "@utils/preferences"
import { PrefKey, getPref } from "@utils/preferences"
import { BxEvent } from "@utils/bx-event"
import { getPref } from "@utils/preferences"
import { CE } from "@utils/html"
import { t } from "@utils/translation"
import { STATES } from "@utils/global"

View File

@ -89,6 +89,7 @@ const SETTINGS_UI = {
items: [
PrefKey.UI_LAYOUT,
PrefKey.UI_HOME_CONTEXT_MENU_DISABLED,
PrefKey.CONTROLLER_SHOW_CONNECTION_STATUS,
PrefKey.STREAM_SIMPLIFY_MENU,
PrefKey.SKIP_SPLASH_VIDEO,
!AppInterface && PrefKey.UI_SCROLLBAR_HIDE,

View File

@ -45,6 +45,7 @@ export enum PrefKey {
CONTROLLER_ENABLE_VIBRATION = 'controller_enable_vibration',
CONTROLLER_DEVICE_VIBRATION = 'controller_device_vibration',
CONTROLLER_VIBRATION_INTENSITY = 'controller_vibration_intensity',
CONTROLLER_SHOW_CONNECTION_STATUS = 'controller_show_connection_status',
NATIVE_MKB_ENABLED = 'native_mkb_enabled',
NATIVE_MKB_SCROLL_HORIZONTAL_SENSITIVITY = 'native_mkb_scroll_x_sensitivity',
@ -384,6 +385,11 @@ export class Preferences {
},
*/
[PrefKey.CONTROLLER_SHOW_CONNECTION_STATUS]: {
label: t('show-controller-connection-status'),
default: true,
},
[PrefKey.CONTROLLER_ENABLE_SHORTCUTS]: {
default: false,
},

View File

@ -200,6 +200,7 @@ const Texts = {
"sharpness": "Sharpness",
"shortcut-keys": "Shortcut keys",
"show": "Show",
"show-controller-connection-status": "Show controller connection status",
"show-game-art": "Show game art",
"show-hide": "Show/hide",
"show-stats-on-startup": "Show stats when starting the game",