waybar-clock - Man Page

clock module

Description

clock module displays current date and time.​

There are two implementations:

Files

$XDG_CONFIG_HOME/waybar/config
Per user configuration file

Configuration

1.​ Addressed by clock

OptionTypeofDefaultDescription
intervalinteger60The interval in which the information gets polled
formatstring{:%H:%M}The format, how the date and time should be displayed.​ See format options below.​ Split the braces to insert literal text, e.​g.​ {0:%H}text{0:%M}
timezonestringThe timezone to display the time in, e.​g.​ America/New_York.​ "" represents the system'​s local timezone.​ See Wikipedia'​s unofficial list of timezones <https://en.​wikipedia.​org/wiki/List_of_tz_database_time_zones>
timezoneslist of stringsA list of timezones (as in timezone) to use for time display, changed using the scroll wheel.​ Do not specify timezone option when timezones is specified.​ "" represents the system'​s local timezone
timezone-tooltip-formatstringFormat to use for displaying timezones in the tooltip.​ When set, this allows showing timezone information (like timezone abbreviations) in the tooltip while keeping the main display clean.​ Uses the same format options as format
localestringA locale to be used to display the time.​ Intended to render times in custom timezones with the proper language and format
max-lengthintegerThe maximum length in character the module should display
rotateintegerPositive value to rotate the text label (in 90 degree increments)
on-clickstringCommand to execute when clicked on the module
on-click-middlestringCommand to execute when you middle clicked on the module using mousewheel
on-click-rightstringCommand to execute when you right-click on the module
on-scroll-upstringCommand to execute when scrolling up on the module
on-scroll-downstringCommand to execute when scrolling down on the module
smooth-scrolling-thresholddoubleThreshold to be used when scrolling
tooltipbooltrueOption to enable tooltip on hover
tooltip-formatstringsame as formatTooltip on hover
menustringAction that popups the menu.​
menu-filestringLocation of the menu descriptor file.​ There need to be an element of type GtkMenu with id menu
menu-actionsarrayThe actions corresponding to the buttons of the menu.​
expand:boolfalseEnables this module to consume all left over space dynamically.​

View all valid format options in strftime(3) or have a look https://en.​cppreference.​com/w/cpp/chrono/duration/formatter

2.​ Addressed by clock: calendar

OptionTypeofDefaultDescription
modestringmonthCalendar view mode.​ Possible values: year|month
mode-mon-colinteger1Relevant for mode=year.​ Count of months per row.​ Must be a divisor of 12 (one of 1, 2, 3, 4, 6, 12); an invalid value falls back to 3
weeks-posstringThe position where week numbers should be displayed.​ Disabled when is empty.​ Possible values: left|right
on-scrollinteger1Value to scroll months/years forward/backward.​ Can be negative.​ Is configured under on-scroll option
iso8601boolfalseWhen enabled, the calendar follows the ISO 8601 standard: weeks begin on Monday, and the first week of the year is numbered 1.​ The default week format is '​{:%V}'​.​
weeks-numberingstringOverride the week number calculation method, independent of iso8601 and locale settings.​ Possible values: iso (ISO 8601, {:%V}), monday (Monday-based, {:%W}), sunday (Sunday-based, {:%U}).​ When not set, the method is derived from iso8601 or the locale.​
first-day-of-weekintegerThe first day of the week, where 0 is Sunday and 6 is Saturday.​ When not set, the first day of the week is determined by the locale settings.​

3.​ Addressed by clock: calendar: format

OptionTypeofDefaultDescription
monthsstringFormat is applied to months header(January, February,.​.​.​etc.​)
daysstringFormat is applied to days
weeksstring{:%U}Format is applied to week numbers.​ The {} placeholder is replaced with the format determined by weeks-numbering (if set), otherwise by iso8601 or the locale: '​{:%V}'​ for ISO 8601, '​{:%W}'​ when week starts with Monday, '​{:%U}'​ otherwise
weekdaysstringFormat is applied to weeks header(Su,Mo,.​.​.​etc.​)
todaystring<b><u>{}</u></b>Format is applied to Today

Actions

StringAction
modeSwitch calendar mode between year/month
tz_upSwitch to the next provided time zone
tz_downSwitch to the previously provided time zone
shift_upSwitch to the next calendar month/year
shift_downSwitch to the previous calendar month/year
shift_resetReset the calendar shift back to the current month/year
exec <cmd>Execute the specified command

Format Replacements

Examples

1.​ General

  "clock": {
  	"interval": 60,
  	"format": "{:%H:%M}",
  	"max-length": 25
  }

2.​ Calendar

  "clock": {
  	"format": "{:%H:%M}  ",
  	"format-alt": "{:%A, %B %d, %Y (%R)} 󰃰 ",
  	"tooltip-format": "<tt><small>{calendar}</small></tt>",
  	"calendar": {
  		"mode"             : "year",
  		"mode-mon-col"     : 3,
  		"weeks-pos"        : "right",
  		"first-day-of-week": 1,
  		"on-scroll"        : 1,
  		"on-click-right"   : "mode",
  		"format": {
  			"months":     "<span color=​'#ffead3​'><b>{}</b></span>",
  			"days":       "<span color=​'#ecc6d9​'><b>{}</b></span>",
  			"weeks":      "<span color=​'#99ffdd​'><b>W{}</b></span>",
  			"weekdays":   "<span color=​'#ffcc66​'><b>{}</b></span>",
  			"today":      "<span color=​'#ff6699​'><b><u>{}</u></b></span>"
  		}
  	},
  	"actions": {
  		"on-click-right": "mode",
  		"on-click-forward": "tz_up",
  		"on-click-backward": "tz_down",
  		"on-scroll-up": "shift_up",
  		"on-scroll-down": "shift_down"
  	}
  },

3.​ Full date on hover

  "clock": {
  	"interval": 60,
  	"tooltip": true,
  	"format": "{:%H​.%M}",
  	"tooltip-format": "{:%Y-%m-%d}",
  }

4.​ Show timezone in tooltip only

  "clock": {
  	"interval": 60,
  	"format": "{:%H:%M}",
  	"timezone-tooltip-format": "{:%H:%M %Z}",
  	"timezones": [
  		"",
  		"America/Chicago",
  		"America/Los_Angeles",
  		"Europe/Paris",
  		"UTC"
  	],
  	"tooltip": true,
  	"tooltip-format": "{tz_list}"
  }

5.​ Simple calendar tooltip

  "clock": {
  "format": "{:%H:%M}",
  "tooltip-format": "<tt>{calendar}</tt>",
  "calendar": {
  "format": {
  "today": "<span color=​'#ffcc66​'><b>{}</b></span>"
  }
  }
  }

Style

If displaying seconds causes other modules to shift side to side, the cause is usually proportional-width digits.​ If your font supports it, add font-feature-settings: "tnum"; to the #clock style (or wherever you set the bar font) to use fixed-width numbers.​

The following classes are used only inside the {calendar} tooltip.​ Their foreground color is read and applied to the corresponding calendar cells in the tooltip markup:

Troubleshooting

If clock module is disabled at startup with locale::facet::_S_create_c_locale
name not valid error message try one of the following:

When using clock instead of simpleclock, the locale defaults to C regardless of the locale settings.​ To override this, prepend L to the format string, e.​g.​ {:%a %m %d} becomes {:L%a %m %d}.​

The locale option must be set for {calendar} to use the correct start-of-week, regardless of system locale.​

Calendar in Chinese. Alignment

In order to have aligned Chinese calendar there are some useful recommendations:

  1. Use "WenQuanYi Zen Hei Mono" which is provided in most Linux distributions
  2. Try different font sizes and find best for you.​ size = 9pt should be fine
  3. In case when "WenQuanYi Zen Hei Mono" font is used disable monospace font pango tag

Example of working config

  "clock": {
  	"format": "{:%H:%M}  ",
  	"format-alt": "{:%A, %B %d, %Y (%R)} 󰃰 ",
  	"tooltip-format": "n<span size=​'9pt​' font=​'WenQuanYi Zen Hei Mono​'>{calendar}</span>",
  	"calendar": {
  		"mode"          : "year",
  		"mode-mon-col"  : 3,
  		"weeks-pos"     : "right",
  		"on-scroll"     : 1,
  		"on-click-right": "mode",
  		"format": {
  			"months":     "<span color=​'#ffead3​'><b>{}</b></span>",
  			"days":       "<span color=​'#ecc6d9​'><b>{}</b></span>",
  			"weeks":      "<span color=​'#99ffdd​'><b>W{}</b></span>",
  			"weekdays":   "<span color=​'#ffcc66​'><b>{}</b></span>",
  			"today":      "<span color=​'#ff6699​'><b><u>{}</u></b></span>"
  		}
  	},
  	"actions": {
  		"on-click-right": "mode",
  		"on-click-forward": "tz_up",
  		"on-click-backward": "tz_down",
  		"on-scroll-up": "shift_up",
  		"on-scroll-down": "shift_down"
  	}
  },

Author

Alexis Rouillard <contact@arouillard.​fr>

Info

2026-11-05 User Manual