diff --git a/README.md b/README.md index e172cf9..d1c682f 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,6 @@ Or, on anything else: ./install.sh ``` - ## Usage Simply search for the account name, then hit enter (or click) to copy the code. diff --git a/yubioath-krunner.py b/yubioath-krunner.py index badddef..8378219 100755 --- a/yubioath-krunner.py +++ b/yubioath-krunner.py @@ -30,7 +30,7 @@ def get_credentials(self): def get_code(self, cred_id): result = subprocess.run(["ykman", "oath", "code"], stdout=subprocess.PIPE) codes = result.stdout.decode() - return re.search("{} +(\d+)".format(cred_id), codes).groups()[0].strip() + return re.search("{} +(\d+)".format(cred_id), codes).groups()[0] @dbus.service.method(iface, out_signature='a(sss)') def Actions(self, msg): @@ -52,7 +52,7 @@ def Match(self, query): @dbus.service.method(iface, in_signature='ss') def Run(self, matchId, actionId): code = self.get_code(matchId) - subprocess.run("echo '{}' | xclip -selection clipboard".format(code), shell=True) + subprocess.run("echo -n '{}' | xclip -selection clipboard".format(code), shell=True) subprocess.run(["notify-send", "--urgency=low", "--expire-time=2000", "--icon=nm-vpn-active-lock", "YubiOATH", "Code copied to clipboard"]) # Refresh credentials. self.credentials = self.get_credentials()