streamdeck-applescript icon indicating copy to clipboard operation
streamdeck-applescript copied to clipboard

No state toggle - is this possible?

Open barneyc opened this issue 5 years ago • 3 comments

Phew. Bought a Stream Deck to help out with managing multiple online meeting tools as my MacBook sits on a shelf and some physical keys are always a bonus. I have a global mic input toggle script I've been using but if I'm right the only way to do toggled icons for a plugin, is if it is enabled.

Is that right? I've got the Zoom plugin and it has a mic toggle icon. Be amazing to have that icon state ability for toggle applescripts as well.

BUT I have no clue if this is doable, or indeed how to do it. Any thoughts?

barneyc avatar Nov 28 '20 16:11 barneyc

Funny I have actually the same need for a multi state.

I ended up just changing the manifest for this plugin, so you get a multi state alternative for it in the menu.

{
  "Actions": [
    {
      "Icon": "ScriptIcon", 
      "Name": "RunAppleScript", 
      "States": [
        {
          "Image": "ScriptIcon",
          "FontSize": "12", 
          "FontStyle": "Bold", 
          "TitleAlignment": "bottom", 
          "TitleColor": "#ffffff",
          "Title": "Applescript"
        }
      ], 
      "Tooltip": "Run Applescript", 
      "UUID": "com.mushoo.runapplescript.action"
    },
    {
      "Icon": "ScriptIcon", 
      "Name": "RunAppleScript MS", 
      "States": [
        {
          "Image": "ScriptIcon",
          "FontSize": "12", 
          "FontStyle": "Bold", 
          "TitleAlignment": "bottom", 
          "TitleColor": "#ffffff",
          "Title": "Applescript"
        },
        {
          "Image": "ScriptIcon",
          "FontSize": "12", 
          "FontStyle": "Bold", 
          "TitleAlignment": "bottom", 
          "TitleColor": "#ffffff",
          "Title": "Applescript"
        }
      ], 
      "Tooltip": "Run Applescript", 
      "UUID": "com.mushoo.runapplescript.action2"
    }

  ], 
  "Author": "Mike Schapiro", 
  "CodePath": "RunApplescript", 
	"PropertyInspectorPath": "index_pi.html", 
  "Description": "Run an arbitrary chunk of Applescript code, or a .scpt file", 
  "Name": "RunAppleScript", 
  "Icon": "ScriptIcon", 
  "Version": "1.0",
  "OS": [
    {
        "Platform": "mac", 
        "MinimumVersion" : "10.11"
    }
  ]
}

And used the following applescript (but I understand you already have yours) :

set c to do shell script "/usr/local/bin/SwitchAudioSource -c"
if c is "Scarlett 2i2 USB" then
	do shell script "/usr/local/bin/SwitchAudioSource -s 'Built-in Output'"
else
	do shell script "/usr/local/bin/SwitchAudioSource -s 'Scarlett 2i2 USB'"
end if

The problem is it doesn't stay in sync if I change output by any other means but it's working

ybizeul avatar Nov 29 '20 14:11 ybizeul

How do you change the manifest? Sorry I'm an absolute dunce with dev tools

barneyc avatar Dec 11 '20 14:12 barneyc

You will find that file in the following directory : ~/Library/Application Support/com.elgato.StreamDeck/Plugins/com.mushoo.RunAppleScript.sdPlugin

You can modify it according to what I put in my previous post.

ybizeul avatar Dec 11 '20 16:12 ybizeul