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/";
|
||||
|
||||
|
@ -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");
|
||||
|
@ -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