swiftbar / SwiftBar

Powerful macOS menu bar customization tool
https://swiftbar.app
MIT License
2.93k stars 92 forks source link

Is it possible to open an app when clicking a menu item #264

Closed mlcampbe closed 2 years ago

mlcampbe commented 2 years ago

I know I can create a bash script that runs when the menu item is clicked:

echo "This is the Menu Title" echo "---" echo "Item Name | bash=.sh terminal=true refresh=true"

That works but I'd like to launch an application (one from the /Applications folder) when clicking the menu item. I know I can create a new bash script that opens the app but is there a way to launch an app from the menu item directly? For example I am looking to try to do something like: echo "Item Name | open=/Applications//app"

melonamin commented 2 years ago

How about this:

#!/bin/bash

echo ":bookmark:"
echo "---"
echo "Open TextEdit | shell='open' param1='-a' param2='/System/Applications/TextEdit.app/' terminal=false"
mlcampbe commented 2 years ago

Alex,

Yep that works perfect. Thank You.

On Jan 4, 2022, at 12:53 PM, Alex Mazanov @.***> wrote:

How about this:

!/bin/bash

echo ":bookmark:" echo "---" echo "Open TextEdit | shell='open' param1='-a' param2='/System/Applications/TextEdit.app/' terminal=false" — Reply to this email directly, view it on GitHub https://github.com/swiftbar/SwiftBar/issues/264#issuecomment-1005083681, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADINDLMK4W56SRMAOMK22WTUUM63BANCNFSM5LHZQMOQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.