-
-
Notifications
You must be signed in to change notification settings - Fork 184
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
Add an option to add gaps or not when only on window is displayed in a workspace #479
base: main
Are you sure you want to change the base?
Add an option to add gaps or not when only on window is displayed in a workspace #479
Conversation
// Never apply gaps if App Launcher is the only tileable | ||
this.msWorkspace.tileableList.length < 2 | ||
|| this.tileableListVisible.length === 0 | ||
|| (this.tileableListVisible.length === 1 && !getSettings('layouts').get_boolean('gap-single-tileable')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abstract the setting in the layoutManager like the others 4 lines aboves
(tileable) => tileable.visible | ||
(_, index) => this.msWorkspace.focusedIndex === index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary?
tileTileable(tileable, box, index, siblingLength) { | ||
// Do nothing if App Launcher is the only tileable | ||
if (index === 0 && siblingLength === 1) { | ||
tileable.x = box.x1; | ||
tileable.y = box.y1; | ||
tileable.width = box.get_width(); | ||
tileable.height = box.get_height(); | ||
} else { | ||
let x, y, width, height; | ||
let verticalPortion = this.vertical | ||
? box.get_height() / this.state.nbOfColumns | ||
: box.get_height(); | ||
let horizontalPortion = this.vertical | ||
? box.get_width() | ||
: box.get_width() / this.state.nbOfColumns; | ||
if (this.activeTileableList.includes(tileable)) { | ||
let activeIndex = this.activeTileableList.indexOf(tileable); | ||
if (this.vertical) { | ||
x = box.x1; | ||
y = box.y1 + activeIndex * verticalPortion; | ||
} else { | ||
x = box.x1 + activeIndex * horizontalPortion; | ||
y = box.y1; | ||
} | ||
} else { | ||
tileTileable(tileable, box) { | ||
let x, y, width, height; | ||
const nbrOfColumns = Math.min( | ||
this.state.nbOfColumns, this.tileableListVisible.length | ||
); | ||
|
||
let verticalPortion = this.vertical | ||
? box.get_height() / nbrOfColumns | ||
: box.get_height(); | ||
let horizontalPortion = this.vertical | ||
? box.get_width() | ||
: box.get_width() / nbrOfColumns; | ||
|
||
if (this.activeTileableList.includes(tileable)) { | ||
let activeIndex = this.activeTileableList.indexOf(tileable); | ||
|
||
if (this.vertical) { | ||
x = box.x1; | ||
y = box.y1 + activeIndex * verticalPortion; | ||
} else { | ||
x = box.x1 + activeIndex * horizontalPortion; | ||
y = box.y1; | ||
} | ||
} else { | ||
x = box.x1; | ||
y = box.y1; | ||
} | ||
|
||
width = horizontalPortion; | ||
height = verticalPortion; | ||
width = horizontalPortion; | ||
height = verticalPortion; | ||
|
||
let { | ||
x: gapX, | ||
y: gapY, | ||
width: gapWidth, | ||
height: gapHeight, | ||
} = this.applyGaps(x, y, width, height); | ||
let { | ||
x: gapX, | ||
y: gapY, | ||
width: gapWidth, | ||
height: gapHeight, | ||
} = this.applyGaps(x, y, width, height); | ||
|
||
tileable.x = gapX; | ||
tileable.y = gapY; | ||
tileable.width = gapWidth; | ||
tileable.height = gapHeight; | ||
} | ||
tileable.x = gapX; | ||
tileable.y = gapY; | ||
tileable.width = gapWidth; | ||
tileable.height = gapHeight; | ||
} | ||
|
||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is related to resizeable portion no?
As suggested by @Screwtapello here #399 (comment), maybe we should update this PR to add or not border gaps in all layouts |
No description provided.