Skip to content

rberenguel/nt

Repository files navigation

NT (new tab)

A customizable new tab extension for Chrome.

What does it do?

This is inspired by something I use somewhere else, but way easier to customize and tweak. It lets you:

  • Have large named timezones anywhere,
  • Rotates backgrounds from a list on new tab,
  • Add lists of iframes,
  • Offers quicklinks,
  • Can be edited and customized by changing its code (see Tweaking.

What are quicklinks?

In short, they are just URLs in the middle of the new tab (or anywhere you put them). But they can have optionally shortcuts, which makes them way faster to open.

In the basic examples of the screenshot below, there are a bunch of quicklinks for Google stuff. If you want to open Google, you can press g (it will highlight all links that match) and then o to go to Google. To access this functionality after creating a new tab with Cmd-Tab (or whatever creates a new tab in your computer), press ESC to switch focus to the page. So, the flow would be Cmd-Tab ESC g o

Shortcuts are optional, you can find more about how to set links up in general in the linkUtils.js file.

Shortcuts can be more than one letter as long as they do not overlap. So, don't use gg for one link and gga for another: gg will capture your keys first. If you want to have a lot of links, you can optionally add columns, separators and tweak the font size and any other properties of the container div without needing to modify the CSS (even if it is available to edit, it is always a hassle).

Why vanilla Javascript, and why not publish it as a "real" extension?

The whole point I had in writing this was having access to everything in the extension without needing to rebuild it. By using vanilla, run-of-the-mill JS not only I can avoid a build toolchain, but adding any new functionality is as easy as opening any text editor and adding it to some Utils.js file. Changing styles? Just change style.css. Adding backgrounds? Same, you get the idea.

As such, packaging this as an extension makes no sense: once packed it is not customizable, it has no settings, no background worker, no ObjectStorage (well, almost no storage). Configuration is code. Or text, because links and tasks can be configured by writing a semi-structured form of Markdown.

Installing

  • Clone or download (remember then to unzip) this repository somewhere.
  • In Chrome, More tools > Extensions
  • In Chrome > Extensions, Enable developer mode.
  • Click Load unpacked, then browse to where you downloaded the repository

When you enable it, the first time you create a new tab it will ask for confirmation that you are happy.

Tweaking

Just edit the source you have downloaded, and in the Chrome Extensions manager, click update (many times this is not even needed, just a refresh or recreate the new tab).

This is thrown together in one folder on purpose, to make it easier to edit without wondering where anything is. Everything is in this folder (except for backgrounds).

I will add some more documentation of the functions you can use at some point, but they should be pretty descriptive.

Note that index.html points to local_main.js, which is gitignored. This is because I pass my local basepath so I can edit tasks with VS Code. Other than that, it is exactly the same as main.js.

Safari?

Extension auto-porting, as I tried for bestBefore works, although it is not as convenient as direct-edit when using Chrome.

After cloning, run (I did it in another folder at the same level):

xcrun safari-web-extension-converter ../nt

It will automatically open the generated Xcode project: the project references the assets in the original, cloned folder: any changes you make to the Chrome extension source can then propagate to the Safari extension by rebuilding the project in Xcode.

You might need to set up signing (in theory for local running it is not needed), but that is free with an Apple account, just a bit annoying to do the first time. If you don't want the iOS extension (I'm interested, but installing extensions on iOS is annoying, and requires the 7+ GB of the iOS toolchain) remove the references to the iOS "apps" from the project hierarchy in Xcode. Finally, follow the instructions in the autoporting documentation.

To avoid creating the iOS version, run instead:

xcrun safari-web-extension-converter --macos-only --force PATH

Image credits

All images are algorithmic art pieces I have created, see mostlymaths.net/sketches

Tests

  • The task parser has some unit tests here
  • The task renderer has some unit tests here, it depends on the parser working.
  • Both together here

Attribution

About

Customizable new tab for Chrome

Resources

License

Stars

Watchers

Forks

Languages