Skip to content

Commit

Permalink
window: optimize maximized/tiled getters
Browse files Browse the repository at this point in the history
  • Loading branch information
jonian committed Sep 25, 2022
1 parent e255da5 commit d0f5817
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions unite@hardpixel.eu/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,20 +206,16 @@ var MetaWindow = GObject.registerClass(
return this.win.minimized
}

get anyMaximized() {
return this.win.maximized_horizontally || this.win.maximized_vertically
}

get maximized() {
return this.win.maximized_horizontally && this.win.maximized_vertically
}

get tiled() {
if (this.maximized) {
return false
} else {
return this.win.maximized_horizontally || this.win.maximized_vertically
}
}

get bothMaximized() {
return this.maximized || this.tiled
return !this.maximized && this.anyMaximized
}

get restrictToPrimary() {
Expand Down Expand Up @@ -331,7 +327,7 @@ var MetaWindow = GObject.registerClass(
case 'never': return false
case 'tiled': return this.handleScreen && this.tiled
case 'maximized': return this.handleScreen && this.maximized
case 'both': return this.handleScreen && this.bothMaximized
case 'both': return this.handleScreen && this.anyMaximized
}
}

Expand Down

0 comments on commit d0f5817

Please # to comment.