Permalink
Browse files

Gnome Terminal support.

  • Loading branch information...
1 parent cb22ed0 commit 9e0c2194be082705d4c67fa65edbf614a68effbc @ciembor committed Sep 23, 2012
Showing with 75 additions and 9 deletions.
  1. +8 −2 README.md
  2. +10 −7 index.html
  3. +57 −0 js/main.js
View
@@ -11,12 +11,18 @@ For users
* __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`.
-* __Konsole and Yakuake:__
-Put the generated file to `~/.kde/share/apps/konsole/NAME-OF-SCHEME.colorscheme` and restart the terminal.
+* __Gnome Terminal, Guake__
+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:__
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:__
Create a file `~/NAME-OF-SCHEME.itermcolors` with the generated xml
content and load it with the `Load Presets ...` button under
View
@@ -10,7 +10,7 @@
configuration file (xterm, aterm, eterm, rxvt, urxvt),
*.colorscheme (konsole, yakuake) and *.itermcolors
(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>
</head>
<body onmousedown="document.getElementById('outline-fix').innerHTML='a{outline:none}';" onkeydown="document.getElementById('outline-fix').innerHTML=''">
@@ -111,19 +111,22 @@
<p>xterm / aterm / rxvt / urxvt <a href="#" target="_blank" id="xresources-button" class="get-scheme-link">.Xresources</a></p>
</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>
- <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>
- <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>
- <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>
- <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>
</ul>
</div>
@@ -139,7 +142,7 @@
<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 src="js/compiled.js?modified=20120907"></script>
+ <script src="js/compiled.js?modified=20120923"></script>
<script>_4bit();</script>
View
@@ -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({
model: scheme,
@@ -905,6 +961,7 @@ _4bit = function() {
var schemeMinttyView = new SchemeMinttyView();
var schemeITerm2View = new SchemeITerm2View();
var schemeGuakeView = new SchemeGuakeView();
+ var schemeGnomeTerminalView = new SchemeGnomeTerminalView();
var schemeXfceTerminalView = new SchemeXfceTerminalView();
var controlsView = new ControlsView();

0 comments on commit 9e0c219

Please sign in to comment.