GNOME Bugzilla – Bug 652223
Keyboard shortcut for tab switch in LookingGlass
Last modified: 2011-10-21 13:22:48 UTC
It would be very handy to have a keyboard shortcut (Ctrl+Page{Up,Down} seems the most logical to me) to switch between the Evaluator, Windows, Errors and Extensions tabs.
(In reply to comment #0) > (Ctrl+Page{Up,Down} seems the most logical to me) yes, that matches the overview
Created attachment 198590 [details] [review] Add-Ctrl-PageUp-PageDown-key-shortcuts-for-switching.patch Adds Ctrl+PageUp/PageDown keyboard shortcuts for switching tabs in lookingGlass's notebook view.
Review of attachment 198590 [details] [review]: ::: js/ui/lookingGlass.js @@ +973,3 @@ + switch (symbol) { + case Clutter.KEY_Page_Up: + nextIndex = this._notebook._selectedIndex < this._notebook._tabs.length - 1 ? this._notebook._selectedIndex + 1 : this._notebook._selectedIndex; You shouldn't access private members like this. I'd rather something like: if (modifierState & Clutter.ModifierType.CONTROL_MASK) { if (symbol == Clutter.KEY_Page_Up) this._notebook.nextTab(); else if (symbol == Clutter.KEY_Page_Down) this._notebook.prevTab(); } and then implement _notebook.prevTab/nextTab in the proper way.
Created attachment 199607 [details] [review] Add Ctrl+PageUp/PageDown key shortcuts for switching tabs
Review of attachment 199607 [details] [review]: ::: js/ui/lookingGlass.js @@ +154,3 @@ + + nextTab: function() { + let nextIndex = this._selectedIndex < this._tabs.length - 1 ? this._selectedIndex + 1 : this._selectedIndex; Four-space indents. Additionally, I'd do something like: let nextIndex = this._selectedIndex; if (nextIndex < this._tabs.length - 1) nextIndex ++; @@ +159,3 @@ + + prevTab: function() { + let nextIndex = this._selectedIndex > 0 ? this._selectedIndex - 1 : 0; let prevIndex = this._selectedIndex; if (prevIndex > 0) prevIndex --; @@ +981,3 @@ + if (modifierState & Clutter.ModifierType.CONTROL_MASK) { + if (symbol == Clutter.KEY_Page_Up) { + this._notebook.nextTab(); This is opposite of how gnome-shell does it in the view selector (sorry, I got it backwards).
Created attachment 199611 [details] [review] Add Ctrl+PageUp/PageDown key shortcuts for switching tabs
Review of attachment 199611 [details] [review]: Looks fine. ::: js/ui/lookingGlass.js @@ +156,3 @@ + let nextIndex = this._selectedIndex; + if (nextIndex < this._tabs.length - 1) { + ++nextIndex; We tend to prefer postincrement, but it's not super important.
Review of attachment 199611 [details] [review]: Oh, before I forget, this is going to need a better commit message: lookingGlass: add Ctrl+PageUp/PageDown key shortcuts for switching tabs The view selector in the overview does it too, so why not here?
Attachment 199611 [details] pushed as a69ebc8 - Add Ctrl+PageUp/PageDown key shortcuts for switching tabs Thanks for submitting the patch!