tylersticka / bitbar-github-notifications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bitbar-github-notifications

An alternative to the official BitBar GitHub notifications plugin, re-written in JavaScript because I understand it and wanted to make some opinionated changes.

Prerequisites

To set up, you will need:

Installation

  1. Clone this repository somewhere on your Mac that you'll have permission to access from your BitBar plugin directory. Make note of the path.
  2. cd into the directory you created in the previous step and run npm ci to install dependencies.
  3. Create a new .js file in your BitBar directory, following BitBar's conventions for specifying the desired refresh time. For example, github-notifications.30s.js will refresh every 30 seconds.
  4. Populate the file with one of the below examples, taking care to update the path to your Node executable, the path to where you cloned this repository, and your personal access token.
  5. Run chmod +x filename.js to make sure BitBar will have permissions to run this file.

Example plugin

Basic

#!/usr/bin/env /path/to/your/node/executable

const plugin = require("path/to/bitbar-github-notifications");

plugin({
  token: "your GitHub token",
});

With options

#!/usr/bin/env /path/to/your/node/executable

const plugin = require("path/to/bitbar-github-notifications");

plugin({
  token: "your GitHub token",
  icon: "mark-github", // Use the GitHub favicon
  filter: (item) => {
    // Don't show PRs that bump dependency versions
    return !item.bitbar.text.includes("Bump");
  },
});

Options

  • token (required): Your GitHub personal access token.
  • icon: The octicon to use for the menu bar icon. Default: octoface.
  • filter: An optional callback function to filter results. Receives an object containing bitbar (data passed to the bitbar package) as well as any API data received along the way (potentially notification, thread and comment). Return false to remove a notification from the listing. (Note that "mark all as read" will mark all notifications as read, filtered or otherwise.)
  • group: If true, notifications are grouped by repository. Default: true
  • apiRoot: The GitHub API root path. Default: https://api.github.com/
  • inboxHref: Location of the Notification inbox. Default: https://github.com/notifications

About


Languages

Language:JavaScript 100.0%