Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No state toggle - is this possible? #8

Open
barneyc opened this issue Nov 28, 2020 · 3 comments
Open

No state toggle - is this possible? #8

barneyc opened this issue Nov 28, 2020 · 3 comments

Comments

@barneyc
Copy link

barneyc commented Nov 28, 2020

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?

@ybizeul
Copy link

ybizeul commented Nov 29, 2020

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

@barneyc
Copy link
Author

barneyc commented Dec 11, 2020

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

@ybizeul
Copy link

ybizeul commented Dec 11, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants