dotfiles/mbsync/usr/bin/set-mail-password
Tom Willemse 946b7425de Fix (automatic) syncing of email
- Load the necessary environment variables from ‘gnome-keyring-daemon’ when
  loading fish.
- Don’t sync the Archive directory from ryuslash.org, it’s too big and mbsync
  seems to get really confused about it.
- Disable old email accounts from syncing with mbsync.
- Fix the ‘get-mail-password’ and ‘set-mail-password’ scripts.
  - Use ‘secretstorage’ instead of ‘keyring’, this appears to be newer and
    easier to use.
2019-08-14 23:45:13 -07:00

17 lines
426 B
Python
Executable file

#!/usr/bin/python3
import sys
from getpass import getpass
import secretstorage
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(),
)