The changes are pretty minimal. I'll link a pull request here in a few.
{
name: "Toggle Dark/Light Theme",
shortcut: "ctrl+1",
icon: null,
handler: () => {...}
},
{
name: "Change Language",
shortcut: "ctrl+shift+l",
icon: '<span class="icon"> ></span>',
handler: () => {...}
},
{
name: "Goto About",
shortcut: "ctrl+d",
handler: () => (window.location.hash = "about"),
icon: '<img src="../Cjdowner-Cryptocurrency-ICON.512.webp">'
},
{
name: "Destroy Instance",
icon: '<svg version="1.1" id="Uploaded to svgrepo.com" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 32 32" xml:space="preserve"><path d="M17,9v0.459v1.468l1.401,0.44C21.75,12.419,24,15.487,24,19c0,4.411-3.589,8-8,8s-8-3.589-8-8 c0-3.513,2.25-6.581,5.599-7.633L15,10.927V9.459V9H17 M17.95,2C16.323,2,15,3.323,15,4.95V7h-2v2.459C8.943,10.734,6,14.523,6,19 c0,5.523,4.477,10,10,10s10-4.477,10-10c0-4.477-2.943-8.266-7-9.541V7h-2V4.95C17,4.426,17.426,4,17.956,4 c0.318,0,0.614,0.158,0.791,0.423l0.843,1.265C20.139,6.51,21.057,7,22.05,7C23.677,7,25,5.677,25,4.05V3h-2v1.05 C23,4.574,22.574,5,22.044,5c-0.318,0-0.614-0.158-0.791-0.423L20.41,3.312C19.861,2.49,18.943,2,17.95,2L17.95,2z M15,12.08 c-3.386,0.488-6,3.401-6,6.92h2c0-2.414,1.721-4.434,4-4.899V12.08z"/></svg>',
handler: () => {...}
The icon is separated from the text by .5em of space.
I have one question. For cases 1 and 2, should there be an option for CommandPal that swaps
them. So that a missing icon: doesn't reserve 24px of white space on the left?
In this case setting icon: null would result in an empty 24x24px space.
The reason I bring this up is that a user may not want any icons at all. e.g. for the list of languages, I have
no icons. I could add: icon:null" to each language command. But I think for that case it would be better to have
CommandPal not reserve the icon space.
I have this working:
The changes are pretty minimal. I'll link a pull request here in a few.
It is used with a command array like:
It supports 5 cases:
to add space on the left side. If the string islonger than 24 px, it's cut off. (second item)
The icon is separated from the text by .5em of space.
I have one question. For cases 1 and 2, should there be an option for CommandPal that swaps
them. So that a missing
icon:doesn't reserve 24px of white space on the left?In this case setting
icon: nullwould result in an empty 24x24px space.The reason I bring this up is that a user may not want any icons at all. e.g. for the list of languages, I have
no icons. I could add:
icon:null" to each language command. But I think for that case it would be better to haveCommandPal not reserve the icon space.
Thoughts?