diff --git a/usr/share/gnome-shell/extensions/menu@linuxmint.com/extension.js b/usr/share/gnome-shell/extensions/menu@linuxmint.com/extension.js index 1636b35..fbd2a9a 100644 --- a/usr/share/gnome-shell/extensions/menu@linuxmint.com/extension.js +++ b/usr/share/gnome-shell/extensions/menu@linuxmint.com/extension.js @@ -145,14 +145,21 @@ PlaceCategoryButton.prototype = { }; Signals.addSignalMethods(PlaceCategoryButton.prototype); -function FavoritesButton(app) { - this._init(app); +function FavoritesButton(app, nbFavorites) { + this._init(app, nbFavorites); } FavoritesButton.prototype = { - _init: function(app) { + _init: function(app, nbFavorites) { this.actor = new St.Button({ reactive: true, style_class: 'applications-menu-favorites-button' }); - this.actor.set_child(app.create_icon_texture(FAV_ICON_SIZE)); + + let monitorHeight = Main.layoutManager.primaryMonitor.height; + let real_size = (0.7*monitorHeight) / nbFavorites; + let icon_size = 0.6*real_size; + if (icon_size>FAV_ICON_SIZE) icon_size = FAV_ICON_SIZE; + this.actor.style = "padding-top: "+(icon_size/3)+"px;padding-bottom: "+(icon_size/3)+"px;padding-left: "+(icon_size/3)+"px;padding-right: "+(icon_size/3)+"px;" + + this.actor.set_child(app.create_icon_texture(icon_size)); //this.actor.set_tooltip_text(app.get_name()); #Doesn't appear in the right place this._app = app; @@ -409,6 +416,10 @@ ApplicationsButton.prototype = { global.stage.set_key_focus(this.searchEntry); this._selectedItemIndex = null; this._activeContainer = null; + let scrollBoxHeight = this.favoritesBox.get_allocation_box().y2-this.favoritesBox.get_allocation_box().y1 + -(this.searchBox.get_allocation_box().y2-this.searchBox.get_allocation_box().y1); + if (scrollBoxHeight<300) scrollBoxHeight = 300; + this.applicationsScrollBox.style = "height: "+scrollBoxHeight+"px;"; } else { this.resetSearch(); this._clearSelections(this.categoriesBox); @@ -494,12 +505,12 @@ this.applicationsByCategory[dir.get_menu_id()].push(app); //Load favorites let launchers = global.settings.get_strv('favorite-apps'); -let appSys = Shell.AppSystem.get_default(); + let appSys = Shell.AppSystem.get_default(); let j = 0; for ( let i = 0; i < launchers.length; ++i ) { -let app = appSys.lookup_app(launchers[i]); + let app = appSys.lookup_app(launchers[i]); if (app) { - let button = new FavoritesButton(app, this.menu); + let button = new FavoritesButton(app, launchers.length); this.favoritesBox.add_actor(button.actor); button.actor.connect('enter-event', Lang.bind(this, function() { this.selectedAppTitle.set_text(button._app.get_name()); @@ -513,6 +524,7 @@ let app = appSys.lookup_app(launchers[i]); ++j; } } + let applicationsTitle = new St.Label({ style_class: 'applications-title', text: "Applications" });