diff options
-rw-r--r-- | include/swaynag/types.h | 1 | ||||
-rw-r--r-- | swaynag/config.c | 58 | ||||
-rw-r--r-- | swaynag/render.c | 4 | ||||
-rw-r--r-- | swaynag/swaynag.1.scd | 3 | ||||
-rw-r--r-- | swaynag/swaynag.5.scd | 3 | ||||
-rw-r--r-- | swaynag/types.c | 8 |
6 files changed, 50 insertions, 27 deletions
diff --git a/include/swaynag/types.h b/include/swaynag/types.h index 7f8f6221..f7518d95 100644 --- a/include/swaynag/types.h +++ b/include/swaynag/types.h | |||
@@ -9,6 +9,7 @@ struct swaynag_type { | |||
9 | uint32_t anchors; | 9 | uint32_t anchors; |
10 | 10 | ||
11 | // Colors | 11 | // Colors |
12 | uint32_t button_text; | ||
12 | uint32_t button_background; | 13 | uint32_t button_background; |
13 | uint32_t background; | 14 | uint32_t background; |
14 | uint32_t text; | 15 | uint32_t text; |
diff --git a/swaynag/config.c b/swaynag/config.c index d702cc95..3488a74d 100644 --- a/swaynag/config.c +++ b/swaynag/config.c | |||
@@ -39,6 +39,7 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag, | |||
39 | TO_COLOR_BORDER_BOTTOM, | 39 | TO_COLOR_BORDER_BOTTOM, |
40 | TO_COLOR_BUTTON, | 40 | TO_COLOR_BUTTON, |
41 | TO_COLOR_TEXT, | 41 | TO_COLOR_TEXT, |
42 | TO_COLOR_BUTTON_TEXT, | ||
42 | TO_THICK_BAR_BORDER, | 43 | TO_THICK_BAR_BORDER, |
43 | TO_PADDING_MESSAGE, | 44 | TO_PADDING_MESSAGE, |
44 | TO_THICK_DET_BORDER, | 45 | TO_THICK_DET_BORDER, |
@@ -72,6 +73,7 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag, | |||
72 | {"border-bottom", required_argument, NULL, TO_COLOR_BORDER_BOTTOM}, | 73 | {"border-bottom", required_argument, NULL, TO_COLOR_BORDER_BOTTOM}, |
73 | {"button-background", required_argument, NULL, TO_COLOR_BUTTON}, | 74 | {"button-background", required_argument, NULL, TO_COLOR_BUTTON}, |
74 | {"text", required_argument, NULL, TO_COLOR_TEXT}, | 75 | {"text", required_argument, NULL, TO_COLOR_TEXT}, |
76 | {"button-text", required_argument, NULL, TO_COLOR_BUTTON_TEXT}, | ||
75 | {"border-bottom-size", required_argument, NULL, TO_THICK_BAR_BORDER}, | 77 | {"border-bottom-size", required_argument, NULL, TO_THICK_BAR_BORDER}, |
76 | {"message-padding", required_argument, NULL, TO_PADDING_MESSAGE}, | 78 | {"message-padding", required_argument, NULL, TO_PADDING_MESSAGE}, |
77 | {"details-border-size", required_argument, NULL, TO_THICK_DET_BORDER}, | 79 | {"details-border-size", required_argument, NULL, TO_THICK_DET_BORDER}, |
@@ -97,33 +99,34 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag, | |||
97 | "Multiple buttons can be defined.\n" | 99 | "Multiple buttons can be defined.\n" |
98 | " -Z, --button-dismiss-no-terminal <text> <action> Like " | 100 | " -Z, --button-dismiss-no-terminal <text> <action> Like " |
99 | "--button-dismiss, but does not run the action in a terminal.\n" | 101 | "--button-dismiss, but does not run the action in a terminal.\n" |
100 | " -c, --config <path> Path to config file.\n" | 102 | " -c, --config <path> Path to config file.\n" |
101 | " -d, --debug Enable debugging.\n" | 103 | " -d, --debug Enable debugging.\n" |
102 | " -e, --edge top|bottom Set the edge to use.\n" | 104 | " -e, --edge top|bottom Set the edge to use.\n" |
103 | " -f, --font <font> Set the font to use.\n" | 105 | " -f, --font <font> Set the font to use.\n" |
104 | " -h, --help Show help message and quit.\n" | 106 | " -h, --help Show help message and quit.\n" |
105 | " -l, --detailed-message Read a detailed message from stdin.\n" | 107 | " -l, --detailed-message Read a detailed message from stdin.\n" |
106 | " -L, --detailed-button <text> Set the text of the detail button.\n" | 108 | " -L, --detailed-button <text> Set the text of the detail button.\n" |
107 | " -m, --message <msg> Set the message text.\n" | 109 | " -m, --message <msg> Set the message text.\n" |
108 | " -o, --output <output> Set the output to use.\n" | 110 | " -o, --output <output> Set the output to use.\n" |
109 | " -s, --dismiss-button <text> Set the dismiss button text.\n" | 111 | " -s, --dismiss-button <text> Set the dismiss button text.\n" |
110 | " -t, --type <type> Set the message type.\n" | 112 | " -t, --type <type> Set the message type.\n" |
111 | " -v, --version Show the version number and quit.\n" | 113 | " -v, --version Show the version number and quit.\n" |
112 | "\n" | 114 | "\n" |
113 | "The following appearance options can also be given:\n" | 115 | "The following appearance options can also be given:\n" |
114 | " --background RRGGBB[AA] Background color.\n" | 116 | " --background RRGGBB[AA] Background color.\n" |
115 | " --border RRGGBB[AA] Border color.\n" | 117 | " --border RRGGBB[AA] Border color.\n" |
116 | " --border-bottom RRGGBB[AA] Bottom border color.\n" | 118 | " --border-bottom RRGGBB[AA] Bottom border color.\n" |
117 | " --button-background RRGGBB[AA] Button background color.\n" | 119 | " --button-background RRGGBB[AA] Button background color.\n" |
118 | " --text RRGGBB[AA] Text color.\n" | 120 | " --text RRGGBB[AA] Text color.\n" |
119 | " --border-bottom-size size Thickness of the bar border.\n" | 121 | " --button-text RRGGBB[AA] Button text color.\n" |
120 | " --message-padding padding Padding for the message.\n" | 122 | " --border-bottom-size size Thickness of the bar border.\n" |
121 | " --details-border-size size Thickness for the details border.\n" | 123 | " --message-padding padding Padding for the message.\n" |
122 | " --button-border-size size Thickness for the button border.\n" | 124 | " --details-border-size size Thickness for the details border.\n" |
123 | " --button-gap gap Size of the gap between buttons\n" | 125 | " --button-border-size size Thickness for the button border.\n" |
124 | " --button-dismiss-gap gap Size of the gap for dismiss button.\n" | 126 | " --button-gap gap Size of the gap between buttons\n" |
125 | " --button-margin-right margin Margin from dismiss button to edge.\n" | 127 | " --button-dismiss-gap gap Size of the gap for dismiss button.\n" |
126 | " --button-padding padding Padding for the button text.\n"; | 128 | " --button-margin-right margin Margin from dismiss button to edge.\n" |
129 | " --button-padding padding Padding for the button text.\n"; | ||
127 | 130 | ||
128 | optind = 1; | 131 | optind = 1; |
129 | while (1) { | 132 | while (1) { |
@@ -255,6 +258,11 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag, | |||
255 | fprintf(stderr, "Invalid text color: %s", optarg); | 258 | fprintf(stderr, "Invalid text color: %s", optarg); |
256 | } | 259 | } |
257 | break; | 260 | break; |
261 | case TO_COLOR_BUTTON_TEXT: // Button text color | ||
262 | if (type && !parse_color(optarg, &type->button_text)) { | ||
263 | fprintf(stderr, "Invalid button text color: %s", optarg); | ||
264 | } | ||
265 | break; | ||
258 | case TO_THICK_BAR_BORDER: // Bottom border thickness | 266 | case TO_THICK_BAR_BORDER: // Bottom border thickness |
259 | if (type) { | 267 | if (type) { |
260 | type->bar_border_thickness = strtol(optarg, NULL, 0); | 268 | type->bar_border_thickness = strtol(optarg, NULL, 0); |
diff --git a/swaynag/render.c b/swaynag/render.c index f6507e67..4537ec04 100644 --- a/swaynag/render.c +++ b/swaynag/render.c | |||
@@ -47,7 +47,7 @@ static void render_details_scroll_button(cairo_t *cairo, | |||
47 | button->width - (border * 2), button->height - (border * 2)); | 47 | button->width - (border * 2), button->height - (border * 2)); |
48 | cairo_fill(cairo); | 48 | cairo_fill(cairo); |
49 | 49 | ||
50 | cairo_set_source_u32(cairo, swaynag->type->text); | 50 | cairo_set_source_u32(cairo, swaynag->type->button_text); |
51 | cairo_move_to(cairo, button->x + border + padding, | 51 | cairo_move_to(cairo, button->x + border + padding, |
52 | button->y + border + (button->height - text_height) / 2); | 52 | button->y + border + (button->height - text_height) / 2); |
53 | pango_printf(cairo, swaynag->type->font, swaynag->scale, true, | 53 | pango_printf(cairo, swaynag->type->font, swaynag->scale, true, |
@@ -199,7 +199,7 @@ static uint32_t render_button(cairo_t *cairo, struct swaynag *swaynag, | |||
199 | button->width, button->height); | 199 | button->width, button->height); |
200 | cairo_fill(cairo); | 200 | cairo_fill(cairo); |
201 | 201 | ||
202 | cairo_set_source_u32(cairo, swaynag->type->text); | 202 | cairo_set_source_u32(cairo, swaynag->type->button_text); |
203 | cairo_move_to(cairo, button->x + padding, button->y + padding); | 203 | cairo_move_to(cairo, button->x + padding, button->y + padding); |
204 | pango_printf(cairo, swaynag->type->font, swaynag->scale, true, | 204 | pango_printf(cairo, swaynag->type->font, swaynag->scale, true, |
205 | "%s", button->text); | 205 | "%s", button->text); |
diff --git a/swaynag/swaynag.1.scd b/swaynag/swaynag.1.scd index 2ce7f330..61a69909 100644 --- a/swaynag/swaynag.1.scd +++ b/swaynag/swaynag.1.scd | |||
@@ -97,6 +97,9 @@ _swaynag_ [options...] | |||
97 | *--text* <RRGGBB[AA]> | 97 | *--text* <RRGGBB[AA]> |
98 | Set the text color. | 98 | Set the text color. |
99 | 99 | ||
100 | *--button-text* <RRGGBB[AA]> | ||
101 | Set the button text color. | ||
102 | |||
100 | *--border-bottom-size* <size> | 103 | *--border-bottom-size* <size> |
101 | Set the thickness of the bottom border. | 104 | Set the thickness of the bottom border. |
102 | 105 | ||
diff --git a/swaynag/swaynag.5.scd b/swaynag/swaynag.5.scd index d3daadf7..87f21423 100644 --- a/swaynag/swaynag.5.scd +++ b/swaynag/swaynag.5.scd | |||
@@ -42,6 +42,9 @@ colors can be set: | |||
42 | *text=<color>* | 42 | *text=<color>* |
43 | The color of the text. | 43 | The color of the text. |
44 | 44 | ||
45 | *button-text=<color>* | ||
46 | The color of the button text. | ||
47 | |||
45 | The following sizing options can also be set: | 48 | The following sizing options can also be set: |
46 | 49 | ||
47 | *border-bottom-size=<size>* | 50 | *border-bottom-size=<size>* |
diff --git a/swaynag/types.c b/swaynag/types.c index 4caaf6f7..576dcbff 100644 --- a/swaynag/types.c +++ b/swaynag/types.c | |||
@@ -38,6 +38,7 @@ void swaynag_types_add_default(list_t *types) { | |||
38 | type_defaults->button_background = 0x333333FF; | 38 | type_defaults->button_background = 0x333333FF; |
39 | type_defaults->background = 0x323232FF; | 39 | type_defaults->background = 0x323232FF; |
40 | type_defaults->text = 0xFFFFFFFF; | 40 | type_defaults->text = 0xFFFFFFFF; |
41 | type_defaults->button_text = 0xFFFFFFFF; | ||
41 | type_defaults->border = 0x222222FF; | 42 | type_defaults->border = 0x222222FF; |
42 | type_defaults->border_bottom = 0x444444FF; | 43 | type_defaults->border_bottom = 0x444444FF; |
43 | type_defaults->bar_border_thickness = 2; | 44 | type_defaults->bar_border_thickness = 2; |
@@ -54,6 +55,7 @@ void swaynag_types_add_default(list_t *types) { | |||
54 | type_error->button_background = 0x680A0AFF; | 55 | type_error->button_background = 0x680A0AFF; |
55 | type_error->background = 0x900000FF; | 56 | type_error->background = 0x900000FF; |
56 | type_error->text = 0xFFFFFFFF; | 57 | type_error->text = 0xFFFFFFFF; |
58 | type_error->button_text = 0xFFFFFFFF; | ||
57 | type_error->border = 0xD92424FF; | 59 | type_error->border = 0xD92424FF; |
58 | type_error->border_bottom = 0x470909FF; | 60 | type_error->border_bottom = 0x470909FF; |
59 | list_add(types, type_error); | 61 | list_add(types, type_error); |
@@ -62,6 +64,7 @@ void swaynag_types_add_default(list_t *types) { | |||
62 | type_warning->button_background = 0xFFC100FF; | 64 | type_warning->button_background = 0xFFC100FF; |
63 | type_warning->background = 0xFFA800FF; | 65 | type_warning->background = 0xFFA800FF; |
64 | type_warning->text = 0x000000FF; | 66 | type_warning->text = 0x000000FF; |
67 | type_warning->button_text = 0x000000FF; | ||
65 | type_warning->border = 0xAB7100FF; | 68 | type_warning->border = 0xAB7100FF; |
66 | type_warning->border_bottom = 0xAB7100FF; | 69 | type_warning->border_bottom = 0xAB7100FF; |
67 | list_add(types, type_warning); | 70 | list_add(types, type_warning); |
@@ -107,6 +110,11 @@ void swaynag_type_merge(struct swaynag_type *dest, struct swaynag_type *src) { | |||
107 | dest->text = src->text; | 110 | dest->text = src->text; |
108 | } | 111 | } |
109 | 112 | ||
113 | if (src->button_text > 0) { | ||
114 | dest->button_text = src->button_text; | ||
115 | } | ||
116 | |||
117 | |||
110 | if (src->border > 0) { | 118 | if (src->border > 0) { |
111 | dest->border = src->border; | 119 | dest->border = src->border; |
112 | } | 120 | } |