6
6
import dmenu
7
7
8
8
9
- def copy_to_clipboard (text ):
9
+ def copy_to_clipboard (text : bytes ):
10
10
p = Popen (["xsel" , "-i" ], stdin = PIPE )
11
11
p .communicate (input = text )
12
12
13
13
14
- def which (program ) :
15
- def is_exe (fpath ):
16
- return os .path .isfile (fpath ) and os .access (fpath , os .X_OK )
14
+ def which (program : str ) -> str | None :
15
+ def is_exe (_fpath ):
16
+ return os .path .isfile (_fpath ) and os .access (_fpath , os .X_OK )
17
17
18
18
fpath , _ = os .path .split (program )
19
19
if fpath :
@@ -28,7 +28,7 @@ def is_exe(fpath):
28
28
return None
29
29
30
30
31
- def call_rofi_dmenu (options , abort = True , prompt = None ):
31
+ def call_rofi_dmenu (options : list , abort : bool = True , prompt : str = None ) -> str :
32
32
if which ("rofi" ):
33
33
_rofi = Rofi ()
34
34
index , key = _rofi .select (prompt or "Select:" , options )
@@ -43,7 +43,7 @@ def call_rofi_dmenu(options, abort=True, prompt=None):
43
43
return user_select
44
44
45
45
46
- def parse_user_config ():
46
+ def parse_user_config () -> tuple :
47
47
config_file = os .path .join (os .path .expanduser ("~" ), ".config" , "vaultrun" , "config" )
48
48
_config_parser = ConfigParser ()
49
49
# Open the file with the correct encoding
@@ -52,7 +52,7 @@ def parse_user_config():
52
52
if len (sections_from_config ) == 1 :
53
53
config_section = sections_from_config [0 ]
54
54
else :
55
- config_section = call_rofi_dmenu (options = sections_from_config , abort = True , prompt = None )
55
+ config_section = call_rofi_dmenu (options = sections_from_config )
56
56
57
57
_mount_point = _config_parser [config_section ]["mount_point" ]
58
58
_secret_path = _config_parser [config_section ]["secret_path" ]
0 commit comments