diff --git a/pythonTOTP-dmenu b/pythonTOTP-dmenu index f6bdeb4..5552cd0 100755 --- a/pythonTOTP-dmenu +++ b/pythonTOTP-dmenu @@ -8,20 +8,16 @@ keys=[] names=[] alllines=keysfile.readlines() for i in range(0, len(alllines)): - if i%2==0: - # thisname=alllines[i] - # thisname=thisname[:-2] + if i%2==0: #alternatively put the name of the service and the key in each array names.append(alllines[i][:-1]) - # names.append(thisname) else: keys.append(alllines[i][:-1]) -print(names) -chose=dmenu.show(names,case_insensitive=True, prompt='Search:') -print(chose) +chose=dmenu.show(names,case_insensitive=True, prompt='Search:') #get the selection from the user through dmenu + for i in range(0,len(keys)): if chose==names[i]: totp = pyotp.TOTP(keys[i]) - print(totp.now()) clipboard.copy(totp.now()) + break else: continue