GorvGoyl / Shortcut-Menu-Bar-VSCode-Extension

Add handy buttons like beautify, show opened files, save, toggle terminal, etc to the editor menu bar in VSCode. You can also create your own buttons with custom commands. VSCode Marketplace link: https://marketplace.visualstudio.com/items?itemName=jerrygoyal.shortcut-menu-bar
https://marketplace.visualstudio.com/items?itemName=jerrygoyal.shortcut-menu-bar
GNU General Public License v3.0
221 stars 44 forks source link

Support for Customizing Button Labels #58

Open Kenobi-the-2nd opened 3 years ago

Kenobi-the-2nd commented 3 years ago

Would it be possible to add functionality for setting the labels of the user defined buttons? For example, for my first user defined button, the label just reads "user action 1".

image

Thank-you for a great extension!

kryptan commented 3 years ago

How did you change icon for the user defined button? For me it just displays digits 1, 2, etc. and no way to change it. Issue for custom icons is still open. How did you do that?

Kenobi-the-2nd commented 3 years ago

@kryptan The buttons that come with the extension are .svg files found under this path:

C:\Users\[user_name]\.vscode\extensions\jerrygoyal.shortcut-menu-bar-3.0.3\images

I simply replaced these with .svg files I downloaded. The .svg will need to be the correct size (16x16). Then just rename the original files and name your custom .svg files the same as the original files. For example, rename "userButton01.svg" to "userButton01_original.svg", then name your custom .svg "userButton01.svg". After reloading VS Code your new icons should show up.

A good place to find icons/buttons is https://primer.style/octicons/.

Also, if you want to update the button labels, you can just edit the title attribute of the command object in the package.json file under the extension's root folder. The entries in the json file look like this:

{
    "contributes": {
        "commands": [
            ...
            {
                "command": "ShortcutMenuBar.userButton01",
                "title": "Diff w/ Repository",
                "category": "ShortcutMenuBar",
                "icon": {
                    "light": "images/userButton01_light.svg",
                    "dark": "images/userButton01.svg"
                }
            },
            ...
        ]
    }
}

Note that you'll need to reload VS Code after making changes to this file.

GorvGoyl commented 2 years ago

@Kenobi-the-2nd I guess then you could also edit the package.json file of this installed extension and rename the title

image

MikeWillis commented 2 years ago

Note that just doing Developer: Reload Window after swapping the SVG files doesn't work. You have to close and re-open VS Code (at least in my case).