matryer / matryer/xbar-plugins

notifications.30s.py: add support for Discussions notifications

Open
#1,985 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
2.6k
Forks
1.1k
Avg merge
9d 15h
Merged PRs (30d)
1

Description

Problem

As-is the GitHub Notifications xbar script does not support opening Discussions notifications.

Solution

So, I've added a rudimentary way of opening repo Discussions, filtering the search to show the discussion with the correct title. You will have to click into it to read it.

This is less than ideal, but better than nothing.

How

  1. add this near the top of def format_notification(notification): after the formatted = ... definition
    if type == "Discussion":
        formatted["href"]= notification["repository"]["html_url"] + "/discussions?discussions_q=" + urllib.parse.quote(formatted["title"])
  1. add this image data for Discussions notifications:
    elif type == "Discussion":
        formatted[
            "image"
        ] = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAjklEQVR42qXMtUHFYBRA4Q/WyF5UlMgOuLtNFanYIm2kwi8Oz/WcX68Zz4rKW4+VFX80cvs9Fmp/hF297Ancq6yMKlhSqIcX/N3zFzRSGxKwbMeHMs1/wbpW2MK18G1rrWuSsOdauLNo4UNIbPxN8qIU7gCFE2z7n+RE6xDAhXBlTxjKnVB6MIIztVOT8A7rHFO4O8LaZAAAAABJRU5ErkJggg=="
        formatted["templateImage"] = formatted.pop("image")

To Do

  • figure out the URL to open to the individual discussion directly

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open notifications.30s.py and inspect format_notification(notification), especially how existing notification types set href and templateImage. Verify a Discussion notification displays its icon and opens the repository Discussions search for the matching title; improving this to open the individual discussion remains a follow-up noted in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.