Permalink
Browse files

Merge pull request #16 from paololus/support-terminator

Added support for Terminator
  • Loading branch information...
ciembor committed Feb 2, 2013
2 parents a83e920 + c80b358 commit 48e58a9e9f8de11dbd7a7f1b86942da2ade35416
Showing with 50 additions and 0 deletions.
  1. +3 −0 index.html
  2. +47 −0 js/main.js
View
@@ -131,6 +131,9 @@ <h2>Advanced</h2>
<li>
<p>putty <a href="#" target="_blank" id="putty-button" class="get-scheme-link">*.reg</a>
</li>
+ <li>
+ <p>terminator <a href="#" target="_blank" id="terminator-button" class="get-scheme-link">config</a>
+ </li>
</ul>
</div>
View
@@ -845,6 +845,52 @@ _4bit = function() {
});
+ var SchemeTerminatorView = Backbone.View.extend({
+
+ model: scheme,
+
+ initialize: function() {
+ _.bindAll(this, 'render');
+ var that = this;
+ $('#terminator-button').hover(function() {
+ that.render();
+ });
+ $('#terminator-button').focus(function() {
+ that.render();
+ });
+ },
+
+ render: function() {
+ var that = this;
+ var out = '';
+ var palette_normal = [];
+ var palette_bright = [];
+ var colors = that.model.get('colors');
+ var name = '4bit-' + (new Date()).getTime();
+
+ _.each(COLOR_NAMES, function(name) {
+ if (0 === name.indexOf('bright_')) {
+ palette_bright.push(colors[name]);
+ palette_normal.push(colors[name.substr('bright_'.length)]);
+ }
+ });
+
+ var palette = palette_normal.concat(palette_bright);
+
+ out += '# Color scheme configuration for Terminator terminal emulator (http://www.tenshu.net/terminator/ and https://launchpad.net/terminator)\n';
+ out += '# \n';
+ out += '# Copy the following lines within the [profiles] section of terminator configuration file at ~/.config/terminator/config\n\n';
+
+ out += '[[' + name + ']]\n';
+ out += ' use_theme_colors = False\n';
+ out += ' background_color = "' + colors['background'] + '"\n';
+ out += ' foreground_color = "' + colors['foreground'] + '"\n';
+ out += ' palette = "' + palette.join(':') + '"' + '\n';
+
+ $('#terminator-button').attr('href', 'data:text/plain,' + encodeURIComponent(out));
+ }
+ });
+
var ControlsView = Backbone.View.extend({
el: $('#controls'),
@@ -1008,6 +1054,7 @@ _4bit = function() {
var schemeGnomeTerminalView = new SchemeGnomeTerminalView();
var schemeXfceTerminalView = new SchemeXfceTerminalView();
var schemePuttyView = new SchemePuttyView();
+ var schemeTerminatorView = new SchemeTerminatorView();
var controlsView = new ControlsView();
// basic layout behaviour /////////////////////////////

0 comments on commit 48e58a9

Please sign in to comment.