Index: uspace/app/taskbar/clock.c
===================================================================
--- uspace/app/taskbar/clock.c	(revision 50a16d9442247a3cb031c563acb875d37309385e)
+++ uspace/app/taskbar/clock.c	(revision 50a16d9442247a3cb031c563acb875d37309385e)
@@ -0,0 +1,303 @@
+/*
+ * Copyright (c) 2022 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup taskbar
+ * @{
+ */
+/** @file Task bar clock.
+ *
+ * Displays the current time in an inset frame.
+ */
+
+#include <errno.h>
+#include <gfx/render.h>
+#include <gfx/text.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <task.h>
+#include <ui/control.h>
+#include <ui/paint.h>
+#include <ui/resource.h>
+#include "clock.h"
+
+static void taskbar_clock_ctl_destroy(void *);
+static errno_t taskbar_clock_ctl_paint(void *);
+static ui_evclaim_t taskbar_clock_ctl_kbd_event(void *, kbd_event_t *);
+static ui_evclaim_t taskbar_clock_ctl_pos_event(void *, pos_event_t *);
+static void taskbar_clock_timer(void *);
+
+/** Task bar clock control ops */
+static ui_control_ops_t taskbar_clock_ctl_ops = {
+	.destroy = taskbar_clock_ctl_destroy,
+	.paint = taskbar_clock_ctl_paint,
+	.kbd_event = taskbar_clock_ctl_kbd_event,
+	.pos_event = taskbar_clock_ctl_pos_event
+};
+
+/** Create task bar clock.
+ *
+ * @param window Containing window
+ * @param rclock Place to store pointer to new clock
+ * @return EOK on success or an error code
+ */
+errno_t taskbar_clock_create(ui_window_t *window, taskbar_clock_t **rclock)
+{
+	taskbar_clock_t *clock;
+	errno_t rc;
+
+	clock = calloc(1, sizeof(taskbar_clock_t));
+	if (clock == NULL)
+		return ENOMEM;
+
+	rc = ui_control_new(&taskbar_clock_ctl_ops, (void *)clock,
+	    &clock->control);
+	if (rc != EOK) {
+		free(clock);
+		return rc;
+	}
+
+	clock->timer = fibril_timer_create(NULL);
+	if (clock->timer == NULL) {
+		rc = ENOMEM;
+		goto error;
+	}
+
+	fibril_timer_set(clock->timer, 1000000, taskbar_clock_timer, clock);
+
+	clock->window = window;
+	*rclock = clock;
+	return EOK;
+error:
+	ui_control_delete(clock->control);
+	free(clock);
+	return rc;
+}
+
+/** Destroy task bar clock.
+ *
+ * @param clock Task bar clock
+ */
+void taskbar_clock_destroy(taskbar_clock_t *clock)
+{
+	fibril_timer_destroy(clock->timer);
+	ui_control_delete(clock->control);
+	free(clock);
+}
+
+static errno_t taskbar_clock_get_text(taskbar_clock_t *clock, char *buf,
+    size_t bsize)
+{
+	struct timespec ts;
+	struct tm tm;
+	errno_t rc;
+
+	getrealtime(&ts);
+	rc = time_utc2tm(ts.tv_sec, &tm);
+	if (rc != EOK)
+		return rc;
+
+	snprintf(buf, bsize, "%02d:%02d:%02d", tm.tm_hour, tm.tm_min,
+	    tm.tm_sec);
+	return EOK;
+}
+
+/** Paint task bar clock.
+ *
+ * @param clock Task bar clock
+ */
+errno_t taskbar_clock_paint(taskbar_clock_t *clock)
+{
+	gfx_context_t *gc = ui_window_get_gc(clock->window);
+	ui_resource_t *res = ui_window_get_res(clock->window);
+	char buf[10];
+	gfx_text_fmt_t fmt;
+	gfx_coord2_t pos;
+	gfx_rect_t irect;
+	errno_t rc;
+
+	/* Fill background */
+
+	rc = ui_paint_inset_frame(res, &clock->rect, &irect);
+	if (rc != EOK)
+		goto error;
+
+	rc = gfx_set_color(gc, ui_resource_get_wnd_face_color(res));
+	if (rc != EOK)
+		goto error;
+
+	rc = gfx_fill_rect(gc, &irect);
+	if (rc != EOK)
+		goto error;
+
+	pos.x = (irect.p0.x + irect.p1.x) / 2;
+	pos.y = (irect.p0.y + irect.p1.y) / 2;
+
+	gfx_text_fmt_init(&fmt);
+	fmt.font = ui_resource_get_font(res);
+	fmt.color = ui_resource_get_wnd_text_color(res);
+	fmt.halign = gfx_halign_center;
+	fmt.valign = gfx_valign_center;
+
+	rc = taskbar_clock_get_text(clock, buf, sizeof(buf));
+	if (rc != EOK)
+		goto error;
+
+	rc = gfx_puttext(&pos, &fmt, buf);
+	if (rc != EOK)
+		goto error;
+
+	rc = gfx_update(gc);
+	if (rc != EOK)
+		goto error;
+
+	return EOK;
+error:
+	return rc;
+}
+
+/** Handle task bar clock keyboard event.
+ *
+ * @param clock Task bar clock
+ * @param event Keyboard event
+ * @return ui_claimed iff event was claimed
+ */
+ui_evclaim_t taskbar_clock_kbd_event(taskbar_clock_t *clock, kbd_event_t *event)
+{
+	return ui_unclaimed;
+}
+
+/** Handle task bar clock position event.
+ *
+ * @param clock Task bar clock
+ * @param event Position event
+ * @return ui_claimed iff event was claimed
+ */
+ui_evclaim_t taskbar_clock_pos_event(taskbar_clock_t *clock, pos_event_t *event)
+{
+	gfx_coord2_t pos;
+
+	pos.x = event->hpos;
+	pos.y = event->vpos;
+	if (!gfx_pix_inside_rect(&pos, &clock->rect))
+		return ui_unclaimed;
+
+	return ui_claimed;
+}
+
+/** Get base control for task bar clock.
+ *
+ * @param clock Task bar clock
+ * @return Base UI control
+ */
+ui_control_t *taskbar_clock_ctl(taskbar_clock_t *clock)
+{
+	return clock->control;
+}
+
+/** Set task bar clock rectangle.
+ *
+ * @param clock Task bar clock
+ * @param rect Rectangle
+ */
+void taskbar_clock_set_rect(taskbar_clock_t *clock, gfx_rect_t *rect)
+{
+	gfx_rect_t irect;
+
+	clock->rect = *rect;
+
+	irect.p0.x = clock->rect.p0.x + 1;
+	irect.p0.y = clock->rect.p0.y + 1;
+	irect.p1.x = clock->rect.p1.x;
+	irect.p1.y = clock->rect.p1.y - 1;
+
+	(void)irect;
+}
+
+/** Destroy clock control.
+ *
+ * @param arg Argument (taskbar_clock_t *)
+ */
+void taskbar_clock_ctl_destroy(void *arg)
+{
+	taskbar_clock_t *clock = (taskbar_clock_t *) arg;
+
+	taskbar_clock_destroy(clock);
+}
+
+/** Paint task bar clock control.
+ *
+ * @param arg Argument (taskbar_clock_t *)
+ * @return EOK on success or an error code
+ */
+errno_t taskbar_clock_ctl_paint(void *arg)
+{
+	taskbar_clock_t *clock = (taskbar_clock_t *) arg;
+
+	return taskbar_clock_paint(clock);
+}
+
+/** Handle task bar clock control keyboard event.
+ *
+ * @param arg Argument (taskbar_clock_t *)
+ * @param kbd_event Keyboard event
+ * @return @c ui_claimed iff the event is claimed
+ */
+ui_evclaim_t taskbar_clock_ctl_kbd_event(void *arg, kbd_event_t *event)
+{
+	taskbar_clock_t *clock = (taskbar_clock_t *) arg;
+
+	return taskbar_clock_kbd_event(clock, event);
+}
+
+/** Handle task bar clock control position event.
+ *
+ * @param arg Argument (taskbar_clock_t *)
+ * @param pos_event Position event
+ * @return @c ui_claimed iff the event is claimed
+ */
+ui_evclaim_t taskbar_clock_ctl_pos_event(void *arg, pos_event_t *event)
+{
+	taskbar_clock_t *clock = (taskbar_clock_t *) arg;
+
+	return taskbar_clock_pos_event(clock, event);
+}
+
+/** Taskbar clock timer handler.
+ *
+ * @param arg Argument (taskbar_clock_t *)
+ */
+static void taskbar_clock_timer(void *arg)
+{
+	taskbar_clock_t *clock = (taskbar_clock_t *) arg;
+
+	(void) taskbar_clock_paint(clock);
+	fibril_timer_set(clock->timer, 1000000, taskbar_clock_timer, clock);
+}
+
+/** @}
+ */
Index: uspace/app/taskbar/clock.h
===================================================================
--- uspace/app/taskbar/clock.h	(revision 50a16d9442247a3cb031c563acb875d37309385e)
+++ uspace/app/taskbar/clock.h	(revision 50a16d9442247a3cb031c563acb875d37309385e)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2022 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup taskbar
+ * @{
+ */
+/**
+ * @file Task bar clock
+ */
+
+#ifndef CLOCK_H
+#define CLOCK_H
+
+#include <errno.h>
+#include <gfx/coord.h>
+#include <io/kbd_event.h>
+#include <io/pos_event.h>
+#include <ui/control.h>
+#include <ui/window.h>
+#include <stdbool.h>
+#include "types/clock.h"
+
+extern errno_t taskbar_clock_create(ui_window_t *, taskbar_clock_t **);
+extern void taskbar_clock_destroy(taskbar_clock_t *);
+extern errno_t taskbar_clock_paint(taskbar_clock_t *);
+extern ui_evclaim_t taskbar_clock_kbd_event(taskbar_clock_t *, kbd_event_t *);
+extern ui_evclaim_t taskbar_clock_pos_event(taskbar_clock_t *, pos_event_t *);
+extern ui_control_t *taskbar_clock_ctl(taskbar_clock_t *);
+extern void taskbar_clock_set_rect(taskbar_clock_t *, gfx_rect_t *);
+
+#endif
+
+/** @}
+ */
Index: uspace/app/taskbar/meson.build
===================================================================
--- uspace/app/taskbar/meson.build	(revision 213967620de013869b03cdfa9034fd6bd726045a)
+++ uspace/app/taskbar/meson.build	(revision 50a16d9442247a3cb031c563acb875d37309385e)
@@ -29,4 +29,5 @@
 deps = [ 'ui' ]
 src = files(
+	'clock.c',
 	'main.c',
 	'taskbar.c',
Index: uspace/app/taskbar/taskbar.c
===================================================================
--- uspace/app/taskbar/taskbar.c	(revision 213967620de013869b03cdfa9034fd6bd726045a)
+++ uspace/app/taskbar/taskbar.c	(revision 50a16d9442247a3cb031c563acb875d37309385e)
@@ -42,4 +42,5 @@
 #include <ui/ui.h>
 #include <ui/window.h>
+#include "clock.h"
 #include "taskbar.h"
 
@@ -96,6 +97,7 @@
 		params.rect.p0.x = 0;
 		params.rect.p0.y = 0;
-		params.rect.p1.x = 24;
-		params.rect.p1.y = 5;
+		params.rect.p1.x = 80;
+		params.rect.p1.y = 1;
+		params.style &= ~ui_wds_frame;
 	} else {
 		params.rect.p0.x = 0;
@@ -138,4 +140,21 @@
 	}
 
+	rc = taskbar_clock_create(taskbar->window, &taskbar->clock);
+	if (rc != EOK)
+		goto error;
+
+	rect.p0.x = 1024 - 80;
+	rect.p0.y = 4;
+	rect.p1.x = 1024 - 4;
+	rect.p1.y = 32 - 4;
+	taskbar_clock_set_rect(taskbar->clock, &rect);
+
+	rc = ui_fixed_add(taskbar->fixed, taskbar_clock_ctl(taskbar->clock));
+	if (rc != EOK) {
+		printf("Error adding control to layout.\n");
+		taskbar_clock_destroy(taskbar->clock);
+		goto error;
+	}
+
 	ui_window_add(taskbar->window, ui_fixed_ctl(taskbar->fixed));
 
@@ -149,4 +168,6 @@
 	return EOK;
 error:
+	if (taskbar->clock != NULL)
+		taskbar_clock_destroy(taskbar->clock);
 	if (taskbar->window != NULL)
 		ui_window_destroy(taskbar->window);
@@ -160,4 +181,5 @@
 void taskbar_destroy(taskbar_t *taskbar)
 {
+	taskbar_clock_destroy(taskbar->clock);
 	ui_window_destroy(taskbar->window);
 	ui_destroy(taskbar->ui);
Index: uspace/app/taskbar/types/clock.h
===================================================================
--- uspace/app/taskbar/types/clock.h	(revision 50a16d9442247a3cb031c563acb875d37309385e)
+++ uspace/app/taskbar/types/clock.h	(revision 50a16d9442247a3cb031c563acb875d37309385e)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2022 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup taskbar
+ * @{
+ */
+/**
+ * @file Task bar clock
+ */
+
+#ifndef TYPES_CLOCK_H
+#define TYPES_CLOCK_H
+
+#include <fibril_synch.h>
+#include <gfx/coord.h>
+#include <ui/window.h>
+
+/** Task bar clock
+ *
+ * This is a custom UI control.
+ */
+typedef struct taskbar_clock {
+	/** Base control object */
+	struct ui_control *control;
+
+	/** Containing window */
+	ui_window_t *window;
+
+	/** Clock rectangle */
+	gfx_rect_t rect;
+
+	/** Clock update timer */
+	fibril_timer_t *timer;
+} taskbar_clock_t;
+
+#endif
+
+/** @}
+ */
Index: uspace/app/taskbar/types/taskbar.h
===================================================================
--- uspace/app/taskbar/types/taskbar.h	(revision 213967620de013869b03cdfa9034fd6bd726045a)
+++ uspace/app/taskbar/types/taskbar.h	(revision 50a16d9442247a3cb031c563acb875d37309385e)
@@ -41,4 +41,5 @@
 #include <ui/ui.h>
 #include <ui/window.h>
+#include "clock.h"
 
 /** Task bar */
@@ -51,4 +52,6 @@
 	ui_fixed_t *fixed;
 	ui_label_t *label;
+	/** Clock */
+	taskbar_clock_t *clock;
 } taskbar_t;
 
Index: uspace/lib/ui/include/ui/resource.h
===================================================================
--- uspace/lib/ui/include/ui/resource.h	(revision 213967620de013869b03cdfa9034fd6bd726045a)
+++ uspace/lib/ui/include/ui/resource.h	(revision 50a16d9442247a3cb031c563acb875d37309385e)
@@ -38,4 +38,5 @@
 
 #include <errno.h>
+#include <gfx/color.h>
 #include <gfx/context.h>
 #include <gfx/font.h>
@@ -49,4 +50,6 @@
 extern void ui_resource_expose(ui_resource_t *);
 extern gfx_font_t *ui_resource_get_font(ui_resource_t *);
+extern gfx_color_t *ui_resource_get_wnd_face_color(ui_resource_t *);
+extern gfx_color_t *ui_resource_get_wnd_text_color(ui_resource_t *);
 
 #endif
Index: uspace/lib/ui/src/resource.c
===================================================================
--- uspace/lib/ui/src/resource.c	(revision 213967620de013869b03cdfa9034fd6bd726045a)
+++ uspace/lib/ui/src/resource.c	(revision 50a16d9442247a3cb031c563acb875d37309385e)
@@ -677,4 +677,24 @@
 }
 
+/** Get the UI window face color.
+ *
+ * @param resource UI resource
+ * @return UI window face color
+ */
+gfx_color_t *ui_resource_get_wnd_face_color(ui_resource_t *resource)
+{
+	return resource->wnd_face_color;
+}
+
+/** Get the UI window text color.
+ *
+ * @param resource UI resource
+ * @return UI window text color
+ */
+gfx_color_t *ui_resource_get_wnd_text_color(ui_resource_t *resource)
+{
+	return resource->wnd_text_color;
+}
+
 /** @}
  */
