Dynamic Button Icon when Shift is held

I'd like to have a single button/menu item to launch a shell (normal without Shift and admin with Shift), but then I'd also like the menu icon to change depending on whether Shift is held
What condition in the @icon clause should I use to reflect that?
@keydown:none doesn't seem to affect the icon condition

PowerShell Here (⇧Adm).dcf (640 Bytes)

At least currently, there isn't a way to change toolbar button icons based on which keys are down.

(IME with similar things on toolbars, that can seem like a good idea but ends up being quite distracting. The toolbar icons/labels change when you hold shift to type unrelated things and cause movement in the corner of your eye.)

oh, I agree re. the visually distracting noise in the toolbar
However, this will be in the menu, not in the toolbar

Also, (as a partial workaround) you could trigger the checks only in a "command mode" (when the cursor is NOT in any text field)

Why not use the multiple-function button?
You could have the normal PowerShell when left clicked, and elevated PowerShell when right clicked (you can also use the middle click for something too).

This type of multi-button can also dynamically change its icon and tooltip depending on which mouse button is used to click it (icon will change on mouse down).

1 Like

You could also have a script recognize the input and that making for a different output/action, but the button wouldn't change along.

However, there is something brought up here at times that makes the button change possible, even though it's hacky to say the least:

You could duplicate the toolbar, changing the buttons you wish to switch to make for a nearly identical bar (e.g. one bar with buttons A B C D and another hidden/inactive one with buttons A B Z D), and then trigger an entire toolbar switch to change the buttons and icons.

1 Like

because this is meant to be selected with a keyboard, and even for a mouse:

that would be too late :frowning: I'd like to have a preview of all available alternatives before I select a specific item - just like you have those dynamically changing menu items on a Mac

interesting hack, would it be possible to trigger the toolbar change only when you're in a specific menu or at least NOT when typing text to avoid the unnecessary changes during regular typing?

v13 has this new Evaluator tool that "For example, Evaluator code can be used to make a toolbar button change its icon and label based on some criteria."

But I haven't found the full list of criteria, the Buttons and Functions [Directory Opus Manual] documents the output, not the criteria (found KeyDown [Directory Opus Manual], but that seems like to be the same as an already existing check @keydown)

Is the new Evaluator able to track key events?