     data.sentBy ||= @channel_key
 
     # only broadcast message if we generated the event
-    App.workspaces.send(data) if @is_enabled() && @myMessage(data)
-
-  is_enabled: () =>
-    @sync
-
-  enable: () =>
-    @sync = true
-
-  disable: () =>
-    @sync = false
+    App.workspaces.send(data) if @commandEnabled(data.command) && @myMessage(data)
+
+  commandEnabled: (command) =>
+    cmdType = (type for type, cmdlist of @commandTypes when command in cmdlist)
+    @is_enabled(cmdType)
+
+  is_enabled: (type) =>
+    @syncState[type]
+
+  setSyncState: (type, state) =>
+    if type == 'all'
+      for name,value in @syncState
+        @syncState[name] = state
+    else
+      @syncState[type] = state
+
+  enable: (type = 'all') =>
+    @setSyncState(type, true)
+
+  disable: (type = 'all') =>
+    @setSyncState(type, false)
 
 class Workspace
   constructor: (el, channel_key) ->

    @map.addControl(nav)

  runRemoteCommand: (data) =>
    return if !@remote.is_enabled() || @remote.myMessage(data)

    if @remote[data.command]?
      @remote[data.command](@, data, true)
    else
      console.log "Unknown command: #{data.command}"

  featurePopup: (e) =>
    features = @map.queryRenderedFeatures(e.point, { layers: @clickable_layers });

# You can use CoffeeScript in this file: http://coffeescript.org/

class RemoteWorkspace
  syncState: {
    movement: true,
    layers: false
  }

  commandTypes: {
    layers: ['hideLayer', 'showLayer', 'setStyle'],
    movement: ['move']
  }

  constructor: (@channel_key) ->
    # @enable()

  commands: {
    hideLayer: (ws, data) ->
      ws.hideLayer(data.name, true)

    showLayer: (ws, data) ->
      ws.showLayer(data.name, true)

    move: (ws, data) ->
      location.hash = data.hash

    setStyle: (ws, data) ->
      ws.setStyle(data.name, true)
  }

  runCommand: (ws, data) =>
    return if @myMessage(data) || !@commandEnabled(data.command)
    if @commands[data.command]?
      @commands[data.command](ws, data)
    else
      console.log "Unknown command: #{data.command}"


  myMessage: (data) =>
    return data.sentBy == @channel_key
