Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

position based on workarea instead of screen #211

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions [email protected]/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,40 +483,39 @@ const DropDownTerminalExtension = new Lang.Class({
let panelHeight = Main.layoutManager.panelBox.height;

let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
let screen = global.screen.get_monitor_geometry(global.screen.get_primary_monitor());
let bbox = Main.legacyTray ? Main.legacyTray.actor : screen;
let x1 = bbox.x / scaleFactor;
let y1 = bbox.y / scaleFactor;
let screenHeight = bbox.height / scaleFactor;
let screenWidth = bbox.width / scaleFactor;
let workarea = Main.layoutManager.getWorkAreaForMonitor(global.screen.get_primary_monitor());
let x1 = workarea.x / scaleFactor;
let y1 = workarea.y / scaleFactor;
let screenHeight = workarea.height / scaleFactor;
let screenWidth = workarea.width / scaleFactor;
let x2 = x1 + screenWidth;
let y2 = y1 + screenHeight;

switch (terminalPosition) {
case LEFT_EDGE:
this._windowX = x1;
this._windowY = panelBox.y == y1 ? y1 + panelBox.height: y1;
this._windowY = y1;
this._windowWidth = this._evaluateSizeSpec(sizeSpec, false);
this._windowHeight = panelBox.y == y1 ? screenHeight - panelHeight : screenHeight;
this._windowHeight = screenHeight;
break;
case RIGHT_EDGE:
let width = this._evaluateSizeSpec(sizeSpec, false);
this._windowX = x2 - width;
this._windowY = panelBox.y == y1 ? y1 + panelBox.height: y1;
this._windowY = y1;
this._windowWidth = width;
this._windowHeight = panelBox.y == y1 ? screenHeight - panelHeight : screenHeight;
this._windowHeight = screenHeight;
break;
case BOTTOM_EDGE:
let height = this._evaluateSizeSpec(sizeSpec, true);
this._windowX = x1;
this._windowY = panelBox.y + panelBox.height == y2 ? y2 - panelBox.height - height: y2 - height;
this._windowY = y2 - height;
this._windowWidth = screenWidth;
this._windowHeight = height;
break;
default:
case TOP_EDGE:
this._windowX = x1;
this._windowY = panelBox.y == y1 ? y1 + panelBox.height: y1;
this._windowY = y1;
this._windowWidth = screenWidth;
this._windowHeight = this._evaluateSizeSpec(sizeSpec, true);
break;
Expand Down