conda / menuinst

Cross platform menu item installation
https://conda.github.io/menuinst/
BSD 3-Clause "New" or "Revised" License
33 stars 41 forks source link

Add Microsoft Terminal profile shortcut #200

Closed marcoesters closed 1 month ago

marcoesters commented 2 months ago

Description

The Windows Terminal provides the option to application to its profile. This is a handy feature for terminal-based applications.

This PR adds the option to create a Microsoft Terminal profile. It is limited to non-admin installations because, to my knowledge, there is no global %LOCALAPPDATA% file in which the settings file resides.

For now, the terminal profiles are identified by their name, which the terminal uses to create a GUID. It is, in principle, possible to create our own GUIDs using the uuid module from other types of heuristics, but I decided to keep using the name of the menu item to avoid having profiles with duplicate names.

Closes #196

Checklist - did you ...

marcoesters commented 1 month ago

LGTM. Feel free to merge once you are ready!

If you have a screenshot of how it looks like on Windows, I think it would be nice to have it posted here. If it's too much trouble, no worries.

I will create one and post it before I merge.

marcoesters commented 1 month ago

Here is a menu file to create the git bash terminal profile and the screenshot shows how it look like in the Windows Terminal.

{
  "$schema": "https://json-schema.org/draft-07/schema",
  "$id": "https://schemas.conda.io/menuinst-1.schema.json",
  "menu_name": "git bash",
  "menu_items": [
    {
      "name": "git bash",
      "command": [
          "C:\\Program Files\\Git\\bin\\bash.exe",
          "-li"
      ],
      "platforms": {
        "win": {
            "quicklaunch": false,
            "desktop": false,
            "windows_terminal_profile": "Git Bash",
            "icon": "C:\\Program Files\\Git\\mingw64\\share\\git\\git-for-windows.ico"
        }
      }
    }
  ]
}

Screenshot 2024-05-15 at 1 40 22 PM