如何从 gnome-shell 的面板中删除时钟?

Lau*_*nas 6 panel gnome clock

如何从 gnome-shell 的顶部面板中删除时钟? 在此处输入图片说明

小智 8

可以通过创建扩展来实现。

mkdir -p ~/.local/share/gnome-shell/extensions/Disable_Clock@ocelot
cd  ~/.local/share/gnome-shell/extensions/Disable_Clock@ocelot
Run Code Online (Sandbox Code Playgroud)

制作一个 metadata.json 文件。

gedit metadata.json
Run Code Online (Sandbox Code Playgroud)

剪切以下代码,粘贴到编辑器中,然后保存。

{"shell-version": ["3.2"], "uuid": "Disable_Clock@ocelot", "name": "Disable Clock", "description": "Disable Clock from the top of panel"}
Run Code Online (Sandbox Code Playgroud)

制作一个 extension.js 文件。

gedit extension.js
Run Code Online (Sandbox Code Playgroud)

剪切以下代码,粘贴到编辑器中,然后保存。

const St = imports.gi.St;
const Main = imports.ui.main;

function init(meta) {
}

function enable() {
    Main.panel._centerBox.remove_actor(Main.panel._dateMenu.actor);
}

function disable() {
    Main.panel._centerBox.add_actor(Main.panel._dateMenu.actor);
}
Run Code Online (Sandbox Code Playgroud)

重新启动 gnome-shell 并通过 gnome-tweak-tool 打开“禁用时钟”扩展