Skip to content

Commit

Permalink
Gnome Terminal support.
Browse files Browse the repository at this point in the history
  • Loading branch information
ciembor committed Sep 23, 2012
1 parent cb22ed0 commit 9e0c219
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 9 deletions.
10 changes: 8 additions & 2 deletions README.md
Expand Up @@ -11,12 +11,18 @@ For users
* __ATerm, Urxvt, Rxvt, XTerm and other libXt terminals:__ * __ATerm, Urxvt, Rxvt, XTerm and other libXt terminals:__
Copy the generated text to `~/.Xresources` file (you may have to create it) and run `xrdb ~/.Xresources`. Copy the generated text to `~/.Xresources` file (you may have to create it) and run `xrdb ~/.Xresources`.


* __Konsole and Yakuake:__ * __Gnome Terminal, Guake__
Put the generated file to `~/.kde/share/apps/konsole/NAME-OF-SCHEME.colorscheme` and restart the terminal. Save the generated script into set_colors.sh, make this file executable and run it:
`$ chmod +x set_colors.sh`
`$ ./set_colors.sh`
Alternatively copy generated lines directly into your shell.


* __XFCE4 Terminal:__ * __XFCE4 Terminal:__
Backup `~/.config/Terminal/terminalrc` file and replace it with generated text. Take into account that this file contains all XFCE4 Terminal settings, not only color scheme. Backup `~/.config/Terminal/terminalrc` file and replace it with generated text. Take into account that this file contains all XFCE4 Terminal settings, not only color scheme.


* __Konsole and Yakuake:__
Put the generated file to `~/.kde/share/apps/konsole/NAME-OF-SCHEME.colorscheme` and restart the terminal.

* __iTerm2 for Mac:__ * __iTerm2 for Mac:__
Create a file `~/NAME-OF-SCHEME.itermcolors` with the generated xml Create a file `~/NAME-OF-SCHEME.itermcolors` with the generated xml
content and load it with the `Load Presets ...` button under content and load it with the `Load Presets ...` button under
Expand Down
17 changes: 10 additions & 7 deletions index.html
Expand Up @@ -10,7 +10,7 @@
configuration file (xterm, aterm, eterm, rxvt, urxvt), configuration file (xterm, aterm, eterm, rxvt, urxvt),
*.colorscheme (konsole, yakuake) and *.itermcolors *.colorscheme (konsole, yakuake) and *.itermcolors
(iTerm2 for Mac)"/> (iTerm2 for Mac)"/>
<link href="css/merged.css?modified=20120907" rel="stylesheet" /> <link href="css/merged.css?modified=20120923" rel="stylesheet" />
<style id="outline-fix"></style> <style id="outline-fix"></style>
</head> </head>
<body onmousedown="document.getElementById('outline-fix').innerHTML='a{outline:none}';" onkeydown="document.getElementById('outline-fix').innerHTML=''"> <body onmousedown="document.getElementById('outline-fix').innerHTML='a{outline:none}';" onkeydown="document.getElementById('outline-fix').innerHTML=''">
Expand Down Expand Up @@ -111,19 +111,22 @@ <h2>Advanced</h2>
<p>xterm / aterm / rxvt / urxvt <a href="#" target="_blank" id="xresources-button" class="get-scheme-link">.Xresources</a></p> <p>xterm / aterm / rxvt / urxvt <a href="#" target="_blank" id="xresources-button" class="get-scheme-link">.Xresources</a></p>
</li> </li>
<li> <li>
<p>konsole / yakuake <a href="#" target="_blank" id="konsole-button" class="get-scheme-link">*.colorscheme</a> <p>gnome terminal <a href="#" target="_blank" id="gnome-terminal-button" class="get-scheme-link">shell</a>
</li> </li>
<li> <li>
<p>xfce4 terminal <a href="#" target="_blank" id="xfce-terminal-button" class="get-scheme-link">terminalrc</a> <p>guake <a href="#" target="_blank" id="guake-button" class="get-scheme-link">shell</a>
</li> </li>
<li> <li>
<p>guake <a href="#" target="_blank" id="guake-button" class="get-scheme-link">shell</a> <p>konsole / yakuake <a href="#" target="_blank" id="konsole-button" class="get-scheme-link">*.colorscheme</a>
</li>
<li>
<p>xfce4 terminal <a href="#" target="_blank" id="xfce-terminal-button" class="get-scheme-link">terminalrc</a>
</li> </li>
<li> <li>
<p>iTerm2<a href="#" target="_blank" id="iterm2-button" class="get-scheme-link">*.itermcolors</a> <p>iTerm2 <a href="#" target="_blank" id="iterm2-button" class="get-scheme-link">*.itermcolors</a>
</li> </li>
<li> <li>
<p>mintty<a href="#" target="_blank" id="mintty-button" class="get-scheme-link">.minttyrc</a> <p>mintty <a href="#" target="_blank" id="mintty-button" class="get-scheme-link">.minttyrc</a>
</li> </li>
</ul> </ul>
</div> </div>
Expand All @@ -139,7 +142,7 @@ <h2>Advanced</h2>
<script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.2/backbone-min.js"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.2/backbone-min.js"></script>
<script>window.Backbone || document.write("<script src='lib/js/backbone-min.js'>\x3C/script>")</script> <script>window.Backbone || document.write("<script src='lib/js/backbone-min.js'>\x3C/script>")</script>


