You Got A Question? Ask    GNOME Community!


How to create a lightweight custom GNOME Shell fork ;)

This post was made with an older stylesheet

{Title should better be: How to create a Custom Shell Mode In GNOME 3.8}

The goal is to create a new GNOME Session with our very own preferences similar to GNOME Classic. For this demonstration I named it in contrast with Classic, GNOME Modern.

gdm-modern

Many people got upset with GNOME 3 and the removal of many features that were available in GNOME 2. If you want my opinion, there is a misunderstanding here and GNOME will add more and more new features in the upcoming versions.

The work that Design Team does is really really awesome but the implementation goes a bit slow, so either you can help or wait, but no need to blame. And by blame I don’t mean not criticizing (criticizing is a feedback contributing), but these @#$%^&* comments.

In any case, this is how I vision the GNOME Modern ;)

shell-modern

GNOME Modern is even featureless ;)


Why

Imagine that you are responsible to set up 100 PC into a school but you are not satisfied with GNOME Shell. You need to change things or add some others.  In short you need a customized desktop. Except the usual stuffs like setting files/directories permissions and users in the network, GNOME Shell gives you the possibility to adjust the desktop to your exact preferences, through extensions.

What you can do, is to ask someone to create some extensions for you (not for free!) and a customized GNOME session for the students. This is exactly how Web Development Economy works. For example you set up a ready eShop platform and then you ask a programmer to create some custom plugins. I guess you get the the point.


Some Notes

This guide is basically a lightweight forking (or overriding) of Classic Mode (but you can also override the default mode) and I am not extent to some more cool things I discovered and you can do. Not because I am lazy, but I just don’t want to say something stupid and lead you to a broken system. However you need to remember the changes you will do, so you can revert them –just in case.

Another thing you should know is that when you will add extensions in this custom mode (or in classic), you can’t disable them –even if you think you can through Tweak Tool or extensions.gnome.org/local. When  Shell has issues the first thing you should do is to disable extensions –or even themes. In this case you are in your own.

Finally this guide is made in Fedora 19 with GNOME 3.8 (but should be okay in all distros with GNOME 3.8) and it will take less than 10 mins to try it. So don’t skip it, is cool :)


Let’s go!

1. Create a new Shell mode

I assume you all have GNOME 3.8 and Classic Mode installed. Check your available modes.

$ gnome-shell --list-modes
gdm
initial-setup
user
classic

To create a new mode open

/usr/share/gnome-shell/modes

Copy the classic.json to modern.json

$ sudo cp classic.json modern.json
{
    "parentMode": "user",
    "stylesheetName": "gnome-classic.css",
    "overridesSchema": "org.gnome.shell.extensions.classic-overrides",
    "enabledExtensions": ["apps-menu@gnome-shell-extensions.gcampax.github.com","places-menu@gnome-shell-extensions.gcampax.github.com","alternate-tab@gnome-shell-extensions.gcampax.github.com","launch-new-instance@gnome-shell-extensions.gcampax.github.com","window-list@gnome-shell-extensions.gcampax.github.com"],
    "panel": { "left": ["activities", "appMenu"],
               "center": [],
               "right": ["a11y", "keyboard", "volume", "bluetooth",
                         "network", "battery", "dateMenu", "userMenu"]
             }
}

This is the description file of the mode. It is quite explanatory, so make the changes you want and save it. You can add extensions that will be always loaded in this session. Remember to delete the backup files “~” because the Shell still reads them and bugs.

List again the modes

$ gnome-shell --list-modes
gdm
initial-setup
user
modern
classic

Modern should be visible here. You can use it right away, experimental and add or remove things.

$ gnome-shell --mode=modern -r

This should load your custom session, so we are pretty much done. We only need to add this to GDM and make the trigger to a .desktop file.


2. Create a XSession .desktop file

Open

/usr/share/xsessions

Copy gnome-classic.desktop to gnome-modern.desktop

$ sudo cp gnome-classic.desktop gnome-modern.desktop

Edit the name in your language (ie English)

[Desktop Entry]
Name=GNOME Modern
Name[ar]=جنوم تقليدية
Name[cs]=GNOME klasik
...

Change the session

...
Comment[sr@latin]=Ova sesija vas prijavljuje u klasičan Gnom
Exec=gnome-session --session gnome-modern
TryExec=gnome-session
Icon=
Type=Application

3. Create a GNOME Session file

Open

/usr/share/gnome-session/sessions

Copy gnome-classic.session to gnome-modern.session

$ sudo cp gnome-classic.session gnome-modern.session

Edit the name in your language

[GNOME Session]
Name=GNOME Modern
Name[ar]=جنوم تقليدية
Name[cs]=GNOME klasik
...

Edit the required Components

...
Name[sr]=Класичан Гном
Name[sr@latin]=Klasičan Gnom
RequiredComponents=gnome-shell-modern;gnome-settings-daemon;
IsRunnableHelper=/usr/libexec/gnome-session-check-accelerated

4. Create an Application Desktop File

This is actually the trigger to the modern mode
Open

/usr/share/applications

Copy gnome-shell-classic.desktop to gnome-shell-modern.desktop

$ sudo cp gnome-shell-classic.desktop gnome-shell-modern.desktop

Change the name

[Desktop Entry]
Type=Application
Name=GNOME Shell Modern
Name[ar]=صدفة جنوم تقليدية
Name[cs]=GNOME Shell klasik
...

