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

Method selectStackSpace

tiling.js:3034–3115  ·  view source on GitHub ↗
(direction, move)

Source from the content-addressed store, hash-verified

3032 }
3033
3034 selectStackSpace(direction, move) {
3035 // if in sequence preview do not run stack preview
3036 if (inPreview === PreviewMode.SEQUENTIAL) {
3037 return;
3038 }
3039
3040 const scale = 0.9;
3041 let space = this.activeSpace;
3042 let mru = [...this.stack];
3043
3044 this.monitors.forEach(space => mru.splice(mru.indexOf(space), 1));
3045 mru = [space, ...mru];
3046
3047 if (!inPreview) {
3048 this.initWorkspaceStack();
3049 }
3050
3051 let from = mru.indexOf(this.selectedSpace);
3052 let newSpace = this.selectedSpace;
3053 let to = from;
3054 if (move && this.selectedSpace.selectedWindow) {
3055 takeWindow(this.selectedSpace.selectedWindow,
3056 this.selectedSpace,
3057 { navigator: Navigator.getNavigator() });
3058 }
3059
3060 if (direction === Meta.MotionDirection.DOWN)
3061 to = from + 1;
3062 else
3063 to = from - 1;
3064
3065 // wrap around workspaces
3066 if (to < 0) {
3067 to = mru.length - 1;
3068 }
3069 else if (to >= mru.length) {
3070 to = 0;
3071 }
3072
3073 if (to === from && Easer.isEasing(newSpace.actor)) {
3074 return;
3075 }
3076
3077 newSpace = mru[to];
3078 this.selectedSpace = newSpace;
3079
3080 // if active (source space) is panelMonitor update indicator
3081 if (space.monitor === Topbar.panelMonitor()) {
3082 Topbar.updateWorkspaceIndicator(newSpace.index);
3083 }
3084
3085 mru.forEach((space, i) => {
3086 let actor = space.actor;
3087 let h, onComplete = () => { };
3088 if (to === i)
3089 h = StackPositions.selected;
3090 else if (to + 1 === i)
3091 h = StackPositions.up;

Callers 7

moveToMonitorMethod · 0.95
swapMonitorMethod · 0.95
updateVerticalFunction · 0.80
selectPreviousSpaceFunction · 0.80
movePreviousSpaceFunction · 0.80

Calls 5

initWorkspaceStackMethod · 0.95
takeWindowFunction · 0.85
indexOfMethod · 0.80
hideMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected