meain/blog

May 17, 2024 . 3 min

Firefox bookmark keywords for faster navigation

A short entry on how you can use bookmark keywords in Firefox to speed up navigating to common pages.

Not sure how many folks are aware of this, but Firefox lets you create “keywords” for bookmarks which can be used to directly navigate to a page. For example, if you often go into GitHub notifications page, you can create a bookmark for it and add a short keyword. I personally use gn as the keyword.

Screenshot of edit bookmark dialog in FireFox

With this, whenever I want to go to GitHub navigations page, I would do ctrl+t > gn > enter. Very easy to remember and after you use it for a while, it becomes second nature.

Screenshot of me using gn to navigate

This on its own is pretty neat and I have a lot of such bookmarks with keywords, but one very powerful usecase I have this is for GitHub repos, ie link all the pages within a repo that you visit with a common prefix. Let me show you an example for NixOS/nixpkgs repo. I use nip as the common prefix for nixpkgs.

... and more, but you get the idea. Adding this manually can get a bit tiring, but is totally worth it if you were to ask me. I do however add these via nix which makes it a lot easier.

UPDATE: Using bookmark keywords with text substitution

Lobsters user pushcx and donio pointed out that we can use this along with %s so that FF would substitute text we type after that. This could come in really handy for cases like GH PRs, linear tickets or search engines.

Screenshot of FF bookmark with %s field

Here are few examples to give you an idea of how to use it:

Using nix to simplify creating bookmarks #

You can find my FF nix config in my dotfiles

Here is an example of generic bookmarks in my nix FF config:

[
{
name = "GitHub Notifications";
keyword = "gn";
url = "https://github.com/notifications";
}
{
name = "Calendar";
keyword = "gcal";
url = "https://calendar.google.com/calendar/r";
}
{
name = "Email";
keyword = "gmail";
url = "https://mail.google.com/mail/u/0/#inbox";
}
{
name = "Outlook Calendar";
keyword = "ocal";
url = "https://outlook.office.com/calendar/view/month";
}
{
name = "Outlook Mail";
keyword = "omail";
url = "https://outlook.office.com/mail/inbox";
}
{
name = "Syncthing";
keyword = "sync";
url = "http://localhost:8384/";
}
]

Now to get to how I do GitHub bookmarks in nix. I have a utility function named gh-bookmarks defined in utils.nix in my config.

gh-bookmarks = { repo, basename, basekeyword }:
[
{
name = basename;
tags = [ "github" ];
keyword = basekeyword;
url = "https://github.com/" + repo;
}
{
name = basename + " Issues";
tags = [ "github" ];
keyword = basekeyword + "i";
url = "https://github.com/" + repo + "/issues";
}
{
name = basename + " Issues Assigned to me";
tags = [ "github" ];
keyword = basekeyword + "im";
url = "https://github.com/" + repo + "/issues/assigned/@me";
}
{
name = basename + " Pull Requests";
tags = [ "github" ];
keyword = basekeyword + "p";
url = "https://github.com/" + repo + "/pulls";
}
{
name = basename + " Pull Requests Assigned to me";
tags = [ "github" ];
keyword = basekeyword + "pm";
url = "https://github.com/" + repo + "/pulls/assigned/@me";
}
{
name = basename + " Pull Requests Review Requested to me";
tags = [ "github" ];
keyword = basekeyword + "pr";
url = "https://github.com/" + repo + "/pulls/review-requested/@me";
}
{
name = basename + " Pull Requests Review Requested to me and not approved";
tags = [ "github" ];
keyword = basekeyword + "prr";
url = "https://github.com/" + repo + "/pulls?q=is%3Aopen+is%3Apr+review-requested%3A%40me+-review%3Aapproved";
}
{
name = basename + " Actions";
tags = [ "github" ];
keyword = basekeyword + "a";
url = "https://github.com/" + repo + "/actions";
}
{
name = basename + " Queue";
tags = [ "github" ];
keyword = basekeyword + "q";
url = "https://github.com/" + repo + "/queue/main";
}
{
name = basename + " Queue";
tags = [ "github" ];
keyword = basekeyword + "qq";
url = "https://github.com/" + repo + "/queue/master";
}
]

And then I use this to generate bookmarks like below(code in dotfiles):

utils.gh-bookmarks {
repo = "NixOS/nixpkgs";
basename = "nixpkgs";
basekeyword = "nip";
} ++
utils.gh-bookmarks {
repo = "meain/dotfiles";
basename = "dotfiles";
basekeyword = "dot";
}

Now every time I start working on a new repo, I have to add 5 lines and get all the bookmarks for that repo with a home-manager switch.

← Home