Show week numbers in the Gnome DateTime Indicator

The date/time indicator in the Gnome3 panel does not show week numbers by default.

To change this run this command:

gsettings set com.canonical.indicator.datetime show-week-numbers true

At least in Elementary OS I found not GUI way of changing this.

Switching back to Gnome3

Last July last year I switched from Gnome3 to KDE, you can read that post here

At first I was fine with running KDE, but lately I have been a bit unhappy with the look of KDE, been trying out a lot of themes but didn't find any that I really liked. Since many websites are lacking support for dark desktop themes I went back to the default Oxygen theme, but a gray theme is a bit boring.

However since there seems to be a upswing for Qt I wanted to use a Qt-based desktop, I was hoping for projects like LXQt and I tried the 0.7.0 release but I felt it had the same issue with the themes as KDE. There is also the Hawaii desktop environment that run on Wayland, but I havn't tried it that since it lacks drivers for Virtualbox.

I did a quick test of Elementary OS, which I found was very good looking, but it lacked way to much configurability. But it made me actually like the of a Mac-like dock instead of the traditional task panel. And when searching for available docks most of them are for Gnome GTK, however there are some for KDE like the Fancy tasks and Daisy Docks but I found both of them to be either buggy or not behaving the way I want.

So I decided to give Gnome 3 another try. So now I am running Gnome 3.8.4 (the current Gnome release on Debian Testing) and Docky. Here is a screenshot:

Gnome3 Screenshot

So far I am very pleased, feels much more modern then KDE. I do however notice how much features they have removed from the old Gnome 2 days. No transparent background in the terminal? who decided that. The file manager has also been striped from some options like how to handle preview of images on remote shares, but I can however live with these changes since it looks so good.

Last time I used Gnome I used a lot of extensions to make Gnome usable which was one of the reason for my switch to KDE, but this time around the only extension that I have added is the alternative Alt-tab extension since I find the default alt-tab behaviour counter productive.

Debugging and fixing the Gnome-Shell extension TaskBar

When I switched between virtual desktops in Gnome-Shell I noticed that the TaskBar extension I used disappeared. I had to restart Gnome-Shell to make it work again, and then it crashed again when I switched desktop.

When trying to disable and enable the extension I got and red error instead

Taskbar Error

Now come the funny part of debugging why it causes an error. To debug extensions you use Gnome-Shell's integrated debugging tool called Looking Glass. To open Looking Glass press ALT + F2, then type lg, and press enter. To exit Looking Glass press ESC.

In the top right corner of Looking Glass there is an Extensions tab, which shows information about the extensions installed on your computer.

This guide is for Gnome-Shell 3.4 which I'm running on my laptop, it seems as the error output has been moved in Gnome-Shell 3.6 to ~/.cache/gdm/session.log or ~/.xsession_errors.

At the last line of each extension is a line that says if the extensions is Enabled or Disabled, there is also a "Show Errors" button, press this to check if the extension has returned any errors. For me I got this error:

TypeError: Main.panel._appMenu is null

This means that the extension is trying to use the _appMenu variable, but it can't since either Main, panel or _appMenu does not have a value. Null special value using in programming to symbolize no value.

So now I knew more about where the extension failed, now I just had to fix it.

The user installed extensions is located in ~/.local/share/gnome-shell/extensions. So I went to that directory and ran a command to search the files to se where the _appMenu variable was used:

cd ~/.local/share/gnome-shell/extensions/TaskBar@zpydr
find . | xargs grep -niP Main.panel._appMenu

This returned:

grep: .: Is a directory
grep: ./images: Is a directory
./extension.js:458: this.appMenuActor = Main.panel._appMenu.actor;
./extension.js:467: Main.panel._appMenu.actor.hide();
grep: ./schemas: Is a directory

I was lucky, the variable is only used in two places, in the file extension.js on line 458 and 467. I open up the file and analyze the code:

this.appMenuActor = Main.panel._appMenu.actor;
if (this.settings.get_boolean("hide-default-application-menu"))
{
   let variant = GLib.Variant.new('a{sv}', { 'Gtk/ShellShowsAppMenu': GLib.Variant.new('i', 0) });
   let xsettings = new Gio.Settings({ schema: 'org.gnome.settings-daemon.plugins.xsettings' });
   xsettings.set_value('overrides', variant);
   this.appMenuActor.hide();
   this.hidingId = Main.overview.connect('hiding', function ()
   {
      Main.panel._appMenu.actor.hide();
   });
}

Here the variable Main.panel._appMenu.actor is used but since the variable is null it will fail. To make this code more robust I add a if statement around this block of code so it will not be executed if the variable is null, this is how now looks like:

if (Main.panel._appMenu != null)
{
   this.appMenuActor = Main.panel._appMenu.actor;
   if (this.settings.get_boolean("hide-default-application-menu"))
   {
      let variant = GLib.Variant.new('a{sv}', { 'Gtk/ShellShowsAppMenu': GLib.Variant.new('i', 0) });
      let xsettings = new Gio.Settings({ schema: 'org.gnome.settings-daemon.plugins.xsettings' });
      xsettings.set_value('overrides', variant);
      this.appMenuActor.hide();
      this.hidingId = Main.overview.connect('hiding', function ()
      {
         Main.panel._appMenu.actor.hide();
      });
   }
}

Save the file and then restart Gnome-Shell. If the extension still failed repeat the process in order to fix other errors.