diff --git a/dunst.c b/dunst.c index 5f36d0d..ff578a5 100644 --- a/dunst.c +++ b/dunst.c @@ -559,7 +559,11 @@ void draw_win(void) width = 0; } else if (geometry.mask & WidthValue) { /* fixed width */ - width = geometry.w; + if (geometry.negative_width) { + width = scr.dim.w - geometry.w; + } else { + width = geometry.w; + } } else { /* across the screen */ width = scr.dim.w; @@ -1559,10 +1563,18 @@ int main(int argc, char *argv[]) init_shortcut(&history_ks); + if (geom[0] == '-') { + geometry.negative_width = True; + geom++; + } else { + geometry.negative_width = False; + } + geometry.mask = XParseGeometry(geom, &geometry.x, &geometry.y, &geometry.w, &geometry.h); + screensaver_info = XScreenSaverAllocInfo(); initdbus(); diff --git a/dunst.h b/dunst.h index 270e598..8caeb54 100644 --- a/dunst.h +++ b/dunst.h @@ -23,6 +23,7 @@ typedef struct _dimension_t { unsigned int h; unsigned int w; int mask; + int negative_width; } dimension_t; typedef struct _screen_info { diff --git a/dunstrc b/dunstrc index 9955fe2..3ef3e82 100644 --- a/dunstrc +++ b/dunstrc @@ -43,6 +43,8 @@ # the window expands to the longest message displayed. # A positive x is measured from the left, a negative from the # right side of the screen. Y is measured from the top and down respectevly. + # The width can be negative. In this case the actual width is the + # screen width minus the width defined in within the geometry option. geometry = "0x3-30+20" # The transparency of the window. range: [0; 100]