pgp: add customizable icons
Signed-off-by: Moritz Poldrack <git@moritz.sh> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
This commit is contained in:
parent
15a07e5892
commit
ecf47542cb
4 changed files with 71 additions and 4 deletions
|
@ -156,6 +156,16 @@ completion-delay=250ms
|
||||||
# Default: true
|
# Default: true
|
||||||
completion-popovers=true
|
completion-popovers=true
|
||||||
|
|
||||||
|
# Uncomment to use UTF-8 symbols to indicate PGP status of messages
|
||||||
|
#
|
||||||
|
# Default: ASCII
|
||||||
|
#icon-unencrypted=
|
||||||
|
#icon-encrypted=✔
|
||||||
|
#icon-signed=✔
|
||||||
|
#icon-signed-encrypted=✔
|
||||||
|
#icon-unknown=✘
|
||||||
|
#icon-invalid=⚠
|
||||||
|
|
||||||
#[ui:account=foo]
|
#[ui:account=foo]
|
||||||
#
|
#
|
||||||
# Enable threading in the ui. Only works with notmuch:// and imap:// accounts
|
# Enable threading in the ui. Only works with notmuch:// and imap:// accounts
|
||||||
|
|
|
@ -50,6 +50,12 @@ type UIConfig struct {
|
||||||
NewMessageBell bool `ini:"new-message-bell"`
|
NewMessageBell bool `ini:"new-message-bell"`
|
||||||
Spinner string `ini:"spinner"`
|
Spinner string `ini:"spinner"`
|
||||||
SpinnerDelimiter string `ini:"spinner-delimiter"`
|
SpinnerDelimiter string `ini:"spinner-delimiter"`
|
||||||
|
IconUnencrypted string `ini:"icon-unencrypted"`
|
||||||
|
IconEncrypted string `ini:"icon-encrypted"`
|
||||||
|
IconSigned string `ini:"icon-signed"`
|
||||||
|
IconSignedEncrypted string `ini:"icon-signed-encrypted"`
|
||||||
|
IconUnknown string `ini:"icon-unknown"`
|
||||||
|
IconInvalid string `ini:"icon-invalid"`
|
||||||
DirListFormat string `ini:"dirlist-format"`
|
DirListFormat string `ini:"dirlist-format"`
|
||||||
DirListDelay time.Duration `ini:"dirlist-delay"`
|
DirListDelay time.Duration `ini:"dirlist-delay"`
|
||||||
DirListTree bool `ini:"dirlist-tree"`
|
DirListTree bool `ini:"dirlist-tree"`
|
||||||
|
@ -702,6 +708,12 @@ func LoadConfigFromFile(root *string, logger *log.Logger) (*AercConfig, error) {
|
||||||
FuzzyComplete: false,
|
FuzzyComplete: false,
|
||||||
Spinner: "[..] , [..] , [..] , [..] , [..], [..] , [..] , [..] ",
|
Spinner: "[..] , [..] , [..] , [..] , [..], [..] , [..] , [..] ",
|
||||||
SpinnerDelimiter: ",",
|
SpinnerDelimiter: ",",
|
||||||
|
IconUnencrypted: "",
|
||||||
|
IconSigned: "[s]",
|
||||||
|
IconEncrypted: "[e]",
|
||||||
|
IconSignedEncrypted: "",
|
||||||
|
IconUnknown: "[s?]",
|
||||||
|
IconInvalid: "[s!]",
|
||||||
DirListFormat: "%n %>r",
|
DirListFormat: "%n %>r",
|
||||||
DirListDelay: 200 * time.Millisecond,
|
DirListDelay: 200 * time.Millisecond,
|
||||||
NextMessageOnDelete: true,
|
NextMessageOnDelete: true,
|
||||||
|
|
|
@ -253,6 +253,39 @@ These options are configured in the *[ui]* section of aerc.conf.
|
||||||
|
|
||||||
Have a look at *aerc-stylesets*(7) as to how a styleset looks like.
|
Have a look at *aerc-stylesets*(7) as to how a styleset looks like.
|
||||||
|
|
||||||
|
*icon-unencrypted*
|
||||||
|
The icon to display for unencrypted mails.
|
||||||
|
|
||||||
|
Default: ""
|
||||||
|
|
||||||
|
*icon-encrypted*
|
||||||
|
The icon to display for encrypted mails.
|
||||||
|
|
||||||
|
Default: [e]
|
||||||
|
|
||||||
|
*icon-signed*
|
||||||
|
The icon to display for signed mails where the signature was
|
||||||
|
successfully validated.
|
||||||
|
|
||||||
|
Default: [s]
|
||||||
|
|
||||||
|
*icon-signed-encrypted*
|
||||||
|
The icon to display for signed and encrypted mails where the signature
|
||||||
|
was successfully verified.
|
||||||
|
|
||||||
|
Default: [s|e]
|
||||||
|
|
||||||
|
*icon-unknown*
|
||||||
|
The icon to display for signed mails which could not be verified due to
|
||||||
|
the key being unknown.
|
||||||
|
|
||||||
|
Default: [s?]
|
||||||
|
|
||||||
|
*icon-invalid*
|
||||||
|
The icon to display for signed mails where verification failed.
|
||||||
|
|
||||||
|
Default: [s!]
|
||||||
|
|
||||||
*fuzzy-complete*
|
*fuzzy-complete*
|
||||||
When typing a command or option, the popover will now show not only the
|
When typing a command or option, the popover will now show not only the
|
||||||
items /starting/ with the string input by the user, but it will also show
|
items /starting/ with the string input by the user, but it will also show
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package widgets
|
package widgets
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
|
"unicode/utf8"
|
||||||
|
|
||||||
"git.sr.ht/~rjarry/aerc/config"
|
"git.sr.ht/~rjarry/aerc/config"
|
||||||
"git.sr.ht/~rjarry/aerc/lib/ui"
|
"git.sr.ht/~rjarry/aerc/lib/ui"
|
||||||
"git.sr.ht/~rjarry/aerc/models"
|
"git.sr.ht/~rjarry/aerc/models"
|
||||||
|
@ -26,17 +29,21 @@ func (p *PGPInfo) DrawSignature(ctx *ui.Context) {
|
||||||
if p.details.SignatureValidity == models.UnknownEntity ||
|
if p.details.SignatureValidity == models.UnknownEntity ||
|
||||||
p.details.SignedBy == "" {
|
p.details.SignedBy == "" {
|
||||||
|
|
||||||
x := ctx.Printf(0, 0, warningStyle, "*")
|
x := ctx.Printf(0, 0, warningStyle, "%s unknown", p.uiConfig.IconUnknown)
|
||||||
x += ctx.Printf(x, 0, defaultStyle,
|
x += ctx.Printf(x, 0, defaultStyle,
|
||||||
" Signed with unknown key (%8X); authenticity unknown",
|
" Signed with unknown key (%8X); authenticity unknown",
|
||||||
p.details.SignedByKeyId)
|
p.details.SignedByKeyId)
|
||||||
} else if p.details.SignatureValidity != models.Valid {
|
} else if p.details.SignatureValidity != models.Valid {
|
||||||
x := ctx.Printf(0, 0, errorStyle, "Invalid signature!")
|
x := ctx.Printf(0, 0, errorStyle, "%s Invalid signature!", p.uiConfig.IconInvalid)
|
||||||
x += ctx.Printf(x, 0, errorStyle,
|
x += ctx.Printf(x, 0, errorStyle,
|
||||||
" This message may have been tampered with! (%s)",
|
" This message may have been tampered with! (%s)",
|
||||||
p.details.SignatureError)
|
p.details.SignatureError)
|
||||||
} else {
|
} else {
|
||||||
x := ctx.Printf(0, 0, validStyle, "✓ Authentic ")
|
icon := p.uiConfig.IconSigned
|
||||||
|
if p.details.IsEncrypted {
|
||||||
|
icon = p.uiConfig.IconSignedEncrypted
|
||||||
|
}
|
||||||
|
x := ctx.Printf(0, 0, validStyle, "%s Authentic ", icon)
|
||||||
x += ctx.Printf(x, 0, defaultStyle,
|
x += ctx.Printf(x, 0, defaultStyle,
|
||||||
"Signature from %s (%8X)",
|
"Signature from %s (%8X)",
|
||||||
p.details.SignedBy, p.details.SignedByKeyId)
|
p.details.SignedBy, p.details.SignedByKeyId)
|
||||||
|
@ -48,7 +55,12 @@ func (p *PGPInfo) DrawEncryption(ctx *ui.Context, y int) {
|
||||||
validStyle := p.uiConfig.GetStyle(config.STYLE_SUCCESS)
|
validStyle := p.uiConfig.GetStyle(config.STYLE_SUCCESS)
|
||||||
defaultStyle := p.uiConfig.GetStyle(config.STYLE_DEFAULT)
|
defaultStyle := p.uiConfig.GetStyle(config.STYLE_DEFAULT)
|
||||||
|
|
||||||
x := ctx.Printf(0, y, validStyle, "✓ Encrypted ")
|
icon := p.uiConfig.IconEncrypted
|
||||||
|
if p.details.IsSigned && p.details.SignatureValidity == models.Valid {
|
||||||
|
icon = strings.Repeat(" ", utf8.RuneCountInString(p.uiConfig.IconSignedEncrypted))
|
||||||
|
}
|
||||||
|
|
||||||
|
x := ctx.Printf(0, y, validStyle, "%s Encrypted ", icon)
|
||||||
x += ctx.Printf(x, y, defaultStyle,
|
x += ctx.Printf(x, y, defaultStyle,
|
||||||
"To %s (%8X) ", p.details.DecryptedWith, p.details.DecryptedWithKeyId)
|
"To %s (%8X) ", p.details.DecryptedWith, p.details.DecryptedWithKeyId)
|
||||||
if !p.details.IsSigned {
|
if !p.details.IsSigned {
|
||||||
|
|
Loading…
Reference in a new issue