Skip to content

Commit 1d11012

Browse files
committed
+ Support for Shortcuts
even for steam shortcuts
1 parent f19c088 commit 1d11012

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

main.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ def save(self):
7777

7878
def get_program_for_file(filename):
7979
extension = os.path.splitext(filename)[1]
80+
app_path = os.path.normpath(filename)
81+
if extension in ('.lnk', '.url'):
82+
return f'cmd /C "{app_path}"'
8083
try:
8184
with winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, extension, 0, winreg.KEY_READ) as key:
8285
value, _ = winreg.QueryValueEx(key, '')
@@ -85,9 +88,9 @@ def get_program_for_file(filename):
8588
args = shlex.split(command_line)
8689
for i, arg in enumerate(args):
8790
if "%1" in arg or "%l" in arg.lower():
88-
args[i] = arg.replace("%1", os.path.normpath(filename))\
89-
.replace("%l", os.path.normpath(filename))\
90-
.replace("%L", os.path.normpath(filename))
91+
args[i] = arg.replace("%1", app_path)\
92+
.replace("%l", app_path)\
93+
.replace("%L", app_path)
9194
args = [arg for arg in args if not re.search(r'(?<!%)%(\*|[2-9])', arg)]
9295
return ' '.join(args)
9396
except:
@@ -286,7 +289,7 @@ def toggle_app_callback(self, app):
286289
def get_apps_paths(self) -> tuple[str]:
287290
return tk.filedialog.askopenfilenames(
288291
title='Select some executables',
289-
filetypes=(("Executable", ".exe .bat .cmd"), ("Other", "*.*"))
292+
filetypes=(("Executable", ".exe .bat .cmd .url .lnk"), ("Other", "*.*"))
290293
) or tuple()
291294

292295
def delete_app_callback(self, app):

0 commit comments

Comments
 (0)