Index: uspace/lib/ui/include/types/ui/paint.h
===================================================================
--- uspace/lib/ui/include/types/ui/paint.h	(revision 5d6213034774b404c59bb28fa4d9b10fcabfca81)
+++ uspace/lib/ui/include/types/ui/paint.h	(revision a1309833fa4662354b3172f95af252de7f78502d)
@@ -94,6 +94,6 @@
 	/** Horizontal alignment */
 	gfx_halign_t halign;
-	/** Justification width (for gfx_halign_justify) */
-	gfx_coord_t justify_width;
+	/** Width available for the text */
+	gfx_coord_t width;
 	/** Vertical alignment */
 	gfx_valign_t valign;
Index: uspace/lib/ui/private/wdecor.h
===================================================================
--- uspace/lib/ui/private/wdecor.h	(revision 5d6213034774b404c59bb28fa4d9b10fcabfca81)
+++ uspace/lib/ui/private/wdecor.h	(revision a1309833fa4662354b3172f95af252de7f78502d)
@@ -80,4 +80,6 @@
 	/** Title bar rectangle */
 	gfx_rect_t title_bar_rect;
+	/** Window caption rectangle */
+	gfx_rect_t caption_rect;
 	/** Maximize button rectangle */
 	gfx_rect_t btn_max_rect;
Index: uspace/lib/ui/src/paint.c
===================================================================
--- uspace/lib/ui/src/paint.c	(revision 5d6213034774b404c59bb28fa4d9b10fcabfca81)
+++ uspace/lib/ui/src/paint.c	(revision a1309833fa4662354b3172f95af252de7f78502d)
@@ -922,5 +922,5 @@
 	tfmt.color = fmt->color;
 	tfmt.halign = fmt->halign;
-	tfmt.justify_width = fmt->justify_width;
+	tfmt.width = fmt->width;
 	tfmt.valign = fmt->valign;
 	tfmt.underline = false;
Index: uspace/lib/ui/src/wdecor.c
===================================================================
--- uspace/lib/ui/src/wdecor.c	(revision 5d6213034774b404c59bb28fa4d9b10fcabfca81)
+++ uspace/lib/ui/src/wdecor.c	(revision a1309833fa4662354b3172f95af252de7f78502d)
@@ -88,4 +88,8 @@
 	/** Window frame width in text mode */
 	wdecor_frame_w_text = 1,
+	/** Window caption horizontal margin */
+	wdecor_cap_hmargin = 4,
+	/** Window caption horizontal margin in text mode */
+	wdecor_cap_hmargin_text = 1,
 	/** Close button cross leg length */
 	wdecor_close_cross_n = 5,
@@ -326,7 +330,10 @@
 		fmt.halign = gfx_halign_center;
 		fmt.valign = gfx_valign_center;
-
-		pos.x = (trect.p0.x + trect.p1.x) / 2;
-		pos.y = (trect.p0.y + trect.p1.y) / 2;
+		fmt.abbreviate = true;
+		fmt.width = geom.caption_rect.p1.x -
+		    geom.caption_rect.p0.x;
+
+		pos.x = (geom.caption_rect.p0.x + geom.caption_rect.p1.x) / 2;
+		pos.y = (geom.caption_rect.p0.y + geom.caption_rect.p1.y) / 2;
 
 		if (wdecor->res->textmode) {
@@ -450,4 +457,5 @@
 	gfx_coord_t btn_x;
 	gfx_coord_t btn_y;
+	gfx_coord_t cap_hmargin;
 
 	/* Does window have a frame? */
@@ -529,4 +537,6 @@
 			geom->btn_max_rect.p1.x = btn_x;
 			geom->btn_max_rect.p1.y = btn_y + 20;
+
+			btn_x -= 20;
 		} else {
 			geom->btn_max_rect.p0.x = btn_x - 3;
@@ -534,4 +544,6 @@
 			geom->btn_max_rect.p1.x = btn_x;
 			geom->btn_max_rect.p1.y = btn_y + 1;
+
+			btn_x -= 3;
 		}
 	} else {
@@ -541,4 +553,15 @@
 		geom->btn_max_rect.p1.y = 0;
 	}
+
+	if (wdecor->res->textmode == false)
+		cap_hmargin = wdecor_cap_hmargin;
+	else
+		cap_hmargin = wdecor_cap_hmargin_text;
+
+	geom->caption_rect.p0.x = geom->title_bar_rect.p0.x +
+	    cap_hmargin;
+	geom->caption_rect.p0.y = geom->title_bar_rect.p0.y;
+	geom->caption_rect.p1.x = btn_x - cap_hmargin;
+	geom->caption_rect.p1.y = geom->title_bar_rect.p1.y;
 }
 
