summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormsmol <msmolash@shutterstock.com>2017-06-05 11:45:51 -0400
committermsmol <msmolash@shutterstock.com>2017-06-05 11:45:51 -0400
commit188b517fdc4d99ba9f01c83fe89b0d33650bbd8f (patch)
treead845040775d7c364b1b3bd6193f1e4077c01066
parent747b0089697c5f16f66be87894b016573f08f54d (diff)
Move initializtion of totp env vars to init function
Also update README with more info
-rw-r--r--README.md5
-rw-r--r--pass.cpp11
2 files changed, 9 insertions, 7 deletions
diff --git a/README.md b/README.md
index 20740a2..8d3e081 100644
--- a/README.md
+++ b/README.md
@@ -5,9 +5,10 @@ Integrates [krunner](https://userbase.kde.org/Plasma/Krunner) with [pass](https:
## Use with [pass-otp](https://github.com/tadfisher/pass-otp)
-To use with pass-otp, use the identifier "totp::" in the filename or file path of the otp password file.
+To use with pass-otp, use the identifier "totp::" as a prefix in the filename or file path of the otp password file.
-Alternatively, set $PASSWORD_STORE_OTP_IDENTIFIER to overwrite the identifier string.
+Alternatively, set $PASSWORD_STORE_OTP_IDENTIFIER to overwrite the identifier string. This must be set in `.xprofile`
+or similar file.
Build and Installation
======================
diff --git a/pass.cpp b/pass.cpp
index 73c7bac..3b7013d 100644
--- a/pass.cpp
+++ b/pass.cpp
@@ -61,6 +61,12 @@ void Pass::init() {
}
}
+ this->passOtpIdentifier = "totp::";
+ auto passOtpIdentifier = getenv("PASSWORD_STORE_OTP_IDENTIFIER");
+ if (passOtpIdentifier != nullptr) {
+ this->passOtpIdentifier = passOtpIdentifier;
+ }
+
initPasswords();
connect(&watcher, SIGNAL(directoryChanged(QString)), this, SLOT(reinitPasswords(QString)));
@@ -125,11 +131,6 @@ void Pass::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &m
{
Q_UNUSED(context);
- this->passOtpIdentifier = "totp::";
- auto passOtpIdentifier = getenv("PASSWORD_STORE_OTP_IDENTIFIER");
- if (passOtpIdentifier != nullptr) {
- this->passOtpIdentifier = passOtpIdentifier;
- }
auto isOtp = match.text().split('/').filter(QRegularExpression("^" + QRegularExpression::escape(this->passOtpIdentifier) + ".*")).size() > 0;
auto ret = isOtp ?