Ubuntu – How to remove clock from panel in gnome-shell

clockgnomepanel

How to remove clock from the top panel in gnome-shell?
enter image description here

Best Answer

  • It is possible by creating an extension.

    mkdir -p ~/.local/share/gnome-shell/extensions/Disable_Clock@ocelot
    cd  ~/.local/share/gnome-shell/extensions/Disable_Clock@ocelot
    

    Make a metadata.json file.

    gedit metadata.json
    

    Cut following code, and Paste into the editor ,and Save.

    {"shell-version": ["3.2"], "uuid": "Disable_Clock@ocelot", "name": "Disable Clock", "description": "Disable Clock from the top of panel"}
    

    Make an extension.js file.

    gedit extension.js
    

    Cut following code, and Paste into the editor ,and Save.

    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);
    }
    

    Restart gnome-shell and Turn on "Disable Clock" extension by gnome-tweak-tool