add transparency support

This commit is contained in:
Daniel Micay 2012-05-24 02:51:40 -04:00
parent b6b8c8f7fc
commit 0b8d55dac5
2 changed files with 15 additions and 0 deletions

View File

@ -12,6 +12,11 @@ static const char *url_regex = "(ftp|http)s?://[-a-zA-Z0-9.?$%&/=_~#.,:;+]*";
static const char *url_command = "/usr/bin/firefox";
#endif
//#define TRANSPARENCY
#ifdef TRANSPARENCY
static const double transparency_level = 0.2;
#endif
static const char *font = "Monospace 9";
static const long scrollback_lines = 1000;

View File

@ -129,6 +129,16 @@ int main(int argc, char **argv) {
vte_terminal_set_visible_bell(VTE_TERMINAL(vte), visible_bell);
vte_terminal_set_mouse_autohide(VTE_TERMINAL(vte), mouse_autohide);
#ifdef TRANSPARENCY
GdkScreen *screen = gtk_widget_get_screen(window);
GdkColormap *colormap = gdk_screen_get_rgba_colormap(screen);
if (colormap != NULL) {
gtk_widget_set_colormap(window, colormap);
}
vte_terminal_set_background_saturation(VTE_TERMINAL(vte), transparency_level);
vte_terminal_set_opacity(VTE_TERMINAL(vte), (guint16)(0xffff * (1 - transparency_level)));
#endif
// set colors
GdkColor foreground, background;
gdk_color_parse(foreground_color, &foreground);