Finish the kali menu patch for gnome-shell 3.34
Emilio Pozuelo Monfort
4 years ago
4 | 4 | Bug-Kali: https://bugs.kali.org/view.php?id=2223 |
5 | 5 | Bug: https://bugzilla.gnome.org/show_bug.cgi?id=739480 |
6 | 6 | --- |
7 | extensions/apps-menu/extension.js | 170 +++++++++++++++++++++++++++++++------- | |
8 | 1 file changed, 139 insertions(+), 31 deletions(-) | |
7 | extensions/apps-menu/extension.js | 165 ++++++++++++++++++++++++++++++-------- | |
8 | 1 file changed, 133 insertions(+), 32 deletions(-) | |
9 | 9 | |
10 | 10 | diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js |
11 | index 70383af..1e5b884 100644 | |
11 | index 70383af..294074a 100644 | |
12 | 12 | --- a/extensions/apps-menu/extension.js |
13 | 13 | +++ b/extensions/apps-menu/extension.js |
14 | 14 | @@ -97,30 +97,36 @@ class ApplicationMenuItem extends PopupMenu.PopupBaseMenuItem { |
222 | 222 | this.categoriesBox = new St.BoxLayout({ vertical: true }); |
223 | 223 | this.categoriesScrollBox.add_actor(this.categoriesBox); |
224 | 224 | |
225 | @@ -604,12 +673,32 @@ class ApplicationsButton extends PanelMenu.Button { | |
225 | @@ -604,19 +673,33 @@ class ApplicationsButton extends PanelMenu.Button { | |
226 | 226 | y_fill: true, |
227 | 227 | }); |
228 | 228 | section.actor.add_actor(this.mainBox); |
231 | 231 | + vscroll = this.categoriesBox.actor.get_vscroll_bar(); |
232 | 232 | + vscroll.connect('scroll-start', () => { this.menu.passEvents = true; }); |
233 | 233 | + vscroll.connect('scroll-stop', () => { this.menu.passEvents = false; }); |
234 | + this.leftBox.addMenuItem(this.categoriesBox); | |
235 | + // we re-add it to apply the right properties | |
236 | 234 | + this.leftBox.actor.add(this.categoriesBox.actor, { expand: true, |
237 | 235 | + x_fill: true, y_fill: true, |
238 | 236 | + y_align: St.Align.START }); |
239 | + | |
240 | + this.leftBox.actor.add(activities.actor, { expand: false, | |
241 | + x_fill: true, y_fill: false, | |
242 | + y_align: St.Align.START }); | |
243 | 237 | + this.mainBox.addMenuItem(this.leftBox); |
244 | 238 | + this.mainBox.actor.add(this._createVertSeparator(), { expand: false, |
245 | 239 | + x_fill: false, y_fill: true}); |
257 | 251 | |
258 | 252 | // Load categories |
259 | 253 | this.applicationsByCategory = {}; |
260 | @@ -629,10 +718,13 @@ class ApplicationsButton extends PanelMenu.Button { | |
254 | this._tree.load_sync(); | |
255 | let root = this._tree.get_root_directory(); | |
256 | let categoryMenuItem = new CategoryMenuItem(this, null); | |
257 | - this.categoriesBox.add_actor(categoryMenuItem); | |
258 | + this.categoriesBox.addMenuItem(categoryMenuItem); | |
259 | let iter = root.iter(); | |
260 | let nextType; | |
261 | while ((nextType = iter.next()) !== GMenu.TreeItemType.INVALID) { | |
262 | @@ -629,10 +712,13 @@ class ApplicationsButton extends PanelMenu.Button { | |
261 | 263 | |
262 | 264 | let categoryId = dir.get_menu_id(); |
263 | 265 | this.applicationsByCategory[categoryId] = []; |
275 | 277 | } |
276 | 278 | } |
277 | 279 | |
278 | @@ -641,9 +733,10 @@ class ApplicationsButton extends PanelMenu.Button { | |
280 | @@ -641,9 +727,10 @@ class ApplicationsButton extends PanelMenu.Button { | |
279 | 281 | |
280 | 282 | let themeContext = St.ThemeContext.get_for_stage(global.stage); |
281 | 283 | let scaleFactor = themeContext.scale_factor; |
288 | 290 | } |
289 | 291 | |
290 | 292 | selectCategory(dir) { |
291 | @@ -658,6 +751,21 @@ class ApplicationsButton extends PanelMenu.Button { | |
293 | @@ -658,6 +745,20 @@ class ApplicationsButton extends PanelMenu.Button { | |
292 | 294 | this._displayButtons(this._listApplications(dir.get_menu_id())); |
293 | 295 | else |
294 | 296 | this._displayButtons(this._listApplications(null)); |
295 | 297 | + |
296 | + if (categoryMenuItem) | |
297 | + this.updateOrnament(this.categoriesBox, categoryMenuItem); | |
298 | + } | |
299 | + | |
300 | + updateOrnament(menu_item, category_menu_item) { | |
298 | + this.updateOrnament(this.categoriesBox, dir); | |
299 | + } | |
300 | + | |
301 | + updateOrnament(menu_item, category_dir) { | |
301 | 302 | + menu_item._getMenuItems().forEach(sub_menu_item => { |
302 | 303 | + if (sub_menu_item.menu != undefined) |
303 | + this.updateOrnament(sub_menu_item.menu, category_menu_item); | |
304 | + if (sub_menu_item == category_menu_item) { | |
304 | + this.updateOrnament(sub_menu_item.menu, category_dir); | |
305 | + if (sub_menu_item._category == category_dir) { | |
305 | 306 | + sub_menu_item.setOrnament(PopupMenu.Ornament.CHECK); |
306 | 307 | + } else { |
307 | 308 | + sub_menu_item.setOrnament(PopupMenu.Ornament.NONE); |