erikw / tmux-powerline

⚡️ A tmux plugin giving you a hackable status bar consisting of dynamic & beautiful looking powerline segments, written purely in bash.
BSD 3-Clause "New" or "Revised" License
3.41k stars 513 forks source link

New segment github_notifications #431

Closed xx4h closed 2 months ago

xx4h commented 4 months ago

Introducing a new segment for displaying your github notifications, fully customizable, only showing what you want to see and in the way you want to see it.

Symbol mode (default)

image

Abbreviation mode

image

abbreviation notification type
areq approval_requested
as assign
au author
co comment
ci ci_activity
in invitation
ma manual
me mention
rreq review_requested
sec security_alert
sc state_change
sub subscribed
t team_mention

Summarize mode

image

Settings

# github_notifications.sh {
    # Github token (https://github.com/settings/tokens) with at least "notifications" scope
    export TMUX_POWERLINE_SEG_GITHUB_NOTIFICATIONS_TOKEN="YOUR_TOKEN"

    # Include available notification reasons (https://docs.github.com/en/rest/activity/notifications?apiVersion=2022-11-28#about-notification-reasons),
    # in the format "REASON:SEPARATOR"
    export TMUX_POWERLINE_SEG_GITHUB_NOTIFICATIONS_REASONS="approval_requested:-󰴄 |assign:-󰎔 |author:-󰔗 |comment:- |ci_activity:-󰙨 |invitation:- |manual:-󱥃 |mention:- |review_requested:- |security_alert:-󰒃 |state_change:-󱇯 |subscribed:- |team_mention:- "
    # Or if you don't like so many symbols, try the abbreviation variant
    export TMUX_POWERLINE_SEG_GITHUB_NOTIFICATIONS_REASONS="approval_requested:areq|assign:as|author:au|comment:co|ci_activity:ci|invitation:in|manual:ma|mention:me|review_requested:rreq|security_alert:sec|state_change:st|subscribed:su|team_mention:team"

        # So in case you only want to see review requests and when someone is mentioning you
        export TMUX_POWERLINE_SEG_GITHUB_NOTIFICATIONS_REASONS="review_requested:areq|mention:me"
        # this way, all other notifications reasons are ignored.
        # You can also change the abbreviation so you save some space in your statusline
        export TMUX_POWERLINE_SEG_GITHUB_NOTIFICATIONS_REASONS="review_requested:r|mention:m"
        # Or even use an symbol instead
        export TMUX_POWERLINE_SEG_GITHUB_NOTIFICATIONS_REASONS="review_requested:👁|mention:🙋"

    # Use symbol mode (ignored if you set TMUX_POWERLINE_SEG_GITHUB_NOTIFICATIONS_REASONS yourself)
    export TMUX_POWERLINE_SEG_GITHUB_NOTIFICATIONS_SYMBOL_MODE="yes"

    # Summarize all notifications
    export TMUX_POWERLINE_SEG_GITHUB_NOTIFICATIONS_SUMMARIZE="yes"

    # Hide if no notifications
    export TMUX_POWERLINE_SEG_GITHUB_NOTIFICATIONS_HIDE_NO_NOTIFICATIONS="no"

    # Only show new notifications since date (default: today)
    export TMUX_POWERLINE_SEG_GITHUB_NOTIFICATIONS_SINCE="2024-05-30T00:00:00Z"

    # Enable show only notifications since date
    export TMUX_POWERLINE_SEG_GITHUB_NOTIFICATIONS_SINCE_ENABLE="no"

    # Maximum notifications to retreive (upstream github default per_page)
    export TMUX_POWERLINE_SEG_GITHUB_NOTIFICATIONS_PER_PAGE="50"

    # Maximum pages to retreive
    export TMUX_POWERLINE_SEG_GITHUB_NOTIFICATIONS_MAX_PAGES="10"

    # Update interval to pull latest state from github api
    export TMUX_POWERLINE_SEG_GITHUB_NOTIFICATIONS_UPDATE_INTERVAL="60"

    # Enable Test Mode (to test how the segment will look like when you have notifications for all types/reasons)
    export TMUX_POWERLINE_SEG_GITHUB_NOTIFICATIONS_TEST_MODE="no"

# }

Known issues: