Add configuration option for icon scaling
The maximum size for icons can now be set with the max_icon_size option. Setting its value to 0 will disable the scaling of icons.
This commit is contained in:
parent
342a23548f
commit
ce8fe45cbf
@ -56,6 +56,8 @@ char *dmenu = "/usr/bin/dmenu";
|
||||
|
||||
char *browser = "/usr/bin/firefox";
|
||||
|
||||
int max_icon_size = 32;
|
||||
|
||||
/* paths to default icons */
|
||||
char *icon_folders = "/usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/";
|
||||
|
||||
|
10
settings.c
10
settings.c
@ -179,8 +179,8 @@ void load_settings(char *cmdline_config_path)
|
||||
"Max amount of notifications kept in history");
|
||||
settings.show_indicators =
|
||||
option_get_bool("global", "show_indicators", "-show_indicators",
|
||||
show_indicators,
|
||||
"Show indicators for actions \"(A)\" and URLs \"(U)\"");
|
||||
show_indicators,
|
||||
"Show indicators for actions \"(A)\" and URLs \"(U)\"");
|
||||
settings.separator_height =
|
||||
option_get_int("global", "separator_height",
|
||||
"-sep_height/-separator_height", separator_height,
|
||||
@ -249,6 +249,10 @@ void load_settings(char *cmdline_config_path)
|
||||
}
|
||||
}
|
||||
|
||||
settings.max_icon_size =
|
||||
option_get_int("global", "max_icon_size", "-max_icon_size", max_icon_size,
|
||||
"Scale larger icons down to this size, set to 0 to disable");
|
||||
|
||||
settings.icon_folders =
|
||||
option_get_string("global", "icon_folders", "-icon_folders", icon_folders,
|
||||
"paths to default icons");
|
||||
@ -372,7 +376,7 @@ void load_settings(char *cmdline_config_path)
|
||||
r->bg = ini_get_string(cur_section, "background", r->bg);
|
||||
r->format = ini_get_string(cur_section, "format", r->format);
|
||||
r->new_icon = ini_get_string(cur_section, "new_icon", r->new_icon);
|
||||
r->script = ini_get_string(cur_section, "script", NULL);
|
||||
r->script = ini_get_string(cur_section, "script", NULL);
|
||||
}
|
||||
|
||||
#ifndef STATIC_CONFIG
|
||||
|
@ -29,7 +29,7 @@ typedef struct _settings {
|
||||
float bounce_freq;
|
||||
int sticky_history;
|
||||
int history_length;
|
||||
int show_indicators;
|
||||
int show_indicators;
|
||||
int verbosity;
|
||||
int word_wrap;
|
||||
int ignore_newline;
|
||||
@ -49,6 +49,7 @@ typedef struct _settings {
|
||||
char **dmenu_cmd;
|
||||
char *browser;
|
||||
enum icon_position_t icon_position;
|
||||
int max_icon_size;
|
||||
char *icon_folders;
|
||||
enum follow_mode f_mode;
|
||||
bool always_run_script;
|
||||
|
9
x.c
9
x.c
@ -404,15 +404,16 @@ static colored_layout *r_init_shared(cairo_t *c, notification *n)
|
||||
int w = gdk_pixbuf_get_width(pixbuf);
|
||||
int h = gdk_pixbuf_get_height(pixbuf);
|
||||
int larger = w > h ? w : h;
|
||||
int max_size = 24;
|
||||
if (larger > max_size) {
|
||||
if (settings.max_icon_size && larger > settings.max_icon_size) {
|
||||
if (w >= h) {
|
||||
pixbuf = gdk_pixbuf_scale_simple(pixbuf,
|
||||
max_size, (int) ((double) max_size / w * h),
|
||||
settings.max_icon_size,
|
||||
(int) ((double) settings.max_icon_size / w * h),
|
||||
GDK_INTERP_BILINEAR);
|
||||
} else {
|
||||
pixbuf = gdk_pixbuf_scale_simple(pixbuf,
|
||||
(int) ((double) max_size / h * w), max_size,
|
||||
(int) ((double) settings.max_icon_size / h * w),
|
||||
settings.max_icon_size,
|
||||
GDK_INTERP_BILINEAR);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user