Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visualize unread notifications and mark them as read with fzf #20

Closed
wants to merge 1 commit into from
Closed

Visualize unread notifications and mark them as read with fzf #20

wants to merge 1 commit into from

Conversation

LangLangBart
Copy link
Collaborator

Description

feature

  • Add a little colored dot next to notifications that are unread
  • add an hotkey to mark them as read with fzf

note

GIF

@LangLangBart
Copy link
Collaborator Author

Draft reason

Marked as draft because I'm not sure the line at the end is a reasonable idea. (Probably not)

gh notify "$Args"

I want fzf to stay open when marking notifications as read.

fzf offers a reload action and I managed to get it to work with the function below.

# list your starred repos, allow to unstar with fzf
function ghst {
	FZF_DEFAULT_COMMAND='gh api user/starred --template "
	{{- tablerow (\"REPO\" | color \"yellow+b\") \"⭐\" (\"LAST PUSH\" | color \"yellow+b\") (\"DESCRIPTION\" | color \"yellow+b\") -}}
	{{- range . -}}
		{{- tablerow (.full_name | color \"cyan+h\") (.stargazers_count | color \"yellow+h\") (timeago .pushed_at | color \"gray+h\") .description -}}
	{{- end -}}"' \
		GH_FORCE_TTY=100% fzf --ansi --no-multi \
		--header $'CTRL+B - Browser View | CTRL+F - Toggle README\nCTRL+U - Unstar       | CTRL+R - Toggle Release' \
		--header-lines=1 --preview "gh repo view {1}" --preview-window hidden \
		--bind 'enter:accept+execute(clear)' \
		--bind "ctrl-b:execute-silent(gh repo view {1} --web)" \
		--bind 'ctrl-f:toggle-preview+change-preview(gh repo view {1})' \
		--bind 'ctrl-r:toggle-preview+change-preview([[ $(gh release list -R {1}) ]] && gh release view -R {1})' \
		--bind 'ctrl-u:execute-silent(gh api -X DELETE /user/starred/{1})+reload(eval "$FZF_DEFAULT_COMMAND")'
}

I have not cracked the solution for an implementation with gh notify.
The line would look similar to the following.

	--bind 'ctrl-m:execute-silent(gh api -X PUT notifications -F read=true --silent)+reload(...)'

@LangLangBart
Copy link
Collaborator Author

see #21

@LangLangBart LangLangBart mentioned this pull request Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant