Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions src/auto_tiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class AutoTiler {
}

update_toplevel(ext: Ext, fork: Fork, monitor: number, smart_gaps: boolean) {
let rect = ext.monitor_work_area(monitor);
let rect = ext.monitor_work_area(monitor, fork.workspace);

fork.smart_gapped = smart_gaps && fork.right === null;

Expand All @@ -120,7 +120,7 @@ export class AutoTiler {

/** Attaches `win` to an optionally-given monitor */
attach_to_monitor(ext: Ext, win: ShellWindow, workspace_id: [number, number], smart_gaps: boolean) {
let rect = ext.monitor_work_area(workspace_id[0]);
let rect = ext.monitor_work_area(workspace_id[0], workspace_id[1]);

if (!smart_gaps) {
rect.x += ext.gap_outer;
Expand Down Expand Up @@ -153,7 +153,7 @@ export class AutoTiler {
if (monitor) {
if (fork.is_toplevel && fork.smart_gapped && fork.right) {
fork.smart_gapped = false;
let rect = ext.monitor_work_area(fork.monitor);
let rect = ext.monitor_work_area(fork.monitor, fork.workspace);

rect.x += ext.gap_outer;
rect.y += ext.gap_outer;
Expand Down Expand Up @@ -244,7 +244,7 @@ export class AutoTiler {
if (reflow_fork) {
const fork = reflow_fork[1];
if (fork.is_toplevel && ext.settings.smart_gaps() && fork.right === null) {
let rect = ext.monitor_work_area(fork.monitor);
let rect = ext.monitor_work_area(fork.monitor, fork.workspace);
fork.set_area(rect);
fork.smart_gapped = true;
}
Expand Down
9 changes: 6 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,11 @@ export class Ext extends Ecs.System<ExtEvent> {
this.row_size = this.settings.row_size() * this.dpi;
}

monitor_work_area(monitor: number): Rectangle {
const meta = wom.get_active_workspace().get_work_area_for_monitor(monitor);
monitor_work_area(monitor: number, workspace_idx?: number): Rectangle {
const ws = workspace_idx !== undefined && workspace_idx !== null
? wom.get_workspace_by_index(workspace_idx) ?? wom.get_active_workspace()
: wom.get_active_workspace();
const meta = ws.get_work_area_for_monitor(monitor);

return Rect.Rectangle.from_meta(meta as Rectangular);
}
Expand Down Expand Up @@ -2363,7 +2366,7 @@ export class Ext extends Ecs.System<ExtEvent> {
for (const f of this.auto_tiler.forest.forks.values()) {
if (!f.is_toplevel) continue;

const display = this.monitor_work_area(f.monitor);
const display = this.monitor_work_area(f.monitor, f.workspace);

if (display) {
const area = new Rect.Rectangle([display.x, display.y, display.width, display.height]);
Expand Down
6 changes: 3 additions & 3 deletions src/tiling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export class Tiler {

if (fork.is_toplevel && fork.smart_gapped) {
fork.smart_gapped = false;
let rect = ext.monitor_work_area(fork.monitor);
let rect = ext.monitor_work_area(fork.monitor, fork.workspace);

rect.x += ext.gap_outer;
rect.y += ext.gap_outer;
Expand Down Expand Up @@ -339,7 +339,7 @@ export class Tiler {

if (fork.is_toplevel && fork.smart_gapped) {
fork.smart_gapped = false;
let rect = ext.monitor_work_area(fork.monitor);
let rect = ext.monitor_work_area(fork.monitor, fork.workspace);

rect.x += ext.gap_outer;
rect.y += ext.gap_outer;
Expand Down Expand Up @@ -485,7 +485,7 @@ export class Tiler {
if (this.window) {
const monitor_id = ext.monitors.get(this.window);
if (monitor_id) {
const monitor = ext.monitor_work_area(monitor_id[0]);
const monitor = ext.monitor_work_area(monitor_id[0], monitor_id[1]);
let rect = this.rect(ext, monitor);

if (rect) {
Expand Down