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: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2451>
This commit is contained in:
Yao Wei (魏銘廷) 2022-08-29 16:45:05 +08:00 committed by Yao Wei
parent 6c56de82ea
commit 137c50b6dc

View File

@ -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);
}