diff --git a/package/contents/ui/config.ui b/package/contents/ui/config.ui
index 19d9c60..7be86c3 100644
--- a/package/contents/ui/config.ui
+++ b/package/contents/ui/config.ui
@@ -49,6 +49,16 @@
+ -
+
+
+ Wrap column navigation at edges
+
+
+ Moving focus or a column past the last one jumps back to the first, and vice versa
+
+
+
-
diff --git a/src/lib/config/config.ts b/src/lib/config/config.ts
index 0f22600..8c9396e 100644
--- a/src/lib/config/config.ts
+++ b/src/lib/config/config.ts
@@ -27,4 +27,5 @@ interface Config {
floatingKeepAbove: boolean;
windowRules: string;
tiledDesktops: string;
+ wrapColumns: boolean;
}
diff --git a/src/lib/config/definition.ts b/src/lib/config/definition.ts
index 3a76fea..9e5437c 100644
--- a/src/lib/config/definition.ts
+++ b/src/lib/config/definition.ts
@@ -204,4 +204,10 @@ const configDef = [
type: "String",
default: ".*",
},
+
+ {
+ name: "wrapColumns",
+ type: "Bool",
+ default: false,
+ },
];
diff --git a/src/lib/layout/Grid.ts b/src/lib/layout/Grid.ts
index e4aa914..32510f4 100644
--- a/src/lib/layout/Grid.ts
+++ b/src/lib/layout/Grid.ts
@@ -60,11 +60,19 @@ class Grid {
}
public getLeftColumn(column: Column) {
- return this.columns.getPrev(column);
+ const prev = this.columns.getPrev(column);
+ if (prev === null && this.config.wrapColumns) {
+ return this.columns.getLast();
+ }
+ return prev;
}
public getRightColumn(column: Column) {
- return this.columns.getNext(column);
+ const next = this.columns.getNext(column);
+ if (next === null && this.config.wrapColumns) {
+ return this.columns.getFirst();
+ }
+ return next;
}
public getFirstColumn() {
diff --git a/src/lib/layout/LayoutConfig.ts b/src/lib/layout/LayoutConfig.ts
index 535041a..a4c634e 100644
--- a/src/lib/layout/LayoutConfig.ts
+++ b/src/lib/layout/LayoutConfig.ts
@@ -11,4 +11,5 @@ interface LayoutConfig {
tiledKeepBelow: boolean;
maximizedKeepAbove: boolean;
untileOnDrag: boolean;
+ wrapColumns: boolean;
}
diff --git a/src/lib/world/World.ts b/src/lib/world/World.ts
index b70d83a..8b5f7eb 100644
--- a/src/lib/world/World.ts
+++ b/src/lib/world/World.ts
@@ -52,6 +52,7 @@ class World {
tiledKeepBelow: config.tiledKeepBelow,
maximizedKeepAbove: config.floatingKeepAbove,
untileOnDrag: config.untileOnDrag,
+ wrapColumns: config.wrapColumns,
};
this.desktopManager = new DesktopManager(