@@ -495,8 +495,9 @@ def __init__(self, item: Secret.Item, service: Secret.Service) -> None:
495
495
496
496
self .meta = parse_qube_list (settings .get ('meta' ))
497
497
self .qubes = parse_qube_list (settings .get ('qubes' ))
498
- self .trust = settings .get ('trust' , None )
498
+ self .trust = settings .get ('trust' )
499
499
self .timeout = int (settings .get ('timeout' , Config .get ('timeout' )))
500
+ self .icon = settings .get ('icon' )
500
501
501
502
if self .trust is not None :
502
503
self .trust = int (self .trust )
@@ -753,13 +754,22 @@ def __str__(self) -> str:
753
754
754
755
for credential in self .credentials :
755
756
757
+ line = ''
756
758
folder = credential .path .parent .name or 'Root'
757
759
758
- formatted += lcut (credential .title , Config .getint ('title_length' ))
759
- formatted += lcut (folder , Config .getint ('folder_length' ))
760
- formatted += lcut (credential .username , Config .getint ('username_length' ))
761
- formatted += lcut (credential .url , Config .getint ('url_length' ))
762
- formatted += '\n '
760
+ line += lcut (credential .title , Config .getint ('title_length' ))
761
+ line += lcut (folder , Config .getint ('folder_length' ))
762
+ line += lcut (credential .username , Config .getint ('username_length' ))
763
+ line += lcut (credential .url , Config .getint ('url_length' ))
764
+
765
+ if '-show-icons' in Config .get_rofi_options ():
766
+
767
+ if credential .icon is not None :
768
+ line += f'\x00 icon\x1f { credential .icon } '
769
+
770
+ line = ' ' + line
771
+
772
+ formatted += line + '\n '
763
773
764
774
return formatted
765
775
@@ -775,8 +785,13 @@ def display_rofi(self, qube: str = 'Qube') -> (int, Credential):
775
785
Returns:
776
786
Credential item selected by the user and exit code
777
787
'''
788
+ title_length = Config .getint ('title_length' )
789
+
790
+ if '-show-icons' in Config .get_rofi_options ():
791
+ title_length += 3
792
+
778
793
rofi_mesg = f'Selected credential is copied to <b>{ qube } </b>\n \n '
779
- rofi_mesg += lcut ('Title' , Config . getint ( ' title_length' ) )
794
+ rofi_mesg += lcut ('Title' , title_length )
780
795
rofi_mesg += lcut ('Folder' , Config .getint ('folder_length' ))
781
796
rofi_mesg += lcut ('Username' , Config .getint ('username_length' ))
782
797
rofi_mesg += lcut ('URL' , Config .getint ('url_length' ))
@@ -823,7 +838,7 @@ def load(service: Secret.Service) -> CredentialCollection:
823
838
return CredentialCollection (credentials )
824
839
825
840
826
- parser = argparse .ArgumentParser (description = '''qubes-keepass v1.0 .0 - A rofi based KeePassXC frontend for Qubes''' )
841
+ parser = argparse .ArgumentParser (description = '''qubes-keepass v1.1 .0 - A rofi based KeePassXC frontend for Qubes''' )
827
842
parser .add_argument ('qube' , help = 'qube to copy the credential to' )
828
843
parser .add_argument ('--trust-level' , type = int , help = 'numerical trust level of the qube' )
829
844
parser .add_argument ('--config' , help = 'path to the configuration file' )
0 commit comments