summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2016-12-19 17:49:52 +0100
committerDave Davenport <qball@gmpclient.org>2016-12-19 17:49:52 +0100
commit9c6019d3d0dc8d6e127d41754c05bd42a2ec07e8 (patch)
tree9e0a251f1895fe391b97e78fd9342ce53f702868
parentbe3ce75f5dcb977e2e7c1d05824e4c48b3b9b00c (diff)
Allow theme to set background.
-rw-r--r--doc/themer.md8
-rw-r--r--source/view.c25
2 files changed, 22 insertions, 11 deletions
diff --git a/doc/themer.md b/doc/themer.md
index 5d7ac006..220586c5 100644
--- a/doc/themer.md
+++ b/doc/themer.md
@@ -137,9 +137,11 @@ The following properties are currently supports:
* foreground: color
* border-width: integer
* padding: integer
- * border-width: integer
- * padding: integer
- * border-width: integer
+ * transparency: string
+ - real
+ - background
+ - screenshot
+ - Path to png file
* separator:
* line-style: string
diff --git a/source/view.c b/source/view.c
index 59e27695..fed17648 100644
--- a/source/view.c
+++ b/source/view.c
@@ -491,23 +491,26 @@ static void filter_elements ( thread_state *t, G_GNUC_UNUSED gpointer user_data
}
}
-static void rofi_view_setup_fake_transparency ( void )
+static void rofi_view_setup_fake_transparency ( const char const *fake_background )
{
if ( CacheState.fake_bg == NULL ) {
cairo_surface_t *s = NULL;
/**
* Select Background to use for fake transparency.
- * Current options: 'screenshot','background'
+ * Current options: 'real', 'screenshot','background'
*/
TICK_N ( "Fake start" );
- if ( g_strcmp0 ( config.fake_background, "screenshot" ) == 0 ) {
+ if ( g_strcmp0 ( fake_background, "real" ) == 0 ){
+ return;
+ }
+ else if ( g_strcmp0 ( fake_background, "screenshot" ) == 0 ) {
s = x11_helper_get_screenshot_surface ();
}
- else if ( g_strcmp0 ( config.fake_background, "background" ) == 0 ) {
+ else if ( g_strcmp0 ( fake_background, "background" ) == 0 ) {
s = x11_helper_get_bg_surface ();
}
else {
- char *fpath = rofi_expand_path ( config.fake_background );
+ char *fpath = rofi_expand_path ( fake_background );
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Opening %s to use as background.", fpath );
s = cairo_image_surface_create_from_png ( fpath );
CacheState.fake_bgrel = TRUE;
@@ -623,8 +626,14 @@ void __create_window ( MenuFlags menu_flags )
CacheState.main_window = box;
CacheState.flags = menu_flags;
monitor_active ( &( CacheState.mon ) );
- if ( config.fake_transparency ) {
- rofi_view_setup_fake_transparency ();
+
+ char *transparency = rofi_theme_get_string ( "@window", "window", NULL, "transparency", NULL);
+ if ( transparency == NULL && config.fake_transparency ){
+ transparency = config.fake_background;
+ }
+ printf("Setup transparency: %s\n", transparency);
+ if ( transparency ) {
+ rofi_view_setup_fake_transparency ( transparency );
}
if ( xcb->sncontext != NULL ) {
sn_launchee_context_setup_window ( xcb->sncontext, CacheState.main_window );
@@ -769,7 +778,7 @@ void rofi_view_update ( RofiViewState *state )
TICK ();
cairo_t *d = CacheState.edit_draw;
cairo_set_operator ( d, CAIRO_OPERATOR_SOURCE );
- if ( config.fake_transparency && CacheState.fake_bg != NULL ) {
+ if ( CacheState.fake_bg != NULL ) {
if ( CacheState.fake_bgrel ) {
cairo_set_source_surface ( d, CacheState.fake_bg, 0.0, 0.0 );
}