Resources for centering extension on the taskbar?

Hello,

I’m running PopOS 22.04 and GNOME Shell 42.3.1, and I’m using a custom extension to show all my opened applications on the taskbar:


I would like to have all the icons on the middle of the taskbar since I have a widescreen.

Can anyone point me in the right direction, docs or functions I should be using to make the needed changes?

Relevant snippet of code (I think):

	// update the workspaces bar
    _update_ws() {
		// destroy old workspaces bar buttons and signals
    	this.ws_bar.destroy_all_children();
    	
    	// get number of workspaces
        this.ws_count = WM.get_n_workspaces();
        this.active_ws_index = WM.get_active_workspace_index();
        		
		// display all current workspaces and tasks buttons
		try {
			const ordered_workspaces = [0,2,4,6,1,3,5,7];
			for (let i = 0; i < ordered_workspaces.length; ++i) {
				let ws_index = ordered_workspaces[i];
				// workspace
				let ws_box = new WorkspaceButton();
				ws_box.number = ws_index;
				let ws_box_label = new St.Label({y_align: Clutter.ActorAlign.CENTER});

				// rounded buttons option
				if (!ROUNDED_WORKSPACES_BUTTONS) {
					if (ws_index == this.active_ws_index) {
						ws_box_label.style_class = 'workspace-active-squared';
					} else {
						ws_box_label.style_class = 'workspace-inactive-squared';
					}
				} else {
					if (ws_index == this.active_ws_index) {
						ws_box_label.style_class = 'workspace-active-rounded';
					} else {
						ws_box_label.style_class = 'workspace-inactive-rounded';
					}
				}

				// workspace numbered label
				if (this.ws_names[ws_index]) {
					ws_box_label.set_text("  " + this.ws_names[ws_index] + "  ");
				} else {
					ws_box_label.set_text("  " + (i + 1) + "  ");
				}
				ws_box.set_child(ws_box_label);

				// signal
				ws_box.connect('button-release-event', (widget, event) => this._toggle_ws(widget, event, ws_index));

				// add in task bar
				if (DISPLAY_WORKSPACES) {
					this.ws_bar.add_child(ws_box);
				}

				// tasks
				this.ws_current = WM.get_workspace_by_index(ws_index);
				if (FAVORITES_FIRST) {
					this.favorites_list = AppFavorites.getAppFavorites().getFavorites();
					this.ws_current.windows = this.ws_current.list_windows().sort(this._sort_windows_favorites_first.bind(this));
				} else {
					this.ws_current.windows = this.ws_current.list_windows().sort(this._sort_windows);
				}
				for (let window_index = 0; window_index < this.ws_current.windows.length; ++window_index) {
					this.window = this.ws_current.windows[window_index];
					if (this.window && !this.window.is_skip_taskbar() && this.window_type_whitelist.includes(this.window.get_window_type())) {
						this._create_window_button(ws_index, this.window);
					}
				}

				if ( ws_index == 6) {
					let ws_separator = new WorkspaceButton();
					//ws_box.number = ws_index;
					let ws_separator_label = new St.Label({y_align: Clutter.ActorAlign.CENTER});
					ws_separator_label.style_class = 'workspace-inactive-rounded';
					ws_separator_label.set_text(" | ");

					ws_separator.set_child(ws_separator_label)
					this.ws_bar.add_child(ws_separator);
				}
			}
		} catch (e) {
			logError(e, 'ExtensionErrorType');
		}

    }

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.