This was a hobby project built in 2 days during a weekend
BitBar4s enables scala developers to create plugins for bitbar in a declarative and easy way
This is not published to maven yet
-
create an
object
and extend fromBitBarApp with BitBarDsl2
-
override
pluginName
override val pluginName: String = "myplugin"
- create a handler for actions your plugin may dispatch. Example:
override val handler: Handler = {
case ("send-email", Some(email)) =>
sendEmail(email)
case ("push", Some(id)) =>
httpPost(id)
case ("trigger-something", Some(something)) =>
interactWithMobileDevice(something)
}
- Use the dsl to create menu items either statically for dynamically. Example:
override val appMenu = menu("my-plugin", color = "red", textSize = 20) {
action("send email", "send-email", Some("abc@xyz.com"), true)
text("item 1", font = "Times")
text("item 2", textSize = 15)
subMenu("submenu"){
text("item 3")
text("item 4")
Range(20,30).foreach{ i =>
link(s"item_$i", "http://google.com")
}
subMenu("nested", color = "orange"){
text("item 5")
text("item 6")
shellCommand("item 7", "echo", showTerminal = true ,params = "hello world", "sds")
}
}
}
You can create, static texts, web links, shell command triggers, and most importantly, actions.
All the items support configuratios such as color, text size, image, refresh, etc.