Skip to content

Commit

Permalink
preference to open tab to right of current
Browse files Browse the repository at this point in the history
fixes brave#217
also part of brave#358
  • Loading branch information
psimyn committed Feb 29, 2016
1 parent 16cc524 commit 97a2339
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/locales/en-US/preferences.l20n
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@
<paintTabs "Show tabs in page theme color">
<tabsPerTabPage "Tabs per tab page">
<showTabPreviews "Show tab previews on hover">
<openNewTab "Open new tabs">
<toTheRight "to the right">
<atTheEnd "at the end">

/* Prviacy settings page */
/* Privacy settings page */
<suggestionTypes "When using the location bar, suggest:">
<history "History">
<bookmarks "Bookmarks">
Expand Down
7 changes: 7 additions & 0 deletions js/about/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ class SearchTab extends ImmutableComponent {
class TabsTab extends ImmutableComponent {
render () {
return <SettingsList>
<SettingItem dataL10nId='openNewTab'>
<select value={getSetting(this.props.settings, settings.NEW_TAB_POSITION)}
onChange={changeSetting.bind(null, settings.NEW_TAB_POSITION)} >
<option data-l10n-id='toTheRight' value='right'/>
<option data-l10n-id='atTheEnd' value='end'/>
</select>
</SettingItem>
<SettingItem dataL10nId='tabsPerTabPage'>
<input
type='number'
Expand Down
2 changes: 1 addition & 1 deletion js/constants/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const settings = {
PAINT_TABS: 'tabs.paint-tabs',
TABS_PER_TAB_PAGE: 'tabs.tabs-per-tab-page',
SHOW_TAB_PREVIEWS: 'tabs.show-tab-previews',
NEW_TAB_POSITION: 'tabs.new-tab-position',
// Privacy Tab
HISTORY_SUGGESTIONS: 'privacy.history-suggestions',
BOOKMARK_SUGGESTIONS: 'privacy.bookmark-suggestions',
Expand All @@ -26,4 +27,3 @@ const settings = {
}

module.exports = settings

3 changes: 3 additions & 0 deletions js/stores/windowStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ const doAction = (action) => {
} else if (action.frameOpts.isPartitioned) {
nextPartitionNumber = incrementPartitionNumber()
}
if (!action.frameOpts.parentFrameKey && getSetting(settings.NEW_TAB_POSITION) === 'right') {
action.frameOpts.parentFrameKey = windowState.get('activeFrameKey')
}
windowState = windowState.merge(FrameStateUtil.addFrame(windowState.get('frames'), action.frameOpts,
nextKey, nextPartitionNumber, action.openInForeground ? nextKey : windowState.get('activeFrameKey')))
if (action.openInForeground) {
Expand Down

0 comments on commit 97a2339

Please sign in to comment.