horizontal padding
This commit is contained in:
parent
67b54e2ace
commit
f054dab8be
@ -26,6 +26,7 @@ int line_height = 0; /* if line height < font height, it will be raised to fon
|
|||||||
|
|
||||||
int separator_height = 2; /* height of the separator line between two notifications */
|
int separator_height = 2; /* height of the separator line between two notifications */
|
||||||
int padding = 0;
|
int padding = 0;
|
||||||
|
int h_padding = 0; /* horizontal padding */
|
||||||
enum separator_color sep_color = AUTO; /* AUTO or FOREGROUND */
|
enum separator_color sep_color = AUTO; /* AUTO or FOREGROUND */
|
||||||
|
|
||||||
int frame_width = 0;
|
int frame_width = 0;
|
||||||
|
17
dunst.c
17
dunst.c
@ -630,11 +630,11 @@ int calculate_x_offset(int line_width, int text_width)
|
|||||||
}
|
}
|
||||||
switch (align) {
|
switch (align) {
|
||||||
case left:
|
case left:
|
||||||
return frame_width;
|
return frame_width + h_padding;
|
||||||
case center:
|
case center:
|
||||||
return frame_width + (leftover / 2);
|
return frame_width + h_padding + (leftover / 2);
|
||||||
case right:
|
case right:
|
||||||
return frame_width + leftover;
|
return frame_width + h_padding + leftover;
|
||||||
default:
|
default:
|
||||||
/* this can't happen */
|
/* this can't happen */
|
||||||
return 0;
|
return 0;
|
||||||
@ -783,7 +783,7 @@ void draw_win(void)
|
|||||||
if (outer_width == 0)
|
if (outer_width == 0)
|
||||||
width = 0;
|
width = 0;
|
||||||
else
|
else
|
||||||
width = outer_width - (2 * frame_width);
|
width = outer_width - (2 * frame_width) - (2 * h_padding);
|
||||||
|
|
||||||
|
|
||||||
fill_line_cache(width);
|
fill_line_cache(width);
|
||||||
@ -795,7 +795,7 @@ void draw_win(void)
|
|||||||
char *line = line_cache.lines[i].str;
|
char *line = line_cache.lines[i].str;
|
||||||
width = MAX(width, textw(dc, line));
|
width = MAX(width, textw(dc, line));
|
||||||
}
|
}
|
||||||
outer_width = width + (2 * frame_width);
|
outer_width = width + (2 * frame_width) + (2 * h_padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* resize dc to correct width */
|
/* resize dc to correct width */
|
||||||
@ -834,7 +834,7 @@ void draw_win(void)
|
|||||||
pad += line.is_begin ? padding : 0;
|
pad += line.is_begin ? padding : 0;
|
||||||
pad += line.is_end ? padding : 0;
|
pad += line.is_end ? padding : 0;
|
||||||
|
|
||||||
drawrect(dc, 0, 0, width, pad + line_height, true, line.colors->BG);
|
drawrect(dc, 0, 0, width + (2*h_padding), pad + line_height, true, line.colors->BG);
|
||||||
|
|
||||||
/* draw text */
|
/* draw text */
|
||||||
dc->x = calculate_x_offset(width, textw(dc, line.str));
|
dc->x = calculate_x_offset(width, textw(dc, line.str));
|
||||||
@ -855,7 +855,7 @@ void draw_win(void)
|
|||||||
color = calculate_foreground_color(line.colors->BG);
|
color = calculate_foreground_color(line.colors->BG);
|
||||||
else
|
else
|
||||||
color = line.colors->FG;
|
color = line.colors->FG;
|
||||||
drawrect(dc, 0, 0, width, separator_height, true, color);
|
drawrect(dc, 0, 0, width + (2*h_padding), separator_height, true, color);
|
||||||
dc->y += separator_height;
|
dc->y += separator_height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1659,6 +1659,9 @@ void load_options(char *cmdline_config_path)
|
|||||||
padding =
|
padding =
|
||||||
option_get_int("global", "padding", "-padding", padding,
|
option_get_int("global", "padding", "-padding", padding,
|
||||||
"Padding between text and separator");
|
"Padding between text and separator");
|
||||||
|
h_padding =
|
||||||
|
option_get_int("global", "horizontal_padding", "-horizontal_padding",
|
||||||
|
h_padding, "horizontal padding");
|
||||||
transparency =
|
transparency =
|
||||||
option_get_int("global", "transparency", "-transparency",
|
option_get_int("global", "transparency", "-transparency",
|
||||||
transparency, "Transparency. range 0-100");
|
transparency, "Transparency. range 0-100");
|
||||||
|
3
dunstrc
3
dunstrc
@ -87,6 +87,9 @@
|
|||||||
# padding between text and separator
|
# padding between text and separator
|
||||||
padding = 3
|
padding = 3
|
||||||
|
|
||||||
|
# horizontal padding
|
||||||
|
horizontal_padding = 10
|
||||||
|
|
||||||
# Define a color for the separator.
|
# Define a color for the separator.
|
||||||
# This can either be "auto" or "foreground". "Auto" tries to find a color
|
# This can either be "auto" or "foreground". "Auto" tries to find a color
|
||||||
# that fits nicely to the background color.
|
# that fits nicely to the background color.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user