mirror of https://github.com/davatorium/rofi.git
Remove old theme support. (part 1)
This commit is contained in:
parent
28f74e3a5a
commit
eeee200d8f
|
@ -82,6 +82,7 @@ SOURCES=\
|
||||||
include/timings.h\
|
include/timings.h\
|
||||||
include/history.h\
|
include/history.h\
|
||||||
include/theme.h\
|
include/theme.h\
|
||||||
|
include/default-theme.h\
|
||||||
include/widgets/box.h\
|
include/widgets/box.h\
|
||||||
include/widgets/container.h\
|
include/widgets/container.h\
|
||||||
include/widgets/widget.h\
|
include/widgets/widget.h\
|
||||||
|
|
|
@ -33,8 +33,6 @@ Settings config = {
|
||||||
/** List of enabled modi. */
|
/** List of enabled modi. */
|
||||||
/** -modi */
|
/** -modi */
|
||||||
.modi = "window,run,ssh",
|
.modi = "window,run,ssh",
|
||||||
/** Border width around the window. */
|
|
||||||
.menu_bw = 1,
|
|
||||||
/** The width of the switcher. (0100 in % > 100 in pixels) */
|
/** The width of the switcher. (0100 in % > 100 in pixels) */
|
||||||
.menu_width = 50,
|
.menu_width = 50,
|
||||||
/** Maximum number of options to show. */
|
/** Maximum number of options to show. */
|
||||||
|
@ -45,12 +43,6 @@ Settings config = {
|
||||||
.menu_font = "mono 12",
|
.menu_font = "mono 12",
|
||||||
|
|
||||||
/** Row colors */
|
/** Row colors */
|
||||||
// Enable new color
|
|
||||||
.color_normal = "#fdf6e3,#002b36,#eee8d5,#586e75,#eee8d5",
|
|
||||||
.color_urgent = "#fdf6e3,#dc322f,#eee8d5,#dc322f,#fdf6e3",
|
|
||||||
.color_active = "#fdf6e3,#268bd2,#eee8d5,#268bd2,#fdf6e3",
|
|
||||||
.color_window = "#fdf6e3,#002b36",
|
|
||||||
|
|
||||||
/** Terminal to use. (for ssh and open in terminal) */
|
/** Terminal to use. (for ssh and open in terminal) */
|
||||||
.terminal_emulator = "rofi-sensible-terminal",
|
.terminal_emulator = "rofi-sensible-terminal",
|
||||||
.ssh_client = "ssh",
|
.ssh_client = "ssh",
|
||||||
|
@ -76,8 +68,6 @@ Settings config = {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
.location = WL_CENTER,
|
.location = WL_CENTER,
|
||||||
/** Padding between elements */
|
|
||||||
.padding = 5,
|
|
||||||
/** Y offset */
|
/** Y offset */
|
||||||
.y_offset = 0,
|
.y_offset = 0,
|
||||||
/** X offset */
|
/** X offset */
|
||||||
|
@ -111,22 +101,12 @@ Settings config = {
|
||||||
.matching_method = MM_NORMAL,
|
.matching_method = MM_NORMAL,
|
||||||
/** Monitor */
|
/** Monitor */
|
||||||
.monitor = "-5",
|
.monitor = "-5",
|
||||||
/** set line margin */
|
|
||||||
.line_margin = 2,
|
|
||||||
.line_padding = 1,
|
|
||||||
/** Set filter */
|
/** Set filter */
|
||||||
.filter = NULL,
|
.filter = NULL,
|
||||||
/** Separator style: dash/solid */
|
|
||||||
.separator_style = "dash",
|
|
||||||
/** Hide scrollbar */
|
|
||||||
.hide_scrollbar = FALSE,
|
|
||||||
.fullscreen = FALSE,
|
.fullscreen = FALSE,
|
||||||
.fake_transparency = FALSE,
|
|
||||||
.dpi = -1,
|
.dpi = -1,
|
||||||
.threads = 0,
|
.threads = 0,
|
||||||
.scrollbar_width = 8,
|
|
||||||
.scroll_method = 0,
|
.scroll_method = 0,
|
||||||
.fake_background = "screenshot",
|
|
||||||
.window_format = "{w} {c} {t}",
|
.window_format = "{w} {c} {t}",
|
||||||
.click_to_exit = TRUE,
|
.click_to_exit = TRUE,
|
||||||
.show_match = TRUE,
|
.show_match = TRUE,
|
||||||
|
|
|
@ -8,20 +8,8 @@ rofi.lines: 8
|
||||||
rofi.columns: 1
|
rofi.columns: 1
|
||||||
! "Font to use" Set from: File
|
! "Font to use" Set from: File
|
||||||
rofi.font: Source Code Pro Medium 10
|
rofi.font: Source Code Pro Medium 10
|
||||||
! "Color scheme for normal row" Set from: File
|
|
||||||
rofi.color-normal: argb:0000000, #a2b5df, argb:3affffff, #a2b5df, #02143f
|
|
||||||
! "Color scheme for urgent row" Set from: File
|
|
||||||
rofi.color-urgent: argb:0000000, #ff817f, argb:3affffff, #ff817f, #02143f
|
|
||||||
! "Color scheme for active row" Set from: File
|
|
||||||
rofi.color-active: argb:0000000, #6aa4ff, argb:3affffff, #6aa4ff, #02143f
|
|
||||||
! "Color scheme window" Set from: File
|
|
||||||
rofi.color-window: argb:ee02143f, #a2b5df, #a2b5df
|
|
||||||
! "Border width" Set from: File
|
|
||||||
rofi.bw: 2
|
|
||||||
! "Location on screen" Set from: File
|
! "Location on screen" Set from: File
|
||||||
rofi.location: 2
|
rofi.location: 2
|
||||||
! "Padding" Set from: File
|
|
||||||
rofi.padding: 2
|
|
||||||
! "Y-offset relative to location" Set from: File
|
! "Y-offset relative to location" Set from: File
|
||||||
rofi.yoffset: -2
|
rofi.yoffset: -2
|
||||||
! "X-offset relative to location" Set from: File
|
! "X-offset relative to location" Set from: File
|
||||||
|
@ -70,30 +58,16 @@ rofi.combi-modi: window,drun,run,ssh
|
||||||
rofi.tokenize: true
|
rofi.tokenize: true
|
||||||
! "Monitor id to show on" Set from: File
|
! "Monitor id to show on" Set from: File
|
||||||
rofi.m: -1
|
rofi.m: -1
|
||||||
! "Margin between rows" Set from: File
|
|
||||||
rofi.line-margin: 3
|
|
||||||
! "Padding within rows" Set from: Default
|
|
||||||
! rofi.line-padding: 1
|
|
||||||
! "Pre-set filter" Set from: Default
|
! "Pre-set filter" Set from: Default
|
||||||
! rofi.filter:
|
! rofi.filter:
|
||||||
! "Separator style (none, dash, solid)" Set from: File
|
|
||||||
rofi.separator-style: solid
|
|
||||||
! "Hide scroll-bar" Set from: File
|
|
||||||
rofi.hide-scrollbar: false
|
|
||||||
! "Fullscreen" Set from: File
|
! "Fullscreen" Set from: File
|
||||||
rofi.fullscreen: false
|
rofi.fullscreen: false
|
||||||
! "Fake transparency" Set from: File
|
|
||||||
rofi.fake-transparency: false
|
|
||||||
! "DPI" Set from: File
|
! "DPI" Set from: File
|
||||||
rofi.dpi: 101
|
rofi.dpi: 101
|
||||||
! "Threads to use for string matching" Set from: File
|
! "Threads to use for string matching" Set from: File
|
||||||
rofi.threads: 8
|
rofi.threads: 8
|
||||||
! "Scrollbar width" Set from: File
|
|
||||||
rofi.scrollbar-width: 8
|
|
||||||
! "Scrolling method. (0: Page, 1: Centered)" Set from: File
|
! "Scrolling method. (0: Page, 1: Centered)" Set from: File
|
||||||
rofi.scroll-method: 0
|
rofi.scroll-method: 0
|
||||||
! "Background to use for fake transparency. (background or screenshot)" Set from: File
|
|
||||||
rofi.fake-background: screenshot
|
|
||||||
! "Window Format. w (desktop name), t (title), n (name), r (role), c (class)" Set from: File
|
! "Window Format. w (desktop name), t (title), n (name), r (role), c (class)" Set from: File
|
||||||
rofi.window-format: w c t
|
rofi.window-format: w c t
|
||||||
! "Click outside the window to exit" Set from: Default
|
! "Click outside the window to exit" Set from: Default
|
||||||
|
|
|
@ -0,0 +1,88 @@
|
||||||
|
#ifndef ROFI_DEFAULT_THEME
|
||||||
|
#define ROFI_DEFAULT_THEME
|
||||||
|
|
||||||
|
const char *default_theme =
|
||||||
|
"* {"
|
||||||
|
" spacing: 2;"
|
||||||
|
" background: #00000000;"
|
||||||
|
"}"
|
||||||
|
"#window {"
|
||||||
|
" border: 1;"
|
||||||
|
" foreground: #FF002B36;"
|
||||||
|
" padding: 5;"
|
||||||
|
" background: #FFFDF6E3;"
|
||||||
|
"}"
|
||||||
|
"#window.mainbox {"
|
||||||
|
" border: 0;"
|
||||||
|
" padding: 0;"
|
||||||
|
"}"
|
||||||
|
"#window.mainbox.message.box {"
|
||||||
|
" border: 1px dash 0px 0px ;"
|
||||||
|
" padding: 2px 0px 0px ;"
|
||||||
|
"}"
|
||||||
|
"#window.mainbox.message.normal {"
|
||||||
|
" foreground: #FF002B36;"
|
||||||
|
" background: #FFFDF6E3;"
|
||||||
|
"}"
|
||||||
|
"#window.mainbox.listview {"
|
||||||
|
" fixed-height: 0;"
|
||||||
|
" border: 1px dash 0px 0px ;"
|
||||||
|
" columns: 1;"
|
||||||
|
" padding: 2px 0px 0px ;"
|
||||||
|
"}"
|
||||||
|
"#window.mainbox.listview.element {"
|
||||||
|
" border: 0;"
|
||||||
|
"}"
|
||||||
|
"#window.mainbox.listview.element.normal.normal {"
|
||||||
|
" foreground: #FF002B36;"
|
||||||
|
" background: #FFFDF6E3;"
|
||||||
|
"}"
|
||||||
|
"#window.mainbox.listview.element.normal.urgent {"
|
||||||
|
" foreground: #FFDC322F;"
|
||||||
|
" background: #FFFDF6E3;"
|
||||||
|
"}"
|
||||||
|
"#window.mainbox.listview.element.normal.active {"
|
||||||
|
" foreground: #FF268BD2;"
|
||||||
|
" background: #FFFDF6E3;"
|
||||||
|
"}"
|
||||||
|
"#window.mainbox.listview.element.selected.normal {"
|
||||||
|
" foreground: #FFEEE8D5;"
|
||||||
|
" background: #FF586E75;"
|
||||||
|
"}"
|
||||||
|
"#window.mainbox.listview.element.selected.urgent {"
|
||||||
|
" foreground: #FFFDF6E3;"
|
||||||
|
" background: #FFDC322F;"
|
||||||
|
"}"
|
||||||
|
"#window.mainbox.listview.element.selected.active {"
|
||||||
|
" foreground: #FFFDF6E3;"
|
||||||
|
" background: #FF268BD2;"
|
||||||
|
"}"
|
||||||
|
"#window.mainbox.listview.element.alternate.normal {"
|
||||||
|
" foreground: #FF002B36;"
|
||||||
|
" background: #FFEEE8D5;"
|
||||||
|
"}"
|
||||||
|
"#window.mainbox.listview.element.alternate.urgent {"
|
||||||
|
" foreground: #FFDC322F;"
|
||||||
|
" background: #FFEEE8D5;"
|
||||||
|
"}"
|
||||||
|
"#window.mainbox.listview.element.alternate.active {"
|
||||||
|
" foreground: #FF268BD2;"
|
||||||
|
" background: #FFEEE8D5;"
|
||||||
|
"}"
|
||||||
|
"#window.mainbox.listview.scrollbar {"
|
||||||
|
" border: 0;"
|
||||||
|
" padding: 0;"
|
||||||
|
"}"
|
||||||
|
"#window.mainbox.sidebar.box {"
|
||||||
|
" border: 1px dash 0px 0px ;"
|
||||||
|
"}"
|
||||||
|
"#window.mainbox.inputbar {"
|
||||||
|
" spacing: 0;"
|
||||||
|
"}"
|
||||||
|
"#window.mainbox.inputbar.box {"
|
||||||
|
"}"
|
||||||
|
"#window.mainbox.inputbar.normal {"
|
||||||
|
" foreground: #FF002B36;"
|
||||||
|
" background: #FFFDF6E3;"
|
||||||
|
"}";
|
||||||
|
#endif
|
|
@ -55,8 +55,6 @@ typedef struct
|
||||||
{
|
{
|
||||||
/** List of enabled modi */
|
/** List of enabled modi */
|
||||||
char *modi;
|
char *modi;
|
||||||
/** Border width */
|
|
||||||
unsigned int menu_bw;
|
|
||||||
/** Width (0-100 in %, > 100 in pixels, < 0 in char width.) */
|
/** Width (0-100 in %, > 100 in pixels, < 0 in char width.) */
|
||||||
int menu_width;
|
int menu_width;
|
||||||
/** # lines */
|
/** # lines */
|
||||||
|
@ -66,11 +64,6 @@ typedef struct
|
||||||
/** Font string (pango format) */
|
/** Font string (pango format) */
|
||||||
char * menu_font;
|
char * menu_font;
|
||||||
|
|
||||||
/** New row colors */
|
|
||||||
char * color_normal;
|
|
||||||
char * color_active;
|
|
||||||
char * color_urgent;
|
|
||||||
char * color_window;
|
|
||||||
/** Terminal to use */
|
/** Terminal to use */
|
||||||
char * terminal_emulator;
|
char * terminal_emulator;
|
||||||
/** SSH client to use */
|
/** SSH client to use */
|
||||||
|
@ -88,8 +81,6 @@ typedef struct
|
||||||
|
|
||||||
/** Windows location/gravity */
|
/** Windows location/gravity */
|
||||||
WindowLocation location;
|
WindowLocation location;
|
||||||
/** Padding between elements */
|
|
||||||
unsigned int padding;
|
|
||||||
/** Y offset */
|
/** Y offset */
|
||||||
int y_offset;
|
int y_offset;
|
||||||
/** X offset */
|
/** X offset */
|
||||||
|
@ -125,27 +116,15 @@ typedef struct
|
||||||
unsigned int tokenize;
|
unsigned int tokenize;
|
||||||
/** Monitors */
|
/** Monitors */
|
||||||
char *monitor;
|
char *monitor;
|
||||||
/** Line margin */
|
|
||||||
unsigned int line_margin;
|
|
||||||
unsigned int line_padding;
|
|
||||||
/** filter */
|
/** filter */
|
||||||
char *filter;
|
char *filter;
|
||||||
/** style */
|
|
||||||
char *separator_style;
|
|
||||||
/** hide scrollbar */
|
|
||||||
unsigned int hide_scrollbar;
|
|
||||||
/** fullscreen */
|
/** fullscreen */
|
||||||
unsigned int fullscreen;
|
unsigned int fullscreen;
|
||||||
/** bg image */
|
|
||||||
unsigned int fake_transparency;
|
|
||||||
/** dpi */
|
/** dpi */
|
||||||
int dpi;
|
int dpi;
|
||||||
/** Number threads (1 to disable) */
|
/** Number threads (1 to disable) */
|
||||||
unsigned int threads;
|
unsigned int threads;
|
||||||
unsigned int scrollbar_width;
|
|
||||||
unsigned int scroll_method;
|
unsigned int scroll_method;
|
||||||
/** Background type */
|
|
||||||
char *fake_background;
|
|
||||||
|
|
||||||
char *window_format;
|
char *window_format;
|
||||||
/** Click outside the window to exit */
|
/** Click outside the window to exit */
|
||||||
|
|
|
@ -377,13 +377,6 @@ int distance_get_pixel ( Distance d, Orientation ori );
|
||||||
*/
|
*/
|
||||||
void distance_get_linestyle ( Distance d, cairo_t *draw );
|
void distance_get_linestyle ( Distance d, cairo_t *draw );
|
||||||
|
|
||||||
#ifdef THEME_CONVERTER
|
|
||||||
/**
|
|
||||||
* Function to convert old theme into new theme format.
|
|
||||||
*/
|
|
||||||
void rofi_theme_convert_old_theme ( void );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Low-level functions.
|
* Low-level functions.
|
||||||
* These can be used by non-widgets to obtain values.
|
* These can be used by non-widgets to obtain values.
|
||||||
|
|
|
@ -69,6 +69,8 @@
|
||||||
|
|
||||||
#include "timings.h"
|
#include "timings.h"
|
||||||
|
|
||||||
|
#include "default-theme.h"
|
||||||
|
|
||||||
// Plugin abi version.
|
// Plugin abi version.
|
||||||
// TODO: move this check to mode.c
|
// TODO: move this check to mode.c
|
||||||
#include "mode-private.h"
|
#include "mode-private.h"
|
||||||
|
@ -1083,7 +1085,12 @@ int main ( int argc, char *argv[] )
|
||||||
g_free ( theme_str );
|
g_free ( theme_str );
|
||||||
}
|
}
|
||||||
if ( rofi_theme_is_empty ( ) ) {
|
if ( rofi_theme_is_empty ( ) ) {
|
||||||
rofi_theme_convert_old_theme ( );
|
if ( rofi_theme_parse_string ( default_theme ) ){
|
||||||
|
fprintf(stderr, "Failed to parse default theme. Giving up..\n");
|
||||||
|
rofi_theme = NULL;
|
||||||
|
cleanup ();
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( find_arg ( "-dump-theme" ) >= 0 ) {
|
if ( find_arg ( "-dump-theme" ) >= 0 ) {
|
||||||
|
|
301
source/theme.c
301
source/theme.c
|
@ -574,304 +574,3 @@ gboolean rofi_theme_is_empty ( void )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef THEME_CONVERTER
|
|
||||||
|
|
||||||
static Property* rofi_theme_convert_get_color ( const char *color, const char *name )
|
|
||||||
{
|
|
||||||
Color c = color_get ( color );
|
|
||||||
Property *p = rofi_theme_property_create ( P_COLOR );
|
|
||||||
p->name = g_strdup ( name );
|
|
||||||
p->value.color.alpha = c.alpha;
|
|
||||||
p->value.color.red = c.red;
|
|
||||||
p->value.color.green = c.green;
|
|
||||||
p->value.color.blue = c.blue;
|
|
||||||
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
static void rofi_theme_convert_create_property_ht ( ThemeWidget *widget )
|
|
||||||
{
|
|
||||||
if ( widget->properties == NULL ) {
|
|
||||||
widget->properties = g_hash_table_new_full ( g_str_hash, g_str_equal, NULL, (GDestroyNotify) rofi_theme_property_free );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void rofi_theme_convert_old_theme ( void )
|
|
||||||
{
|
|
||||||
if ( rofi_theme != NULL ) {
|
|
||||||
rofi_theme_free ( rofi_theme );
|
|
||||||
}
|
|
||||||
rofi_theme = (ThemeWidget *) g_slice_new0 ( ThemeWidget );
|
|
||||||
rofi_theme->name = g_strdup ( "Root" );
|
|
||||||
rofi_theme_convert_create_property_ht ( rofi_theme );
|
|
||||||
ThemeWidget *window_widget = rofi_theme_find_or_create_name ( rofi_theme, "window" );
|
|
||||||
rofi_theme_convert_create_property_ht ( window_widget );
|
|
||||||
ThemeWidget *mainbox_widget = rofi_theme_find_or_create_name ( window_widget, "mainbox" );
|
|
||||||
rofi_theme_convert_create_property_ht ( mainbox_widget );
|
|
||||||
ThemeWidget *message = rofi_theme_find_or_create_name ( mainbox_widget, "message" );
|
|
||||||
ThemeWidget *message_box = rofi_theme_find_or_create_name ( message, "box" );
|
|
||||||
rofi_theme_convert_create_property_ht ( message_box );
|
|
||||||
ThemeWidget *listview_widget = rofi_theme_find_or_create_name ( mainbox_widget, "listview" );
|
|
||||||
rofi_theme_convert_create_property_ht ( listview_widget );
|
|
||||||
ThemeWidget *sidebar_widget = rofi_theme_find_or_create_name ( mainbox_widget, "sidebar" );
|
|
||||||
ThemeWidget *sidebarbox_widget = rofi_theme_find_or_create_name ( sidebar_widget, "box" );
|
|
||||||
rofi_theme_convert_create_property_ht ( sidebarbox_widget );
|
|
||||||
{
|
|
||||||
Property *p = rofi_theme_property_create ( P_INTEGER );
|
|
||||||
p->name = g_strdup ( "border" );
|
|
||||||
p->value.i = 0;
|
|
||||||
g_hash_table_replace ( mainbox_widget->properties, p->name, p );
|
|
||||||
|
|
||||||
p = rofi_theme_property_create ( P_INTEGER );
|
|
||||||
p->name = g_strdup ( "padding" );
|
|
||||||
p->value.i = config.padding;
|
|
||||||
g_hash_table_replace ( window_widget->properties, p->name, p );
|
|
||||||
|
|
||||||
p = rofi_theme_property_create ( P_INTEGER );
|
|
||||||
p->name = g_strdup ( "padding" );
|
|
||||||
p->value.i = 0;
|
|
||||||
g_hash_table_replace ( mainbox_widget->properties, p->name, p );
|
|
||||||
// Spacing
|
|
||||||
p = rofi_theme_property_create ( P_INTEGER );
|
|
||||||
p->name = g_strdup ( "spacing" );
|
|
||||||
p->value.i = config.line_margin;
|
|
||||||
g_hash_table_replace ( rofi_theme->properties, p->name, p );
|
|
||||||
}
|
|
||||||
{
|
|
||||||
// Background
|
|
||||||
Property *p = rofi_theme_property_create ( P_COLOR );
|
|
||||||
p->name = g_strdup ( "background" );
|
|
||||||
p->value.color.alpha = 0;
|
|
||||||
p->value.color.red = 0;
|
|
||||||
p->value.color.green = 0;
|
|
||||||
p->value.color.blue = 0;
|
|
||||||
g_hash_table_replace ( rofi_theme->properties, p->name, p );
|
|
||||||
|
|
||||||
ThemeWidget *inputbar_widget = rofi_theme_find_or_create_name ( mainbox_widget, "inputbar" );
|
|
||||||
rofi_theme_convert_create_property_ht ( inputbar_widget );
|
|
||||||
p = rofi_theme_property_create ( P_INTEGER );
|
|
||||||
p->name = g_strdup ( "spacing" );
|
|
||||||
p->value.i = 0;
|
|
||||||
g_hash_table_replace ( inputbar_widget->properties, p->name, p );
|
|
||||||
|
|
||||||
LineStyle style = ( g_strcmp0 ( config.separator_style, "dash" ) == 0 ) ? DASH : SOLID;
|
|
||||||
int place_end = ( config.location == WL_SOUTH_EAST || config.location == WL_SOUTH || config.location == WL_SOUTH_WEST );
|
|
||||||
p = rofi_theme_property_create ( P_PADDING );
|
|
||||||
p->name = g_strdup ( "border" );
|
|
||||||
Distance d = (Distance){ config.menu_bw, PW_PX, style };
|
|
||||||
if ( place_end ) {
|
|
||||||
p->value.padding.bottom = d;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
p->value.padding.top = d;
|
|
||||||
}
|
|
||||||
g_hash_table_replace ( listview_widget->properties, p->name, p );
|
|
||||||
|
|
||||||
p = rofi_theme_property_create ( P_PADDING );
|
|
||||||
p->name = g_strdup ( "border" );
|
|
||||||
d = (Distance){ config.menu_bw, PW_PX, style };
|
|
||||||
if ( place_end ) {
|
|
||||||
p->value.padding.bottom = d;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
p->value.padding.top = d;
|
|
||||||
}
|
|
||||||
g_hash_table_replace ( message_box->properties, p->name, p );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sidebar top
|
|
||||||
*/
|
|
||||||
p = rofi_theme_property_create ( P_PADDING );
|
|
||||||
p->name = g_strdup ( "border" );
|
|
||||||
d = (Distance){ config.menu_bw, PW_PX, style };
|
|
||||||
p->value.padding.top = d;
|
|
||||||
g_hash_table_replace ( sidebarbox_widget->properties, p->name, p );
|
|
||||||
|
|
||||||
p = rofi_theme_property_create ( P_PADDING );
|
|
||||||
p->name = g_strdup ( "padding" );
|
|
||||||
d = (Distance){ config.line_margin, PW_PX, SOLID };
|
|
||||||
if ( place_end ) {
|
|
||||||
p->value.padding.bottom = d;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
p->value.padding.top = d;
|
|
||||||
}
|
|
||||||
g_hash_table_replace ( listview_widget->properties, p->name, p );
|
|
||||||
|
|
||||||
p = rofi_theme_property_create ( P_PADDING );
|
|
||||||
p->name = g_strdup ( "padding" );
|
|
||||||
d = (Distance){ config.line_margin, PW_PX, SOLID };
|
|
||||||
if ( place_end ) {
|
|
||||||
p->value.padding.bottom = d;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
p->value.padding.top = d;
|
|
||||||
}
|
|
||||||
g_hash_table_replace ( message_box->properties, p->name, p );
|
|
||||||
}
|
|
||||||
{
|
|
||||||
Property *p = rofi_theme_property_create ( P_INTEGER );
|
|
||||||
p->name = g_strdup ( "columns" );
|
|
||||||
p->value.i = config.menu_columns;
|
|
||||||
g_hash_table_replace ( listview_widget->properties, p->name, p );
|
|
||||||
p = rofi_theme_property_create ( P_INTEGER );
|
|
||||||
p->name = g_strdup ( "fixed-height" );
|
|
||||||
p->value.i = !( config.fixed_num_lines );
|
|
||||||
g_hash_table_replace ( listview_widget->properties, p->name, p );
|
|
||||||
}
|
|
||||||
{
|
|
||||||
// Border width.
|
|
||||||
rofi_theme_convert_create_property_ht ( window_widget );
|
|
||||||
// Padding
|
|
||||||
Property *p = rofi_theme_property_create ( P_INTEGER );
|
|
||||||
p->name = g_strdup ( "padding" );
|
|
||||||
p->value.i = config.padding;
|
|
||||||
g_hash_table_replace ( window_widget->properties, p->name, p );
|
|
||||||
|
|
||||||
p = rofi_theme_property_create ( P_INTEGER );
|
|
||||||
p->name = g_strdup ( "border" );
|
|
||||||
p->value.i = config.menu_bw;
|
|
||||||
g_hash_table_replace ( window_widget->properties, p->name, p );
|
|
||||||
}
|
|
||||||
{
|
|
||||||
gchar **vals = g_strsplit ( config.color_window, ",", 3 );
|
|
||||||
if ( vals != NULL ) {
|
|
||||||
if ( vals[0] != NULL ) {
|
|
||||||
Property *p = rofi_theme_convert_get_color ( vals[0], "background" );
|
|
||||||
g_hash_table_replace ( window_widget->properties, p->name, p );
|
|
||||||
|
|
||||||
if ( vals[1] != NULL ) {
|
|
||||||
p = rofi_theme_convert_get_color ( vals[1], "foreground" );
|
|
||||||
g_hash_table_replace ( window_widget->properties, p->name, p );
|
|
||||||
|
|
||||||
ThemeWidget *inputbar = rofi_theme_find_or_create_name ( mainbox_widget, "inputbar" );
|
|
||||||
ThemeWidget *widget = rofi_theme_find_or_create_name ( inputbar, "box" );
|
|
||||||
rofi_theme_convert_create_property_ht ( widget );
|
|
||||||
if ( vals[2] != NULL ) {
|
|
||||||
p = rofi_theme_convert_get_color ( vals[2], "foreground" );
|
|
||||||
g_hash_table_replace ( window_widget->properties, p->name, p );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
p = rofi_theme_convert_get_color ( vals[1], "foreground" );
|
|
||||||
g_hash_table_replace ( window_widget->properties, p->name, p );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
g_strfreev ( vals );
|
|
||||||
{
|
|
||||||
ThemeWidget *widget = rofi_theme_find_or_create_name ( listview_widget, "element" );
|
|
||||||
ThemeWidget *scrollbar = rofi_theme_find_or_create_name ( listview_widget, "scrollbar" );
|
|
||||||
|
|
||||||
ThemeWidget *wnormal = rofi_theme_find_or_create_name ( widget, "normal" );
|
|
||||||
ThemeWidget *wselected = rofi_theme_find_or_create_name ( widget, "selected" );
|
|
||||||
ThemeWidget *walternate = rofi_theme_find_or_create_name ( widget, "alternate" );
|
|
||||||
|
|
||||||
rofi_theme_convert_create_property_ht ( widget );
|
|
||||||
Property *p = rofi_theme_property_create ( P_INTEGER );
|
|
||||||
p->name = g_strdup ( "border" );
|
|
||||||
p->value.i = 0;
|
|
||||||
g_hash_table_replace ( widget->properties, p->name, p );
|
|
||||||
|
|
||||||
rofi_theme_convert_create_property_ht ( scrollbar );
|
|
||||||
p = rofi_theme_property_create ( P_INTEGER );
|
|
||||||
p->name = g_strdup ( "border" );
|
|
||||||
p->value.i = 0;
|
|
||||||
g_hash_table_replace ( scrollbar->properties, p->name, p );
|
|
||||||
p = rofi_theme_property_create ( P_INTEGER );
|
|
||||||
p->name = g_strdup ( "padding" );
|
|
||||||
p->value.i = 0;
|
|
||||||
g_hash_table_replace ( scrollbar->properties, p->name, p );
|
|
||||||
|
|
||||||
gchar **vals = g_strsplit ( config.color_normal, ",", 5 );
|
|
||||||
if ( g_strv_length ( vals ) == 5 ) {
|
|
||||||
ThemeWidget *wnn = rofi_theme_find_or_create_name ( wnormal, "normal" );
|
|
||||||
rofi_theme_convert_create_property_ht ( wnn );
|
|
||||||
p = rofi_theme_convert_get_color ( vals[0], "background" );
|
|
||||||
g_hash_table_replace ( wnn->properties, p->name, p );
|
|
||||||
p = rofi_theme_convert_get_color ( vals[1], "foreground" );
|
|
||||||
g_hash_table_replace ( wnn->properties, p->name, p );
|
|
||||||
|
|
||||||
ThemeWidget *wsl = rofi_theme_find_or_create_name ( wselected, "normal" );
|
|
||||||
rofi_theme_convert_create_property_ht ( wsl );
|
|
||||||
p = rofi_theme_convert_get_color ( vals[3], "background" );
|
|
||||||
g_hash_table_replace ( wsl->properties, p->name, p );
|
|
||||||
p = rofi_theme_convert_get_color ( vals[4], "foreground" );
|
|
||||||
g_hash_table_replace ( wsl->properties, p->name, p );
|
|
||||||
|
|
||||||
ThemeWidget *wal = rofi_theme_find_or_create_name ( walternate, "normal" );
|
|
||||||
rofi_theme_convert_create_property_ht ( wal );
|
|
||||||
p = rofi_theme_convert_get_color ( vals[2], "background" );
|
|
||||||
g_hash_table_replace ( wal->properties, p->name, p );
|
|
||||||
p = rofi_theme_convert_get_color ( vals[1], "foreground" );
|
|
||||||
g_hash_table_replace ( wal->properties, p->name, p );
|
|
||||||
|
|
||||||
ThemeWidget *inputbar = rofi_theme_find_or_create_name ( mainbox_widget, "inputbar" );
|
|
||||||
wnn = rofi_theme_find_or_create_name ( inputbar, "normal" );
|
|
||||||
rofi_theme_convert_create_property_ht ( wnn );
|
|
||||||
p = rofi_theme_convert_get_color ( vals[0], "background" );
|
|
||||||
g_hash_table_replace ( wnn->properties, p->name, p );
|
|
||||||
p = rofi_theme_convert_get_color ( vals[1], "foreground" );
|
|
||||||
g_hash_table_replace ( wnn->properties, p->name, p );
|
|
||||||
|
|
||||||
wnn = rofi_theme_find_or_create_name ( message, "normal" );
|
|
||||||
rofi_theme_convert_create_property_ht ( wnn );
|
|
||||||
p = rofi_theme_convert_get_color ( vals[0], "background" );
|
|
||||||
g_hash_table_replace ( wnn->properties, p->name, p );
|
|
||||||
p = rofi_theme_convert_get_color ( vals[1], "foreground" );
|
|
||||||
g_hash_table_replace ( wnn->properties, p->name, p );
|
|
||||||
}
|
|
||||||
g_strfreev ( vals );
|
|
||||||
|
|
||||||
vals = g_strsplit ( config.color_urgent, ",", 5 );
|
|
||||||
if ( g_strv_length ( vals ) == 5 ) {
|
|
||||||
ThemeWidget *wnn = rofi_theme_find_or_create_name ( wnormal, "urgent" );
|
|
||||||
rofi_theme_convert_create_property_ht ( wnn );
|
|
||||||
p = rofi_theme_convert_get_color ( vals[0], "background" );
|
|
||||||
g_hash_table_replace ( wnn->properties, p->name, p );
|
|
||||||
p = rofi_theme_convert_get_color ( vals[1], "foreground" );
|
|
||||||
g_hash_table_replace ( wnn->properties, p->name, p );
|
|
||||||
|
|
||||||
ThemeWidget *wsl = rofi_theme_find_or_create_name ( wselected, "urgent" );
|
|
||||||
rofi_theme_convert_create_property_ht ( wsl );
|
|
||||||
p = rofi_theme_convert_get_color ( vals[3], "background" );
|
|
||||||
g_hash_table_replace ( wsl->properties, p->name, p );
|
|
||||||
p = rofi_theme_convert_get_color ( vals[4], "foreground" );
|
|
||||||
g_hash_table_replace ( wsl->properties, p->name, p );
|
|
||||||
|
|
||||||
ThemeWidget *wal = rofi_theme_find_or_create_name ( walternate, "urgent" );
|
|
||||||
rofi_theme_convert_create_property_ht ( wal );
|
|
||||||
p = rofi_theme_convert_get_color ( vals[2], "background" );
|
|
||||||
g_hash_table_replace ( wal->properties, p->name, p );
|
|
||||||
p = rofi_theme_convert_get_color ( vals[1], "foreground" );
|
|
||||||
g_hash_table_replace ( wal->properties, p->name, p );
|
|
||||||
}
|
|
||||||
g_strfreev ( vals );
|
|
||||||
|
|
||||||
vals = g_strsplit ( config.color_active, ",", 5 );
|
|
||||||
if ( g_strv_length ( vals ) == 5 ) {
|
|
||||||
ThemeWidget *wnn = rofi_theme_find_or_create_name ( wnormal, "active" );
|
|
||||||
rofi_theme_convert_create_property_ht ( wnn );
|
|
||||||
p = rofi_theme_convert_get_color ( vals[0], "background" );
|
|
||||||
g_hash_table_replace ( wnn->properties, p->name, p );
|
|
||||||
p = rofi_theme_convert_get_color ( vals[1], "foreground" );
|
|
||||||
g_hash_table_replace ( wnn->properties, p->name, p );
|
|
||||||
|
|
||||||
ThemeWidget *wsl = rofi_theme_find_or_create_name ( wselected, "active" );
|
|
||||||
rofi_theme_convert_create_property_ht ( wsl );
|
|
||||||
p = rofi_theme_convert_get_color ( vals[3], "background" );
|
|
||||||
g_hash_table_replace ( wsl->properties, p->name, p );
|
|
||||||
p = rofi_theme_convert_get_color ( vals[4], "foreground" );
|
|
||||||
g_hash_table_replace ( wsl->properties, p->name, p );
|
|
||||||
|
|
||||||
ThemeWidget *wal = rofi_theme_find_or_create_name ( walternate, "active" );
|
|
||||||
rofi_theme_convert_create_property_ht ( wal );
|
|
||||||
p = rofi_theme_convert_get_color ( vals[2], "background" );
|
|
||||||
g_hash_table_replace ( wal->properties, p->name, p );
|
|
||||||
p = rofi_theme_convert_get_color ( vals[1], "foreground" );
|
|
||||||
g_hash_table_replace ( wal->properties, p->name, p );
|
|
||||||
}
|
|
||||||
g_strfreev ( vals );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -759,9 +759,6 @@ void __create_window ( MenuFlags menu_flags )
|
||||||
|
|
||||||
TICK_N ( "setup window name and class" );
|
TICK_N ( "setup window name and class" );
|
||||||
char *transparency = rofi_theme_get_string ( WIDGET ( win ), "transparency", NULL );
|
char *transparency = rofi_theme_get_string ( WIDGET ( win ), "transparency", NULL );
|
||||||
if ( transparency == NULL && config.fake_transparency ) {
|
|
||||||
transparency = config.fake_background;
|
|
||||||
}
|
|
||||||
if ( transparency ) {
|
if ( transparency ) {
|
||||||
rofi_view_setup_fake_transparency ( transparency );
|
rofi_view_setup_fake_transparency ( transparency );
|
||||||
}
|
}
|
||||||
|
|
|
@ -394,7 +394,7 @@ listview *listview_create ( const char *name, listview_update_callback cb, void
|
||||||
lv->fixed_num_lines = rofi_theme_get_boolean ( WIDGET ( lv ), "fixed-height", config.fixed_num_lines );
|
lv->fixed_num_lines = rofi_theme_get_boolean ( WIDGET ( lv ), "fixed-height", config.fixed_num_lines );
|
||||||
lv->dynamic = rofi_theme_get_boolean ( WIDGET ( lv ), "dynamic", TRUE );
|
lv->dynamic = rofi_theme_get_boolean ( WIDGET ( lv ), "dynamic", TRUE );
|
||||||
lv->reverse = rofi_theme_get_boolean ( WIDGET ( lv ), "reverse", reverse );
|
lv->reverse = rofi_theme_get_boolean ( WIDGET ( lv ), "reverse", reverse );
|
||||||
listview_set_show_scrollbar ( lv, rofi_theme_get_boolean ( WIDGET ( lv ), "scrollbar", !config.hide_scrollbar ) );
|
listview_set_show_scrollbar ( lv, rofi_theme_get_boolean ( WIDGET ( lv ), "scrollbar", FALSE ) );
|
||||||
lv->cycle = rofi_theme_get_boolean ( WIDGET ( lv ), "cycle", config.cycle );
|
lv->cycle = rofi_theme_get_boolean ( WIDGET ( lv ), "cycle", config.cycle );
|
||||||
|
|
||||||
return lv;
|
return lv;
|
||||||
|
|
|
@ -96,25 +96,10 @@ static XrmOption xrmOptions[] = {
|
||||||
|
|
||||||
{ xrm_String, "font", { .str = &config.menu_font }, NULL,
|
{ xrm_String, "font", { .str = &config.menu_font }, NULL,
|
||||||
"Font to use", CONFIG_DEFAULT },
|
"Font to use", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "color-normal", { .str = &config.color_normal }, NULL,
|
|
||||||
"Color scheme for normal row", CONFIG_DEFAULT },
|
|
||||||
{ xrm_String, "color-urgent", { .str = &config.color_urgent }, NULL,
|
|
||||||
"Color scheme for urgent row", CONFIG_DEFAULT },
|
|
||||||
{ xrm_String, "color-active", { .str = &config.color_active }, NULL,
|
|
||||||
"Color scheme for active row", CONFIG_DEFAULT },
|
|
||||||
{ xrm_String, "color-window", { .str = &config.color_window }, NULL,
|
|
||||||
"Color scheme window", CONFIG_DEFAULT },
|
|
||||||
|
|
||||||
{ xrm_Number, "borderwidth", { .num = &config.menu_bw }, NULL,
|
|
||||||
"", CONFIG_DEFAULT },
|
|
||||||
{ xrm_Number, "bw", { .num = &config.menu_bw }, NULL,
|
|
||||||
"Border width", CONFIG_DEFAULT },
|
|
||||||
|
|
||||||
{ xrm_Number, "location", { .num = &config.location }, NULL,
|
{ xrm_Number, "location", { .num = &config.location }, NULL,
|
||||||
"Location on screen", CONFIG_DEFAULT },
|
"Location on screen", CONFIG_DEFAULT },
|
||||||
|
|
||||||
{ xrm_Number, "padding", { .num = &config.padding }, NULL,
|
|
||||||
"Padding", CONFIG_DEFAULT },
|
|
||||||
{ xrm_SNumber, "yoffset", { .snum = &config.y_offset }, NULL,
|
{ xrm_SNumber, "yoffset", { .snum = &config.y_offset }, NULL,
|
||||||
"Y-offset relative to location", CONFIG_DEFAULT },
|
"Y-offset relative to location", CONFIG_DEFAULT },
|
||||||
{ xrm_SNumber, "xoffset", { .snum = &config.x_offset }, NULL,
|
{ xrm_SNumber, "xoffset", { .snum = &config.x_offset }, NULL,
|
||||||
|
@ -168,30 +153,16 @@ static XrmOption xrmOptions[] = {
|
||||||
/* Alias for dmenu compatibility. */
|
/* Alias for dmenu compatibility. */
|
||||||
{ xrm_String, "m", { .str = &config.monitor }, NULL,
|
{ xrm_String, "m", { .str = &config.monitor }, NULL,
|
||||||
"Monitor id to show on", CONFIG_DEFAULT },
|
"Monitor id to show on", CONFIG_DEFAULT },
|
||||||
{ xrm_Number, "line-margin", { .num = &config.line_margin }, NULL,
|
|
||||||
"Margin between rows", CONFIG_DEFAULT },
|
|
||||||
{ xrm_Number, "line-padding", { .num = &config.line_padding }, NULL,
|
|
||||||
"Padding within rows", CONFIG_DEFAULT },
|
|
||||||
{ xrm_String, "filter", { .str = &config.filter }, NULL,
|
{ xrm_String, "filter", { .str = &config.filter }, NULL,
|
||||||
"Pre-set filter", CONFIG_DEFAULT },
|
"Pre-set filter", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "separator-style", { .str = &config.separator_style }, NULL,
|
|
||||||
"Separator style (none, dash, solid)", CONFIG_DEFAULT },
|
|
||||||
{ xrm_Boolean, "hide-scrollbar", { .num = &config.hide_scrollbar }, NULL,
|
|
||||||
"Hide scroll-bar", CONFIG_DEFAULT },
|
|
||||||
{ xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL,
|
{ xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL,
|
||||||
"Fullscreen", CONFIG_DEFAULT },
|
"Fullscreen", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "fake-transparency", { .num = &config.fake_transparency }, NULL,
|
|
||||||
"Fake transparency", CONFIG_DEFAULT },
|
|
||||||
{ xrm_SNumber, "dpi", { .snum = &config.dpi }, NULL,
|
{ xrm_SNumber, "dpi", { .snum = &config.dpi }, NULL,
|
||||||
"DPI", CONFIG_DEFAULT },
|
"DPI", CONFIG_DEFAULT },
|
||||||
{ xrm_Number, "threads", { .num = &config.threads }, NULL,
|
{ xrm_Number, "threads", { .num = &config.threads }, NULL,
|
||||||
"Threads to use for string matching", CONFIG_DEFAULT },
|
"Threads to use for string matching", CONFIG_DEFAULT },
|
||||||
{ xrm_Number, "scrollbar-width", { .num = &config.scrollbar_width }, NULL,
|
|
||||||
"Scrollbar width", CONFIG_DEFAULT },
|
|
||||||
{ xrm_Number, "scroll-method", { .num = &config.scroll_method }, NULL,
|
{ xrm_Number, "scroll-method", { .num = &config.scroll_method }, NULL,
|
||||||
"Scrolling method. (0: Page, 1: Centered)", CONFIG_DEFAULT },
|
"Scrolling method. (0: Page, 1: Centered)", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "fake-background", { .str = &config.fake_background }, NULL,
|
|
||||||
"Background to use for fake transparency. (background or screenshot)", CONFIG_DEFAULT },
|
|
||||||
{ xrm_String, "window-format", { .str = &config.window_format }, NULL,
|
{ xrm_String, "window-format", { .str = &config.window_format }, NULL,
|
||||||
"Window Format. w (desktop name), t (title), n (name), r (role), c (class)", CONFIG_DEFAULT },
|
"Window Format. w (desktop name), t (title), n (name), r (role), c (class)", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "click-to-exit", { .snum = &config.click_to_exit }, NULL,
|
{ xrm_Boolean, "click-to-exit", { .snum = &config.click_to_exit }, NULL,
|
||||||
|
|
Loading…
Reference in New Issue