「GNOME 3」- 修改日期格式(Topbar)

  CREATED BY JENKINSBOT

问题描述

该笔记将记录:在 GNOME 3 中,如何修改 Topbar 时间格式,以及常见问题的处理方法。

方案一、System Settings

通过 System Settings 设置,但是系统提供的设置比较简单,无法进行日期格式自定义。

方案二、通过安装插件

使用 Datetime Format by Dan-K 扩展

Datetime Format by Dan-K

# 02/10/2021 我们无法使用该扩展,在 GNOME Shell 3.30.2 中,点击插件的设置将产生错误。

使用 Panel Date Format by KEIII 扩展

Panel Date Format by KEIII

# 02/10/2021 该扩展能够解决我们的问题。参考 g_date_time_format() 手册,获取设置日期格式的方法。

我们使用 %a, %d %b %Y %H:%M:%S %z 格式,这与命令 date –rfc-email 的输出格式相同:

dconf write /org/gnome/shell/extensions/panel-date-format/format "'%a, %d %b %Y %H:%M:%S %z'"
# 注意双引号内的单引号是必须的

参考文献

How to change the Gnome panel time format? – Unix & Linux Stack Exchange
gnome3 – Is there a way to adjust the formatting of the date/time in the GNOME 3 login screen and desktop?
Options for date (GNU Coreutils)