<script src="js/compiled.js?modified=20120907"></script> <script src="js/compiled.js?modified=20120923"></script>


<script>_4bit();</script> <script>_4bit();</script>


Expand Down
57 changes: 57 additions & 0 deletions js/main.js
Expand Up @@ -441,6 +441,62 @@ _4bit = function() {


}); });


var SchemeGnomeTerminalView = Backbone.View.extend({

model: scheme,

initialize: function() {
_.bindAll(this, 'render');
var that = this;
$('#gnome-terminal-button').hover(function() {
that.render();
});
$('#gnome-terminal-button').focus(function() {
that.render();
});
},

render: function() {
var that = this;
var palette = [];
var colors = that.model.get("colors");

// Duplicate: #ab1224 -> #abab12122424, which is the expected format
function gnomeColor(color) {
return color.toString().replace(/#(.{2})(.{2})(.{2})/, '#$1$1$2$2$3$3');
}

_.each(COLOR_NAMES, function(name) {
if (0 !== name.indexOf('bright_')) {
palette.push( gnomeColor(colors[name]) );
}
});

_.each(COLOR_NAMES, function(name) {
if (0 === name.indexOf('bright_')) {
palette.push( gnomeColor(colors[name]) );
}
});

out = '#!/bin/bash \n\n';
out += '# Save this script into set_colors.sh, make this file executable and run it: \n';
out += '# \n';
out += '# $ chmod +x set_colors.sh \n';
out += '# $ ./set_colors.sh \n';
out += '# \n';
out += '# Alternatively copy lines below directly into your shell. \n\n';

out += "gconftool-2 --set /apps/gnome-terminal/profiles/Default/use_theme_background --type bool false \n";
out += "gconftool-2 --set /apps/gnome-terminal/profiles/Default/use_theme_colors --type bool false \n";
out += "gconftool-2 -s -t string /apps/gnome-terminal/profiles/Default/background_color '" + gnomeColor(colors["background"]) + "'" +'\n';
out += "gconftool-2 -s -t string /apps/gnome-terminal/profiles/Default/foreground_color '" + gnomeColor(colors["foreground"]) + "'" + '\n';
out += "gconftool-2 -s -t string /apps/gnome-terminal/profiles/Default/palette '" + palette.join(":") + "'" + '\n';

$('#gnome-terminal-button').attr('href', 'data:text/plain,' + encodeURIComponent(out));
}

});

var SchemeKonsoleView = Backbone.View.extend({ var SchemeKonsoleView = Backbone.View.extend({


model: scheme, model: scheme,
Expand Down Expand Up @@ -905,6 +961,7 @@ _4bit = function() {
var schemeMinttyView = new SchemeMinttyView(); var schemeMinttyView = new SchemeMinttyView();
var schemeITerm2View = new SchemeITerm2View(); var schemeITerm2View = new SchemeITerm2View();
var schemeGuakeView = new SchemeGuakeView(); var schemeGuakeView = new SchemeGuakeView();
var schemeGnomeTerminalView = new SchemeGnomeTerminalView();
var schemeXfceTerminalView = new SchemeXfceTerminalView(); var schemeXfceTerminalView = new SchemeXfceTerminalView();
var controlsView = new ControlsView(); var controlsView = new ControlsView();


Expand Down

0 comments on commit 9e0c219

Please sign in to comment.