KcFnMi
KcFnMi

Reputation: 6171

Sublime - Change background color based on Build System

There is a question asking how to change background color based on file type, Sublime 2 -changing background color based on file type?.

Something close to this came to my mind. I was thinking in change the background color based on current Sublime Build System. Would it be possible?

For example, Red means Python, Green means LaTeX, Blue means Automatic.

Upvotes: 0

Views: 100

Answers (1)

MattDMo
MattDMo

Reputation: 102862

There are some built-in commands to run a specified build system or to set a particular one as the active build system, so you could possibly set an EventListener to listen for the set_build_system command and fire off a plugin to change the current view's background (or all the views in a window, or all views in all windows) when the build system is changed.

Here's a brief proof of concept:

import sublime
import sublime_plugin


class ListenToBuildSystem(sublime_plugin.EventListener):
    def on_window_command(self, window, command, args):
        if command == "set_build_system":
            window.run_command("toggle_minimap")

This toggles the display of the minimap every time the build system is changed.

Upvotes: 2

Related Questions