「GNOME」- Top Bar

修改 Topbar 字体 | 调整默认主题 | 顶部栏字体

How can I change the font of the top bar without changing the shell theme? – Ask Ubuntu
Enable ‘Shell theme’ in Gnome Tweak Tool in Ubuntu | UbuntuHandbook
How to change the font in GNOME’s top bar | ModMy
18.04 – How do I change font size on top bar? – Ask Ubuntu
Raising a Question and Changing the Top Bar Font. : gnome
data/theme/gnome-shell.scss · master · GNOME / gnome-shell · GitLab

在 GNOME 3 中,在进行字体设置时,我们发现 Topbar 的字体没有修改,因此窗口字体与 Topbar 字体不同。经过搜索,我们知道,Topbar 的字体是主题负责修改的,无法通过设置(gnome-control-center)进行修改。

该笔记将记录:在 GNOME 3 中,如何修改 Topbar 的字体格式,同时也提供一种调整默认的主题的思路。

我们需要自定义 Topbar 主题,按照如下步骤进行操作:

操作步骤

第一步、安装 User Themes by fmuellner 扩展,并启用。这样才能够加载用户自定义主题。同时,这也解决 GNOME Tweaks / Appearance / Shell 的 “Shell user-theme extension not enabled” 问题;

第二步、自定义主题。这里,我们仅需设置 Topbar 主题:

mkdir -pv ~/.local/share/themes/ours/gnome-shell/

cat > ~/.local/share/themes/ours/gnome-shell/gnome-shell.css <<EOF
stage {
    font-family: "Courier 10 Pitch", Sans-Serif;
    font-size: 11pt;
}
EOF

第三步、选择我们自定义主题:GNOME Tweaks / Appearance / Shell / Ours(目录名首字母大写即为主题名)。此时,将看到 Topbar 已经显示为我们设置的字体;

补充说明

该笔记是后期整理记录的,在我们的印象中,似乎不用重启。但是,如果主题没有加载,则

  • 尝试重新打开 GNOME Tweaks 应用(如果先前已经打开过,毕竟需要重新载入变更)
  • 或者 Alt+F2 再输入 r 重新加载桌面;

调整默认主题

通过 GNOME Shell Customization 我们能够自定义原有主题,我们可以通过这种方法对 GNOME Shell 主题进行覆盖;

替代方案(Fontconfig)

还有一种替代方案,使用 Fontconfig 设置字体。在桌面环境下,字体是通过 Fontconfig 库进行加载的,因此我们可以从 Fontconfig 层面,对字体进行“修改”。这里的“修改”是指,配置 fonts.conf 配置文件;

通过配置 Fontconfig 对部分字体进行“重命名”或者设置备用字体,比如将 monospace 指向 Courier 10 Pitch 字体;

该方案可能更加通用,因为 Topbar 的字体设置只是众多问题中的一个,很可能改天又会有个 BottomBar 修改字体。而通过 Fontconfig 我们可以从整体上修改所有的字体为我们喜欢的字体;

相关内容,参考 Fontconfig – fonts.conf 手册,这里不再展开该部分内容;

修改日期格式

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)

该笔记将记录:在 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 该扩展能够解决我们的问题,桌面 GNOME Shell 42.9 版本。

参考 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'"
# 注意:双引号内的单引号是必须的

# 23/09/09 13:54:29
dconf write /org/gnome/shell/extensions/panel-date-format/format "'%y/%m/%d %H:%M:%S %a'"

应用

颜色 | 透明度

15.10 – How to change GNOME top panel colour and transparency levels? – Ask Ubuntu

高度 | 减小高度

Compact Top Bar ⇒ # 2025-10-08 for GNOME Shell 48.0

间隔 | 图标 | 减小状态栏图标间隔

Reduce space between icons · Issue #78 · ubuntu/gnome-shell-extension-appindicator · GitHub

Status Area Horizontal Spacing ⇒ # 2025-10-08 for GNOME Shell 48.0

顺序 | 图标 | 调整图标的显示顺序

Lilypad, Order-Icons, Liled, …

Top Bar Organizer | by June

10/18/2025 … TypeError: appIndicator is undefined …
https://gitlab.gnome.org/june/top-bar-organizer/-/issues/15

Order Gnome Shell extensions | by wa4557

Lilypad Top Bar Manager | by shendrew

2025-10-17 现在,我们正在使用该插件,其能够解决我们的问题。