MCPcopy
hub / github.com/paperwm/PaperWM / switchLinear

Method switchLinear

tiling.js:1096–1123  ·  view source on GitHub ↗
(dir, loop)

Source from the content-addressed store, hash-verified

1094 }
1095
1096 switchLinear(dir, loop) {
1097 let index = this.selectedIndex();
1098 let column = this[index];
1099 if (!column)
1100 return false;
1101 let row = column.indexOf(this.selectedWindow);
1102 if (Lib.in_bounds(column, row + dir) === false) {
1103 index += dir;
1104 if (loop) {
1105 if (index >= this.length) {
1106 index = 0;
1107 } else if (index < 0) {
1108 index = this.length - 1;
1109 }
1110 }
1111 if (dir === 1) {
1112 if (index < this.length)
1113 row = 0;
1114 } else if (index >= 0)
1115 row = this[index].length - 1;
1116 } else {
1117 row += dir;
1118 }
1119
1120 let metaWindow = this.getWindow(index, row);
1121 ensureViewport(metaWindow, this);
1122 return true;
1123 }
1124
1125 switchLeft(loop) { return this.switch(Meta.MotionDirection.LEFT, loop); }
1126 switchRight(loop) { return this.switch(Meta.MotionDirection.RIGHT, loop); }

Callers 1

setupActionsFunction · 0.80

Calls 4

selectedIndexMethod · 0.95
getWindowMethod · 0.95
ensureViewportFunction · 0.85
indexOfMethod · 0.80

Tested by

no test coverage detected