Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9a62fed33d |
@ -599,6 +599,27 @@ void load_settings(char *cmdline_config_path)
|
|||||||
"Always run rule-defined scripts, even if the notification is suppressed with format = \"\"."
|
"Always run rule-defined scripts, even if the notification is suppressed with format = \"\"."
|
||||||
);
|
);
|
||||||
|
|
||||||
|
{
|
||||||
|
char *c = option_get_string(
|
||||||
|
"global",
|
||||||
|
"centering", "-centering", "off",
|
||||||
|
"Align notifications on screen off/horizontal/vertical/both"
|
||||||
|
);
|
||||||
|
|
||||||
|
if (strcmp(c, "off") == 0)
|
||||||
|
settings.centering = CENTERING_OFF;
|
||||||
|
else if (strcmp(c, "horizontal") == 0)
|
||||||
|
settings.centering = CENTERING_HORIZONTAL;
|
||||||
|
else if (strcmp(c, "vertical") == 0)
|
||||||
|
settings.centering = CENTERING_VERTICAL;
|
||||||
|
else if (strcmp(c, "both") == 0)
|
||||||
|
settings.centering = CENTERING_BOTH;
|
||||||
|
else
|
||||||
|
fprintf(stderr,
|
||||||
|
"Warning: unknown centering option: %s\n", c);
|
||||||
|
g_free(c);
|
||||||
|
}
|
||||||
|
|
||||||
/* push hardcoded default rules into rules list */
|
/* push hardcoded default rules into rules list */
|
||||||
for (int i = 0; i < G_N_ELEMENTS(default_rules); i++) {
|
for (int i = 0; i < G_N_ELEMENTS(default_rules); i++) {
|
||||||
rules = g_slist_insert(rules, &(default_rules[i]), -1);
|
rules = g_slist_insert(rules, &(default_rules[i]), -1);
|
||||||
|
@ -12,6 +12,7 @@ enum icon_position_t { icons_left, icons_right, icons_off };
|
|||||||
enum separator_color { FOREGROUND, AUTO, FRAME, CUSTOM };
|
enum separator_color { FOREGROUND, AUTO, FRAME, CUSTOM };
|
||||||
enum follow_mode { FOLLOW_NONE, FOLLOW_MOUSE, FOLLOW_KEYBOARD };
|
enum follow_mode { FOLLOW_NONE, FOLLOW_MOUSE, FOLLOW_KEYBOARD };
|
||||||
enum markup_mode { MARKUP_NULL, MARKUP_NO, MARKUP_STRIP, MARKUP_FULL };
|
enum markup_mode { MARKUP_NULL, MARKUP_NO, MARKUP_STRIP, MARKUP_FULL };
|
||||||
|
enum centering { CENTERING_OFF, CENTERING_HORIZONTAL, CENTERING_VERTICAL, CENTERING_BOTH };
|
||||||
|
|
||||||
typedef struct _settings {
|
typedef struct _settings {
|
||||||
bool print_notifications;
|
bool print_notifications;
|
||||||
@ -34,6 +35,7 @@ typedef struct _settings {
|
|||||||
char *icons[3];
|
char *icons[3];
|
||||||
unsigned int transparency;
|
unsigned int transparency;
|
||||||
char *geom;
|
char *geom;
|
||||||
|
enum centering centering;
|
||||||
char *title;
|
char *title;
|
||||||
char *class;
|
char *class;
|
||||||
int shrink;
|
int shrink;
|
||||||
|
@ -724,6 +724,14 @@ static void x_win_move(int width, int height)
|
|||||||
y = scr->dim.y + xctx.geometry.y;
|
y = scr->dim.y + xctx.geometry.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (settings.centering == CENTERING_HORIZONTAL || settings.centering == CENTERING_BOTH) {
|
||||||
|
x = scr->dim.x + (scr->dim.w - width) / 2 + xctx.geometry.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.centering == CENTERING_VERTICAL || settings.centering == CENTERING_BOTH) {
|
||||||
|
y = scr->dim.y + (scr->dim.h - height) / 2 + xctx.geometry.y;
|
||||||
|
}
|
||||||
|
|
||||||
/* move and resize */
|
/* move and resize */
|
||||||
if (x != xctx.window_dim.x || y != xctx.window_dim.y) {
|
if (x != xctx.window_dim.x || y != xctx.window_dim.y) {
|
||||||
XMoveWindow(xctx.dpy, xctx.win, x, y);
|
XMoveWindow(xctx.dpy, xctx.win, x, y);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user