Edit the trigger to modern mode

...
Comment[sr]=Управљање прозорима и покретање програма
Comment[sr@latin]=Upravljanje prozorima i pokretanje programa
Exec=/usr/bin/gnome-shell --mode=modern
TryExec=/usr/bin/gnome-shell
X-GNOME-Bugzilla-Bugzilla=GNOME
...

5. Done \o/

Logout from GNOME and login again to your new mode!

That was really really fast. In the process you are doing it you are going to discover many more cool things, so I reckon to try it. Besides it is awesome to know how stuffs work and while this thing seems simple, you are actually lightweight forking your desktop.. so simple, so GNOME ;)


Override Shell Functionality

If you read this blog, from times to times I have made some posts how you can change things in GNOME Shell like pressure sensitivity responsiveness or adding custom menus in Shell Background Menu, or in the last post how to change the effects when entering/exiting Overview.

That was in practice un-usable because in every update of Shell you were going to lose your changes. The reason I was writing these short guides is just to demonstrate the coolness of Shell.

Today I made an extension like a blank extension that will help you to override many many core functionality of Shell and most importantly to show you how you can add your very own override functions. I just need to clean up the code and documented (add comments) and I will upload it.

Using such an extension together with a custom mode is a lightweight GNOME Shell fork ;)


What you can do next?

Improve this guide, package your own GNOME Shell Mode together with the extensions and the theme you want, write an installation script (just extracting files) and let us download your personal GNOME Shell mode without damaging the original..

..or without messing with the other installed extensions. Which is huge problem in the extension system of Shell –extensions conflict with other extensions (ie two alt+tab extensions both enabled).


 
  We can't watch comments unless G+ provides an API or if you send a notification, e.g +World Of Gnome
     Sometimes is better to place your questions on GNOME Community
  • Craig

    This isn’t forking at all. It’s reconfiguring.

    • alex285

      Technically is not forking, you are right. But when override functions of a core component (ie Shell) even in run time sometimes we call them forks.

      I used to name _FORK_ when I override an object. I think it is usual practice in programming. I guess I have copied this technique from somewhere.

      • Craig

        “sometimes we call them forks”

        No we don’t. A fork is a distinct point where a codebase diverges (possibly later merged, possibly not). This is just using the same code with slightly modified configuration. The point of configuration is to allow controlled divergence — that is it’s very purpose.

        Most bastardisation of language comes from it’s misuse by the uninformed. This is such a case.

      • Craig

        Also, overriding of objects or functions is monkey patching or overloading. I fail to see how that has any bearing whatsoever on editing a few config files.

        • alex285

          This is why I called it “lightweight fork”, is a sentence that means something different from fork. Anyway, thank you for the info!

          • Damo Critic

            If it’s not a fork, how can it be lightweight?

          • alex285

            Please consider it a wrong sentence/word. Craig, you and anyone else is right, this is not a fork ;)

          • Damo Critic

            Ok, good. Couldnt tell whether you still thought it was fron previous responses. Thanks, regardless, ill work through some of this tomorrow.

  • vanous

    Thanks for the howto. However, when my gnome-session –session gnome-modern is executed, it complants, that gnome-modern session was not found, even when it clearly exists (i defined all – xsession, .session, .desktop), then fallbacks to non customized gnome-shell. So when test defining xsession .session and putting “gnome-session –session gnome-classic”, i get the same error. it seems that gnome-classic is hardcoded somewhere :(

    any idea?

    • alex285

      inside xsession files are .desktop not session?

      • vanous

        Yes correct. That is what i have and no luck :(

        • alex285

          hmm don’t know what could be wrong. You just need to hack 4 files.. I think you have done a typo or something, check again?
          Further you can check on
          man gnome-session

  • Oliver

    Hi and thanks for the great how to.

    One little thing:

    I guess in 4 it should not be:

    “sudo cp gnome-shell-classic.desktop gnome-shell-classic.desktop”
    but
    “sudo cp gnome-shell-classic.desktop gnome-shell-modern.desktop”

    or?

    Cheers

    Oliver

    • alex285

      Sure, was a typo, thank you!

  • coolboy

    Very cool! Modern is not good name though. It is the opposite om classic so some might cofuse it for the standard shell. How about “Simple”?

    Thinking about fullscreen steam I consider it to be a seperate session.
    It has it own management. Game picker, downloader, social interaction
    and so on.

    What I really want to see happening is a session called “steam”. A total rip down created just to open steam in full screen mode, unredirected and so on. Doing this can provide an optimized play-mode. Anyone like that idea?

  • Fewt

    This is not a fork. It’s also not something that your grandmother would do. Great job keeping the platform difficult enough to scare new users away. We shouldn’t expect anyone to edit text, and json files or drop to the shell to configure their desktops – it isn’t 1990 anymore.

    • Damo Critic

      In the absence of any other way to do itk this is what needs to be done. Thats why I dont give my Grandmother Gnome Shell. These are instructions for people who want to do what is described and made clear. If you dont wajt to go through it, there is a desktop, os and blog for you somewhere. This poor guy didnt create gnome shell, and is just working with other people who want to.

      You wouldnt go onto a barbecue to tell everyone they shouldnt be eating meat, would you?

      Linux and open source deliberately blur the division between users and creators. If you do not want to be in such an environment, buy a bloody, ac and go flame about how Linux sucks on a Mac forum. Or better, join the Windows community, if there is such a thing.