Sync workspaces
- From: Mads Villadsen <maxx krakoa dk>
- To: gnome-shell-list gnome org
- Subject: Sync workspaces
- Date: Tue, 11 Aug 2009 22:22:25 +0200
Attached is a small patch that uses libwnck to make sure the workspace
layout is synced with the window manager.
This is my first time using libwnck, and I am not happy with the way I
initialize wnckScreen and wcnkToken globally, but when I tried to do it
in the contructor to Workspaces it failed - apparent libwcnk doesn't
like you calling get_default more than once.
Any hints on how to make it cleaner will be greatly appreciated.
Regards.
--
Mads Villadsen <maxx krakoa dk>
diff --git a/js/ui/workspaces.js b/js/ui/workspaces.js
index 6babf82..ccd79cc 100644
--- a/js/ui/workspaces.js
+++ b/js/ui/workspaces.js
@@ -10,6 +10,7 @@ const Meta = imports.gi.Meta;
const Pango = imports.gi.Pango;
const Shell = imports.gi.Shell;
const Signals = imports.signals;
+const Wnck = imports.gi.Wnck;
const AppDisplay = imports.ui.appDisplay;
const DND = imports.ui.dnd;
@@ -49,6 +50,8 @@ const GRID_SPACING = 15;
const FRAME_SIZE = GRID_SPACING / 3;
let buttonSize = false;
+let wnckScreen = Wnck.Screen.get_default();
+let wnckToken = 0;
function WindowClone(realWindow) {
this._init(realWindow);
@@ -1102,6 +1105,13 @@ Workspaces.prototype = {
let newGridWidth = Math.ceil(Math.sqrt(newNumWorkspaces));
let newGridHeight = Math.ceil(newNumWorkspaces / newGridWidth);
+ let workspaceResult = wnckScreen.try_set_workspace_layout(wnckToken, newGridHeight, 0);
+ if (workspaceResult != 0) {
+ wnckToken = workspaceResult;
+ } else {
+ log("Failed setting workspace layout (" + newGridHeight + ", 0)");
+ }
+
if (newGridWidth != oldGridWidth || newGridHeight != oldGridHeight) {
// We need to resize/move the existing workspaces/windows
let existingWorkspaces = Math.min(oldNumWorkspaces, newNumWorkspaces);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]