Add an option to add gaps or not when only on window is displayed in a workspace#479
Open
NastuzziSamy wants to merge 4 commits intomaterial-shell:mainfrom
Open
Add an option to add gaps or not when only on window is displayed in a workspace#479NastuzziSamy wants to merge 4 commits intomaterial-shell:mainfrom
NastuzziSamy wants to merge 4 commits intomaterial-shell:mainfrom
Conversation
PapyElGringo
requested changes
Nov 18, 2020
| // 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')) |
Collaborator
There was a problem hiding this comment.
abstract the setting in the layoutManager like the others 4 lines aboves
| get tileableListVisible() { | ||
| return this.msWorkspace.tileableList.filter( | ||
| (tileable) => tileable.visible | ||
| (_, index) => this.msWorkspace.focusedIndex === index |
Comment on lines
-127
to
171
|
|
||
| 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; | ||
| } | ||
|
|
||
| /* |
Collaborator
There was a problem hiding this comment.
This is related to resizeable portion no?
Contributor
Author
|
As suggested by @Screwtapello here #399 (comment), maybe we should update this PR to add or not border gaps in all layouts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.