Set a strut to prevent windows under the panel
Set a strut (a reserved region) at the top of the screen so that windows don't get positioned under the panel. Do this on all workspaces and redo it when the number of workspaces changes. http://bugzilla.gnome.org/show_bug.cgi?id=561297 svn path=/trunk/; revision=63
This commit is contained in:
parent
71a35e495e
commit
840eb62397
@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
const Mainloop = imports.mainloop;
|
const Mainloop = imports.mainloop;
|
||||||
|
|
||||||
const Shell = imports.gi.Shell;
|
|
||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
|
const Meta = imports.gi.Meta;
|
||||||
|
const Shell = imports.gi.Shell;
|
||||||
const Tidy = imports.gi.Tidy;
|
const Tidy = imports.gi.Tidy;
|
||||||
const Button = imports.ui.button;
|
|
||||||
|
|
||||||
|
const Button = imports.ui.button;
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
|
|
||||||
const PANEL_HEIGHT = 32;
|
const PANEL_HEIGHT = 32;
|
||||||
@ -86,12 +87,42 @@ Panel.prototype = {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this._setStruts();
|
||||||
|
global.screen.connect('notify::n-workspaces',
|
||||||
|
function() {
|
||||||
|
me._setStruts();
|
||||||
|
});
|
||||||
|
|
||||||
global.stage.add_actor(this._group);
|
global.stage.add_actor(this._group);
|
||||||
|
|
||||||
this._updateClock();
|
this._updateClock();
|
||||||
this._startClock();
|
this._startClock();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Struts determine the area along each side of the screen that is reserved
|
||||||
|
// and not available to applications
|
||||||
|
_setStruts: function() {
|
||||||
|
let global = Shell.global_get();
|
||||||
|
|
||||||
|
let struts = [
|
||||||
|
new Meta.Strut({
|
||||||
|
rect: {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
width: global.screen_width,
|
||||||
|
height: PANEL_HEIGHT
|
||||||
|
},
|
||||||
|
side: Meta.Direction.TOP
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
let screen = global.screen;
|
||||||
|
for (let i = 0; i < screen.n_workspaces; i++) {
|
||||||
|
let workspace = screen.get_workspace_by_index(i);
|
||||||
|
workspace.set_builtin_struts(struts);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
_startClock: function() {
|
_startClock: function() {
|
||||||
let me = this;
|
let me = this;
|
||||||
// TODO: this makes the clock updated every 60 seconds, but not necessarily on the minute, so it is inaccurate
|
// TODO: this makes the clock updated every 60 seconds, but not necessarily on the minute, so it is inaccurate
|
||||||
|
Loading…
Reference in New Issue
Block a user