Skip to content

Instantly share code, notes, and snippets.

@dmytro-y-dev
Last active January 9, 2017 00:04
Show Gist options
  • Save dmytro-y-dev/8acaef19357ed2e57e1b18112da546dd to your computer and use it in GitHub Desktop.
Save dmytro-y-dev/8acaef19357ed2e57e1b18112da546dd to your computer and use it in GitHub Desktop.
Automatic initialization of terminals on start in `Atom` with `platformio-ide-terminal` plugin.
# Automatic initialization of terminals on start in `Atom` with `platformio-ide-terminal` plugin.
# Script was tested with `Atom` 1.12.9 and `platformio-ide-terminal` 2.2.2.
#
# Author: metamaker <https://github.com/metamaker>
#
# How to install:
# 1. Add this script to Atom's `init.coffee`.
# 2. Write your actual terminals configuration to `terminals` variable.

terminals = [
  {
    name: 'x',
    color: 'red'
  },
  {
    name: 'y'
  }
];

PlatformioTerminalPackage = atom.packages.getLoadedPackage 'platformio-ide-terminal'
PlatformioTerminalsContainer = PlatformioTerminalPackage.mainModule.statusBarTile

createTerminal = (config) ->
  terminal = PlatformioTerminalsContainer.createTerminalView()
  terminal.statusIcon.updateName config.name if config.name

  if config.color
    event = {
      type: config.color,
      target: terminal.statusIcon
    }

    PlatformioTerminalsContainer.setStatusColor event

createTerminal terminal_config for terminal_config in terminals
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment