How to add my Compose Multiplatform application to SendTo menu in Windows?

  • 1 year ago
Comment

1 / 1

You can add your Compose Multiplatform application to the SendTo menu in Windows by creating a shortcut to your application and placing it in the SendTo folder.

Here are the steps to do this:

  1. Create a shortcut to your Compose Multiplatform application. To do this, right-click on your application executable and select "Create shortcut".

  2. Rename the shortcut to a short and descriptive name, such as "Send to MyApp".

  3. Press the "Windows key" + "R" to open the Run dialog box. Type "shell:sendto" and press Enter. This will open the SendTo folder.

  4. Move the shortcut you created in Step 1 to the SendTo folder.

  5. Close the SendTo folder.

Now, when you right-click on a file or folder in Windows, you should see the "Send to" option in the context menu, and your Compose Multiplatform application should be listed as one of the available options.

When you select your application from the SendTo menu, the file or folder you right-clicked on will be passed as a command-line argument to your application. You can access this argument in your Compose Multiplatform application using the args parameter of the main function. For example:

kotlin
fun main(args: Array<String>) {
val fileOrFolderPath = args.firstOrNull() ?: return
// Your application logic here
}

This code will retrieve the first command-line argument (which should be the file or folder path passed from the SendTo menu) and store it in the fileOrFolderPath variable. You can then use this variable in your application logic as needed.