Skip to content

Instantly share code, notes, and snippets.

@nt1m
Last active February 25, 2017 14:23
Show Gist options
  • Save nt1m/4a537bbe03a7753f4e35df31a7765df7 to your computer and use it in GitHub Desktop.
Save nt1m/4a537bbe03a7753f4e35df31a7765df7 to your computer and use it in GitHub Desktop.
browser.region WebExtension proposal

Interacting with current regions

Supported region IDs

  • navigation_bar
  • tabs_bar
  • find_bar
  • {side}_{end/start}
    • where side is top/left/right/bottom
  • Possibly more UI regions unlikely to change (future proof)

the "browser_region_tweak" manifest field

{
  "browser_region_tweak": {
    "<region_id>": {
      after: "<other_region_id>",
      visible: false/true,
    } 
  }
}

Example usage: moving the findbar to the top

{
   ...
   "browser_region_tweak": {
     "find_bar": {
       "after": "top_end"
     }
   }
}

Example usage: Tabs on bottom

{
  "browser_region_tweak": {
    "tabs_bar": {
      "after": "navigation_bar",
    }
  }
}

Example usage: Hiding built-in tabs-bar

{
  "browser_region_tweak": {
    "tabs_bar": {
      "visible": false
    }
  }
}

Making this API safe

  • You can't move a toolbar from top/bottom to left/right, for obvious reasons...
    • This triggers a manifest error when installing the add-on that prevents you from installing it
  • Do we want to allow hiding the navigation bar? Seems quite unsafe
  • Precedence needs to be handled properly, if multiple add-ons register some conflicting tweaks, we should handle them as we handle multiple new tab page overrides

Issues

  • support for dynamic changes (is that really a common use-case to move the toolbar when browsing?)
  • what happens when one UI region is deprecated ?
    • tweaks affecting that region no longer work (since it no longer exists)
    • as for the "after" field, navigation_bar/tabs_bar could fallback to top_start/end ?
    • Although we might want to be safe and pick some regions that are unlikely going to be removed

Registering a new region: "browser_region" manifest field

Registers a new region. Takes the following options:

- title: <string>
- after: <region_id>
- default_block_size: <number> <!-- corresponds to the height for a toolbar, the width for a sidebar -->
- url: <string> <!-- iframe URL -->
- customizable: <boolean> <!-- changeable in customization mode, setting the url option sets customizable to false -->

browser.region namespace

  • setBlockSize

Integration with existing APIs

??

@nt1m
Copy link
Author

nt1m commented Feb 23, 2017

@Quicksaver Hey, I put up a small draft after reading 0. The theming proposal I previously put up is not meant to cover that email (that I did not read at the time), but rather as a replacement of complete/lw themes. Do you have ideas/solutions/use cases you'd like to add ?

Also, just heads up about a few things you might be interested in:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment