Technology Blog

How to display clock with date in vertical XFCE panel

0

XFCE4 is my desktop environment of choice in every Linux distro I use these days. However my display resolution of 1366 x 768 on the laptop is quite low by today's standards, so I set the panel (the taskbar) to the left edge of the screen. I wanted to have a clock with date in my vertical panel. Although it looks impossible, I found out a workaround.
First of all, your clock needs to be configured properly for the vertical panel. I described how it can be done in the following article:

Get horizontal clock orientation in vertical panel in XFCE4

Here is how the clock looks in the stock configuration: XFCE4 stock clock

If you right click it, you'll find the Properties context menu item which opens the following window: XFCE4 clock applet properties

The Format dropdown list has a custom format option: XFCE4 clock custom format

Let's use it to create a clock that also shows the date on the next row.

  1. Set the Format option of the clock applet to "Custom Format": XFCE4 clock custom format
  2. In the text box below, enter the following
    %H:%M%n%d.%m

    XFCE4 clock custom format entered Here is what it means:
    %H – hour (00..23)
    %M – minute (00..59)
    %n – new line character
    %d – day of month (01..31)
    %m – month (01..12)

    For other format markup options, visit this page.

  3. Close the properties dialog. You are done: XFCE4 vertical lock applet with date

Using this simple trick, you will be able to adjust the format of the panel's clock applet and make it show the clock in any format you like. You are only limited by the width of the panel that you have set.

That's it.