8000 Add an option to add gaps or not when only on window is displayed in a workspace by NastuzziSamy · Pull Request #479 · material-shell/material-shell · GitHub
[go: up one dir, main page]

Skip to content

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
NastuzziSamy:feature-gaps-single-tileable
Open

Add an option to add gaps or not when only on window is displayed in a workspace#479
NastuzziSamy wants to merge 4 commits intomaterial-shell:mainfrom
NastuzziSamy:feature-gaps-single-tileable

Conversation

@NastuzziSamy
Copy link
Contributor

No description provided.

// 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'))
Copy link
Collaborator

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

get tileableListVisible() {
return this.msWorkspace.tileableList.filter(
(tileable) => tileable.visible
(_, index) => this.msWorkspace.focusedIndex === index
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary?

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;
}

/*
Copy link
Collaborator

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?

@NastuzziSamy
Copy link
Contributor Author

As suggested by @Screwtapello here #399 (comment), maybe we should update this PR to add or not border gaps in all layouts

Base automatically changed from master to main February 7, 2021 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0