(extension: ExtensionSettingsProvider)
| 88 | } |
| 89 | |
| 90 | private constructor(extension: ExtensionSettingsProvider) { |
| 91 | // --- initialize --- |
| 92 | const mangledThemeName = extension.settings |
| 93 | .get_string("theme")! |
| 94 | .toLowerCase() |
| 95 | .replace(/[^a-z0-9]/g, "-") as StripPrefix<Theme>; |
| 96 | |
| 97 | this.#theme = `gtile-${mangledThemeName}`; |
| 98 | this.#gc = new GarbageCollection(); |
| 99 | this.#lastPresetIndex = new VolatileStorage<PresetIndex>(2000); |
| 100 | this.#settings = extension.settings; |
| 101 | this.#gridSpecs = AutoTileLayouts(this.#settings); |
| 102 | |
| 103 | this.#globalKeyBindingGroups = Object |
| 104 | .entries(SettingKeyToKeyBindingGroupLUT) |
| 105 | .reduce((mask, [key, group]) => |
| 106 | this.#settings.get_boolean(key as BoolSettingKey) |
| 107 | ? mask | group |
| 108 | : mask, |
| 109 | 0); |
| 110 | |
| 111 | this.#hotkeyManager = new HotkeyManager({ |
| 112 | settings: this.#settings, |
| 113 | windowManager: Main.wm, |
| 114 | }); |
| 115 | this.#gc.defer(() => this.#hotkeyManager.release()); |
| 116 | |
| 117 | this.#desktopManager = new DesktopManager({ |
| 118 | shell: Shell.Global.get(), |
| 119 | display: Shell.Global.get().display, |
| 120 | layoutManager: Main.layoutManager, |
| 121 | monitorManager: Shell.Global.get().backend.get_monitor_manager(), |
| 122 | workspaceManager: Shell.Global.get().workspace_manager, |
| 123 | userPreferences: new UserPreferences({ settings: this.#settings }), |
| 124 | }); |
| 125 | this.#gc.defer(() => this.#desktopManager.release()); |
| 126 | |
| 127 | const gridSizeConf = this.#settings.get_string("grid-sizes") ?? ""; |
| 128 | this.#overlayManager = new OverlayManager({ |
| 129 | theme: this.#theme, |
| 130 | settings: this.#settings, |
| 131 | gnomeSettings: extension.getSettings("org.gnome.desktop.interface"), |
| 132 | presets: new GridSizeListParser(gridSizeConf).parse() ?? DefaultGridSizes, |
| 133 | layoutManager: Main.layoutManager, |
| 134 | desktopManager: this.#desktopManager, |
| 135 | }); |
| 136 | this.#gc.defer(() => this.#overlayManager.release()); |
| 137 | |
| 138 | this.#panelIcon = new PanelButton({ theme: this.#theme }); |
| 139 | this.#gc.defer(() => this.#panelIcon.destroy()); |
| 140 | |
| 141 | // --- show UI --- |
| 142 | Main.panel.addToStatusArea(extension.uuid, this.#panelIcon); |
| 143 | |
| 144 | // --- event handlers --- |
| 145 | this.#panelIcon.connect("button-press-event", |
| 146 | () => this.#onUserAction({ type: Action.TOGGLE })); |
| 147 | this.#settings.bind("show-icon", this.#panelIcon, "visible", |
nothing calls this directly
no test coverage detected