~zenomat/dwm-gnome

ed2332dc694adb7eeb10a183d37f12fb5e28d7ff — zeno 1 year, 6 months ago f4c3e7e
workspaces: now hold their index, as seen in gnome
1 files changed, 16 insertions(+), 16 deletions(-)

M extension.js
M extension.js => extension.js +16 -16
@@ 23,7 23,8 @@ class Window {
}

class Workspace {
	constructor() {
	constructor(index) {
		this.workspaceIndex = index;
		this.master = null;
		this.windowCount = 0;
		this.mFactor = Constants.MFACTOR;


@@ 32,7 33,7 @@ class Workspace {

class WindowManager {
	constructor() {
		let ws = new Workspace();
		let ws = new Workspace(global.display.get_workspace_manager().get_active_workspace_index());
		// this.master = ws.master;
		// this.windowCount = ws.windowCount;
		// this.mFactor = ws.mFactor;


@@ 108,9 109,7 @@ class WindowManager {
	}

	computeAndPosition() {
		// this.drawWindowList();
		log('Computing and positing window');
		log(this.activeWorkspace.windowCount);
		log(`Arranging ${this.activeWorkspace.windowCount} windows`);

		if (this.activeWorkspace.master == null) {
			log('No windows to draw, skipping');


@@ 153,13 152,13 @@ class WindowManager {
				height = this.displaySize[1] / (this.activeWorkspace.windowCount - 1);
			}

			log('---------------------------------------');
			log('Spawning windows with values:');
			log(`x = ${x}`);
			log(`y = ${y}`);
			log(`width = ${width}`);
			log(`height = ${height}`);
			log('---------------------------------------');
			// log('---------------------------------------');
			// log('Spawning windows with values:');
			// log(`x = ${x}`);
			// log(`y = ${y}`);
			// log(`width = ${width}`);
			// log(`height = ${height}`);
			// log('---------------------------------------');
			currentWindow.win.move_resize_frame(false, x, y, width, height);

			currentWindow = currentWindow.next;


@@ 170,10 169,13 @@ class WindowManager {
	}

	changeWorkspace(calling, previousWorkspace, newWorkspace) {
		log(`Chaning workspace from ${previousWorkspace} to ${newWorkspace}`);
		log(`Changing workspace from ${previousWorkspace} to ${newWorkspace}`);
		// this.workspaces.set(previousWorkspace, this.activeWorkspace);
		if (!this.workspaces.has(newWorkspace)) {
			this.workspaces.set(newWorkspace, new Workspace());
			this.workspaces.set(newWorkspace, new Workspace(newWorkspace));
		}
		this.activeWorkspace = this.workspaces.get(newWorkspace);
		this.computeAndPosition();
		}
		this.activeWorkspace = this.workspaces.get(newWorkspace);
		this.computeAndPosition();


@@ 306,8 308,6 @@ class Extension {
			Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
			this.wm.decreaseMFactor.bind(this.wm)));

		log(bindings[0], bindings[3]);

		// const createHandler = global.display.get_workspace_manager().get_active_workspace().connect('window-added', this.wm.windowCreated.bind(this.wm));
		this._createHandler = global.display.connect('window-created', this.wm.windowCreated.bind(this.wm));
		this._deleteHandler = global.display.get_workspace_manager().get_active_workspace().connect('window-removed', this.wm.windowDestroyed.bind(this.wm));