API

ShortCutter

class shortcut.base.ShortCutter

Creates applicaton shortcuts for Windows, MacOS and Linux operating systems.

To create desktop and menu shortcuts to python:

from shortcut import ShortCutter
s = ShortCutter()
s.create_desktop_shortcut("python")
s.create_menu_shortcut("python")
create_desktop_shortcut(target)

Creates a desktop shortcut to a target.

Parameters:target (str) – The target to create a shortcut for, it can be a fully qualified file path /path/to/my_program or a simple application name my_program.

Returns a tuple of (target_name, target_path, shortcut_file_path)

create_menu_shortcut(target)

Creates a menu shortcut to a target.

Parameters:target (str) – The target to create a shortcut for, it can be a fully qualified file path /path/to/my_program or a simple application name my_program.

Returns a tuple of (target_name, target_path, shortcut_file_path)

create_shortcut(target, shortcut_directory)

Creates a shortcut to a target.

Parameters:
  • target (str) – The target to create a shortcut for, it can be a fully qualified file path /path/to/my_program or a simple application name my_program.
  • shortcut_directory (str) – The directory path where the shortcut should be created.

Returns a tuple of (target_name, target_path, shortcut_file_path)

desktop_directory

Sets or returns the directory used when creating desktop shortcuts.

find_target(target)

Finds a file path for a target application.

Parameters:target (str) – The target to find, it can be a fully qualified file path /path/to/my_program or a simple application name my_program.

Returns a single target file path or None if a path cant be found.

menu_directory

Sets or returns the directory used when creating menu shortcuts.

search_for_target(target)

Searches for a target application.

Parameters:target (str) – The target to find.

Returns a list of potential target file paths, it no paths are found an empty list is returned.s