diff --git a/fish/.config/fish/config.fish b/fish/.config/fish/config.fish index 1a47d8d..270b456 100644 --- a/fish/.config/fish/config.fish +++ b/fish/.config/fish/config.fish @@ -9,3 +9,7 @@ set -x EDITOR emacsclient set -x DOTNET_CLI_TELEMETRY_OPTOUT true kitty + complete setup fish | source + +if test -n "$DESKTOP_SESSION" + set (gnome-keyring-daemon --start | string split "=") +end diff --git a/mbsync/.mbsyncrc b/mbsync/.mbsyncrc index a06d4c2..a9ec9c2 100644 --- a/mbsync/.mbsyncrc +++ b/mbsync/.mbsyncrc @@ -18,7 +18,7 @@ Channel ryuslash Master :ryuslash-remote: Slave :ryuslash-local: # Don't synchronize lda-dupes, it causes trouble. -Patterns * !dovecot/lda-dupes +Patterns * !Archive !dovecot/lda-dupes Create Both SyncState * @@ -62,62 +62,62 @@ Group gmail Channel gmail-inbox Channel gmail-sent -## Picturefix: -IMAPAccount picturefix -Host imap.gmail.com -User tom@picturefix.nl -PassCmd "~/usr/bin/get-mail-password picturefix" -SSLType IMAPS -CertificateFile /etc/ssl/certs/ca-certificates.crt +# ## Picturefix: +# IMAPAccount picturefix +# Host imap.gmail.com +# User tom@picturefix.nl +# PassCmd "~/usr/bin/get-mail-password picturefix" +# SSLType IMAPS +# CertificateFile /etc/ssl/certs/ca-certificates.crt -IMAPStore picturefix-remote -Account picturefix +# IMAPStore picturefix-remote +# Account picturefix -MaildirStore picturefix-local -Path ~/documents/mail/picturefix -Inbox ~/documents/mail/picturefix/inbox -SubFolders Legacy +# MaildirStore picturefix-local +# Path ~/documents/mail/picturefix +# Inbox ~/documents/mail/picturefix/inbox +# SubFolders Legacy -# Synchronize only the gmail INBOX mailbox. -Channel picturefix-inbox -Master :picturefix-remote: -Slave :picturefix-local: -Patterns INBOX -Create Both -SyncState * +# # Synchronize only the gmail INBOX mailbox. +# Channel picturefix-inbox +# Master :picturefix-remote: +# Slave :picturefix-local: +# Patterns INBOX +# Create Both +# SyncState * -# Synchronize only the sent mailbox. -Channel picturefix-sent -Master :picturefix-remote:"[Gmail]/Verzonden berichten" -Slave :picturefix-local:sent -Create Both -SyncState * +# # Synchronize only the sent mailbox. +# Channel picturefix-sent +# Master :picturefix-remote:"[Gmail]/Verzonden berichten" +# Slave :picturefix-local:sent +# Create Both +# SyncState * -# Group the picturefix channels together so that synching with the -# command-line is easier. -Group picturefix -Channel picturefix-inbox -Channel picturefix-sent +# # Group the picturefix channels together so that synching with the +# # command-line is easier. +# Group picturefix +# Channel picturefix-inbox +# Channel picturefix-sent -## Ninthfloor: -IMAPAccount ninthfloor -Host mail.ninthfloor.org -User ryuslash -PassCmd "~/usr/bin/get-mail-password ninthfloor" -SSLType STARTTLS -CertificateFile /etc/ssl/certs/ca-certificates.crt +# ## Ninthfloor: +# IMAPAccount ninthfloor +# Host mail.ninthfloor.org +# User ryuslash +# PassCmd "~/usr/bin/get-mail-password ninthfloor" +# SSLType STARTTLS +# CertificateFile /etc/ssl/certs/ca-certificates.crt -IMAPStore ninthfloor-remote -Account ninthfloor +# IMAPStore ninthfloor-remote +# Account ninthfloor -MaildirStore ninthfloor-local -Path ~/documents/mail/ninthfloor/ -Inbox ~/documents/mail/ninthfloor/inbox -SubFolders Legacy +# MaildirStore ninthfloor-local +# Path ~/documents/mail/ninthfloor/ +# Inbox ~/documents/mail/ninthfloor/inbox +# SubFolders Legacy -Channel ninthfloor -Master :ninthfloor-remote: -Slave :ninthfloor-local: -Patterns * -Create Both -SyncState * +# Channel ninthfloor +# Master :ninthfloor-remote: +# Slave :ninthfloor-local: +# Patterns * +# Create Both +# SyncState * diff --git a/mbsync/usr/bin/get-mail-password b/mbsync/usr/bin/get-mail-password index 02f4033..ecfbb09 100755 --- a/mbsync/usr/bin/get-mail-password +++ b/mbsync/usr/bin/get-mail-password @@ -1,15 +1,12 @@ #!/usr/bin/python3 -import gi - -gi.require_version('GnomeKeyring', '1.0') - -import logging - -logger = logging.getLogger('keyring') -logger.addHandler(logging.StreamHandler()) - -import keyring import sys +import secretstorage -print(keyring.get_password('offlineimap', sys.argv[1])) +connection = secretstorage.dbus_init() +collection = secretstorage.get_collection_by_alias(connection, "login") + +for foo in collection.search_items( + {"application": "mbsync", "account": sys.argv[1]} +): + print(foo.get_secret().decode()) diff --git a/mbsync/usr/bin/set-mail-password b/mbsync/usr/bin/set-mail-password index 022b5f7..c36e39b 100755 --- a/mbsync/usr/bin/set-mail-password +++ b/mbsync/usr/bin/set-mail-password @@ -1,16 +1,17 @@ #!/usr/bin/python3 -import gi - -gi.require_version('GnomeKeyring', '1.0') - -import logging - -logger = logging.getLogger('keyring') -logger.addHandler(logging.StreamHandler()) - -import keyring import sys -import getpass +from getpass import getpass +import secretstorage -keyring.set_password('offlineimap', sys.argv[1], getpass.getpass()) +connection = secretstorage.dbus_init() +collection = secretstorage.get_collection_by_alias(connection, "login") +attributes = {"application": "mbsync", "account": sys.argv[1]} + +collection.create_item( + "Password for '{}' on '{}'".format( + attributes["account"], attributes["application"] + ), + attributes, + getpass().encode(), +)