Skip to content

Commit

Permalink
Added config option to hide packages globally (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
andersevenrud committed Dec 23, 2020
1 parent d120d14 commit 3015d88
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ export const defaultConfiguration = {

packages: {
manifest: '/metadata.json',
metadata: []
metadata: [],
hidden: []
},

// FIXME: Move into packages above ?!
Expand Down
1 change: 1 addition & 0 deletions src/desktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,7 @@ export default class Desktop extends EventEmitter {
*/
getRect() {
const root = this.core.$root;
// FIXME: Is this now wrong because panels are not on the root anymore ?!
const {left, top, right, bottom} = this.subtract;
const width = root.offsetWidth - left - right;
const height = root.offsetHeight - top - bottom;
Expand Down
6 changes: 6 additions & 0 deletions src/packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ export default class Packages {

const user = this.core.getUser();
const metadata = this.metadata.map(m => ({...m}));
const hidden = this.core.config('packages.hidden', []);

const filterGroups = iter => {
const m = iter.strictGroups === false ? 'some' : 'every';
Expand All @@ -422,9 +423,14 @@ export default class Packages {
? user.blacklist.indexOf(iter.name) === -1
: true;

const filterConfigHidden = iter => hidden instanceof Array
? hidden.indexOf(iter.name) === -1
: true;

return metadata
.filter(filterGroups)
.filter(filterBlacklist)
.filter(filterConfigHidden)
.filter(filter);
}

Expand Down

0 comments on commit 3015d88

Please sign in to comment.