Skip to content
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

added check for secondaryMonitor before accessing members #20

Merged
merged 3 commits into from
Mar 17, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/modScaleThumbnails.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ var Mod = class extends mod.Base {
// Thumbnails on main monitor
this.bkp_MAX_THUMBNAIL_SCALE = workspaceThumbnail.MAX_THUMBNAIL_SCALE
workspaceThumbnail.MAX_THUMBNAIL_SCALE = 0.1

// Thumbnails on second monitor
if (!SecondaryMonitorDisplay) return;
Copy link
Owner

@axxapy axxapy Mar 16, 2022

Choose a reason for hiding this comment

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

Looks great!

May I also ask you to remove all other changes except for this line? (as no other changes actually change anything).

Thank you

this.bkp_SecondaryMonitorDisplay_getThumbnailsHeight = SecondaryMonitorDisplay.prototype._getThumbnailsHeight
SecondaryMonitorDisplay.prototype._getThumbnailsHeight = function(box) {
if (!this._thumbnails.visible)
return 0;

const [width, height] = box.get_size();
const { expandFraction } = this._thumbnails;
const [thumbnailsHeight] = this._thumbnails.get_preferred_height(width);
return Math.min(
thumbnailsHeight * expandFraction,
height * workspaceThumbnail.MAX_THUMBNAIL_SCALE);
if (!this._thumbnails.visible)
return 0;
const [width, height] = box.get_size();
const { expandFraction } = this._thumbnails;
const [thumbnailsHeight] = this._thumbnails.get_preferred_height(width);
return Math.min(
thumbnailsHeight * expandFraction,
height * workspaceThumbnail.MAX_THUMBNAIL_SCALE);
}
}

Expand Down