From 137c50b6dc7d8a6eec844d7e2baf8aabb3680a89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yao=20Wei=20=28=E9=AD=8F=E9=8A=98=E5=BB=B7=29?= Date: Mon, 29 Aug 2022 16:45:05 +0800 Subject: [PATCH] switchMonitor: Fix initial selection on desktop Due to !2056 the monitor config is 2 instead of 4 on the desktop. However, the constant `Meta.MonitorSwitchConfigType.UNKNOWN` is fixed to 4, and may cause the initial selection to be out of index thus fail to display the switcher. This replaces the above constant to the actual length of the switcher items. Part-of: --- js/ui/switchMonitor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/ui/switchMonitor.js b/js/ui/switchMonitor.js index 10b4a50cd..a95c5fa9a 100644 --- a/js/ui/switchMonitor.js +++ b/js/ui/switchMonitor.js @@ -63,7 +63,7 @@ class SwitchMonitorPopup extends SwitcherPopup.SwitcherPopup { _initialSelection() { let currentConfig = Meta.MonitorManager.get().get_switch_config(); - let selectConfig = (currentConfig + 1) % Meta.MonitorSwitchConfigType.UNKNOWN; + let selectConfig = (currentConfig + 1) % this._items.length; this._select(selectConfig); }