Skip to content

Commit

Permalink
guake 'colorscheme' added
Browse files Browse the repository at this point in the history
  • Loading branch information
zealot128 committed Sep 1, 2012
1 parent 8835199 commit bad6d22
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ <h2>Advanced</h2>
<li>
<p>xfce4 terminal <a href="#" target="_blank" id="xfce-terminal-button" class="get-scheme-link">terminalrc</a>
</li>
<li>
<p>guake <a href="#" target="_blank" id="guake-button" class="get-scheme-link">shell</a>
</li>
</ul>
</div>

Expand Down
36 changes: 36 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,41 @@ _4bit = function() {

});

var SchemeGuakeView = Backbone.View.extend({
model: scheme,
initialize: function() {
_.bindAll(this, 'render');
var that = this;
$('#guake-button').hover(function() {
that.render();
});
$('#guake-button').focus(function() {
that.render();
});
},

render: function() {
var that = this;
var palette = [];
var colors = that.model.get("colors");
_.each(COLOR_NAMES, function(name) {
palette.push( that.gnomeColor(colors[name]) )
});
out = "# save this script and run it as file " + '\n';
out +="# or copy the lines below directly into your shell " + '\n';

out += "gconftool-2 -s -t string /apps/guake/style/background/color '" + that.gnomeColor(colors["background"]) + "'" +'\n';
out += "gconftool-2 -s -t string /apps/guake/style/font/color '" + that.gnomeColor(colors["foreground"]) + "'" + '\n';
out += "gconftool-2 -s -t string /apps/guake/style/font/palette '" + palette.join(":") + "'" + '\n';
$('#guake-button').attr('href', 'data:text/plain,' + encodeURIComponent(out));
},

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

var SchemeKonsoleView = Backbone.View.extend({

model: scheme,
Expand Down Expand Up @@ -723,6 +758,7 @@ _4bit = function() {
var schemeCSSView = new SchemeCSSView();
var schemeXresourcesView = new SchemeXresourcesView();
var schemeKonsoleView = new SchemeKonsoleView();
var schemeGuakeView = new SchemeGuakeView();
var schemeXfceTerminalView = new SchemeXfceTerminalView();
var controlsView = new ControlsView();

Expand Down

1 comment on commit bad6d22

@mohandsedu60
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

js/main.js

Please sign in to comment.