Saturday, July 4. 2015
Customizing gnome 3.16
Another quick entry to document step by step how to change the aspect of the recently upgraded gnome 3.16 in debian (testing). As you know I had several issues upgrading gnome 3 in the past (specially gnome-shell). It seems that now this desktop is more mature and with 3.16 the packages upgraded successfully. But, as I think you also know, I have a thing about customizing the colors of my gnome (I want just a little change, instead of the blue foreground color I prefer a beautiful red). Every time I do this it is different and I spent more time. I do not know if gnome guys are crazy or I am simply more stupid than before. Today's entry is going to summary the process to change css of gnome-shell and gtk./p>
gnome-shell
About gnome-shell I found some information in the following arch linux forum. The steps to change the color are the following:
Create this script inside the /tmp/lala.sh file (the script just decompresses the gresource file with the resources of the default Adwaita theme inside /tmp/lala directory).
#! /bin/sh #change workdir to suit your system workdir=/tmp/lala gst=/usr/share/gnome-shell/gnome-shell-theme.gresource mkdir theme for r in `gresource list $gst`; do gresource extract $gst $r >$workdir${r/#\/org\/gnome\/shell/} done
Create the directory and execute the script to obtain the files:
mkdir /tmp/lala bash -x /tmp/lala.sh cd /tmp/lala/theme
I have a custom background for login and lock-screen. I added it to the working directory:
cp ~/images/login-background.jpg .
I Changed the lockDialogGroup (file gnome-shell.css) to include that background image (this step is the same than in version 3.8 as I commented in the previous entry):
#lockDialogGroup { background: #2e3436 url(resource:///org/gnome/shell/theme/login-background.jpg); background-repeat: no-repeat; }
Finally I modified some colors to use red instead of blue. I replaced the following words in the same gnome-shell.css file: "215d9c" to "f43030"; "256ab1" to "bd3232"; and "rgba(33, 93, 156," to "rgba(155, 33, 33,").
At this point the resource bundle should be re-created. In order to do that an xml file with the resource files is needed. I created a gnome-shell-theme.gresource.xml file with all the files contained by the working directory:
for i in *; do echo " <file>$i</file>"; done >gnome-shell-theme.gresource.xml
Just append to the generated file these lines at the beginning:
<?xml version="1.0" encoding="UTF-8"?> <gresources> <gresource prefix="/org/gnome/shell/theme">
And complete the XLM with these closing lines at the end:
</gresource> </gresources>
The resulting file is a well-formed gresources definition file.
Finally with the just created XML file the resources are packaged inside a new bundle:
glib-compile-resources gnome-shell-theme.gresource.xml
And now you can swap the system gresource file (I created a backup of the original file and a backup of my new bundle, just in case of an upgrade). You need root access to do this:
cd /usr/share/gnome-shell cp gnome-shell-theme.gresource gnome-shell-theme.gresource.ORIG cp /tmp/lala/theme/gnome-shell-theme.gresource gnome-shell-theme.gresource cp gnome-shell-theme.gresource gnome-shell-theme.gresource.RICKY
Restart the gnome-shell (Alt+F2 and then type "r" in the box) and try your new gnome-shell colors.
GTK
GTK themes are changed a lot in gnome 3.16. I was unable to find where the hell the real gtk.css is (if you try to find the previous one, /usr/share/themes/Adwaita/gtk-3.0/gtk.css, you will see that it is almost empty with a beautiful "this file is not used"). I suppose that now the css is compiled somewhere but I do not know where. A second difference is that now GTK uses a sass (Syntactically Awesome Stylesheets) preprocessor (although I almost got crazy at that time, now I think it is a fantastic idea, because now you can change basic colors and all the crazy css files are regenerated easily).
After some hours trying to find a way to create the css file using a red color, the following steps worked for me:
Install as root ruby and use gem to install a sass implementation using the gem utility. The gem command is a package manager for ruby itself (the final command is placed in /usr/local). I followed this quick article.
apt-get install ruby-full gem install sass
Clone the git repository for gtk+ (in order to get the Adwaita theme for GTK).
cd ~ git clone git://git.gnome.org/gtk+
The subdirectory gtk/gtk+/theme/Adwaita contains the css files for Adwaita.
Create the new theme AdwaitaRed as I did in the previous entry (copying the default Adwaita and changing the name).
cd ~/.themes mkdir AdwaitaRed cd AdwaitaRed cp -r /usr/share/themes/Adwaita/* . sed "s/Adwaita/AdwaitaRed/g" index.theme > index2.theme mv index2.theme index.theme
Move to the gtk-3.0 folder and copy the gtk resources from the cloned repository in step 2:
cd gtk-3.0 cp -r ~/gtk+/gtk/theme/Adwaita/* .
Modify the _colors.scss file with the changes you need. In my case changing blue to red color ("4a90d9" to "f43030") and default dark color for text to grey (I usually have dark desktop backgrounds and I hate not seeing the file names in my desktop).
Run sass to recreate the css files with your new colors:
sass --update --sourcemap=none .
Finally modify the gtk.css to point to the local files instead of the gresource bundle:
@import url("gtk-contained.css");
The same with gtk-dark.css:
@import url("gtk-contained-dark.css");
Use gnome-tweak-tool to select AdwaitaRed as the GTK+ theme.
Here I present some samples of my desktop (it is almost the same than the one presented in the previous gnome entry).
This entry explains the procedure to change gnome-shell and gtk themes (my change is almost nothing, I just want to change the blue color that by default is used for selected items for a red color). As several times in this blog the entry is mainly to remember what I did. But I am not sure about it, next time everything can be again absolutely different and this information will be useless (came on gnome guys, take it easy please).
Every time I upgrade gnome I think why I am still using it.
Saturday, November 23. 2013
Upgrading gnome to version 3.8.4
As I commented several times in the blog I have a thing upgrading all my debian boxes. My confidence in this distribution is quite big and problems are rare, even in the case of the testing branch (the one I use). Nevertheless it is a good habit checking the packages that are going to be upgraded (just look over the names). For example mayor version upgrades for the X server or its modules, icedove, gnome core packages or kernel could affect your working productivity, and it is recommended to upgrade them when you have time to fix possible problems. But the summary is that, now, I have only one package that makes my legs shake every time I see its name in the list of packages to upgrade: gnome-shell.
The past Wednesday I run an apt-get update and upgrade and I saw that gnome-shell 3.8 had come to testing (mayor version change, from 3.4 to 3.8 ). I was working and obviously upgrading was risky so I canceled it. But the same day, in the afternoon, I had two or three hours free and I decided to go for it (it was about 5pm but I wanted to jog a bit later). The change from gnome2 to gnome3 had been complicated (see this post I wrote above gnome-shell-extensions at that time) and the transition to current 3.4 version made me again change some extensions. But, you know, it is suppose that now gnome3 is more mature and things should be smoother. That was not the case with my laptop.
During the upgrade the desktop crashed and I upgraded blindly (mental note, gnome-shell should be upgraded using the console -Ctrl+Alt+F1-). After the reboot GDM3 did not start. The horrible message "Oh No! Something has gone wrong" appeared and it was impossible to login. Checking logs (dmesg, /var/log/gdm3,..) was useless, I saw nothing relevant there. After some time I see this bug that was similar but in theory it was fixed in my current version. Nevertheless it gave me the idea to install lightdm (another desktop manager) and, finally, I could enter to a graphical session in my laptop.
To my surprise my gnome-shell desktop was setup by default (all my customizations gone, I suppose that my problem with GDM and all the things I tried to fix the issue forced this situation). So I used gnome-tweak-tool to select the same themes and extensions I had before. But again more surprises, the default dock in gnome-shell-extensions have been removed in 3.7.x, the weather extension I had did not work, and my GTK3 theme and gnome-shell theme had issues (the desktop background did not work, notifications were garbled,...). So nice! Good upgrade! I forgot about jogging, having a comfortable desktop again was going to be long.
The main things I did were the following:
The common dock has disappeared so I installed another one. I chose the dash to dock extension which is in the gnome extensions web and worked without problem.
The weather extension of Neroth did not work. Neither installing it from the extensions page nor compiling it. But I realized that debian guys had added it to the repository. So it was, at the end, easily installed:
apt-get install gnome-shell-extension-weather
Themes were another story. My gtk3 theme had problems and all the others I tried were more or less the same. Finally I decided to just use the default but changing the default blue color for a red one. It could not be so difficult.
I did the following steps:
Create a new theme directory in the local themes directory for gnome2. My theme will be named AdwaitaRed:
$ cd ~/.themes $ mkdir AdwaitaRed $ cd AdwaitaRed
Copy the default files in the Adwaita gnome theme and rename the theme to the new name:
$ cp -r /usr/share/themes/Adwaita/** . $ sed -e "s/Adwaita/AdwaitaRed/g" index.theme > index.theme2 $ mv index.theme2 index.theme
At this moment you can select the new theme with gnome-tweak-tool but it is exactly the same than default Adwaita (but with a different name).
Follow the instructions from tactical vim to uncompress the gresource file (it seems that the default theme instead of using plain files uses an archived one). I copied the script that the site recommends changing some paths:
$ cat ~/extract.sh #!/bin/bash GR_FILE="/home/ricky/.themes/AdwaitaRed/gtk-3.0/gtk.gresource" GR_BASEDIR="/org/gnome/adwaita/" mkdir /home/ricky/.themes/AdwaitaRed/gtk-3.0/files cd /home/ricky/.themes/AdwaitaRed/gtk-3.0/files || exit for RSRC in $(gresource list $GR_FILE); do RSRC_FILE=$(echo "${RSRC#$GR_BASEDIR}") mkdir -p $(dirname "$RSRC_FILE") ||: gresource extract "$GR_FILE" "$RSRC" > "$RSRC_FILE" done
And executing it the resources were placed in the files directory. After that I deleted the gresource original file.
$ ~/extract.sh $ rm gtk.gresource
Now the references in gtk.css and gtk-dark.css (in gtk-3.0 directory) were changed to link to the dearchived files.
$ cat gtk.css @import url("files/gtk-main.css"); $ cat gtk-dark.css @import url("files/gtk-main-dark.css");
Then I changed the gtk-main.css file and all the colors that were blue (a fucking lot of them) were changed to #f43030. Here you can improve the solution, cos there are a lot of different blues (lighter and darker ones), I just changed all of them for the same red color.
Now if you select AdwaitaRed in the gnome-tweak-tool you have the default Adwaita theme but with red instead of blue (you now, the selections, borders, progress bars and so on).
Finally I tried to fix the problem with the gnome-shell theme. I tested the Holo Red and my previous Adwaita X Red but both gave me problems (mainly notifications). So I finally mixed the Adwaita X Red and the default theme.
Copy the default theme in the new custom theme:
$ cd ~/.themes/AdwaitaRed/ $ mkdir gnome-shell $ cp /usr/share/gnome-shell/theme/** gnome-shell
Copy the Adwaita X Red upon default files:
$ cp ~/.themes/Adwaita\ X\ Red/gnome-shell/** gnome-shell
Then I mixed both gnome-shell.css files. It was a nightmare but it seems that now everything works.
With those changes it was around 10pm at night I had wasted all the evening with this task. Besides as soon as I switched off the laptop I realized why GDM crashed in a blinding flash, the problem was for sure that I had customized the greeting screen (just the background picture). Today I have restored the original files of the GDM3 package (those in /etc/gdm3 directory) and GDM3 works again.
In the new version to change the background image you need to modify a css file /usr/share/gnome-shell/theme/gnome-shell.css (I was not dare enough to try another theme). I just changed this property:
#lockDialogGroup { background: #2e3436 url(/usr/share/images/desktop-base/magneto-login2.jpg); background-repeat: no-repeat; }
The image should be exactly the resolution of the screen.
I present some screenshots just to show how my desktop looks now.
I do not know, I think this should not be so difficult. It is astonishing for me that gnome changes so many things in each version, extensions are not compatible, themes do not work, previous configurations crashes GDM3,... Nevertheless I have to say that in my desktop box (which uses almost the default gnome configuration) the upgrade was smooth. GDM3 did not crash and my previous configuration was preserve, only some extensions were missing (weather and dock, and the panel settings I use there to auto-hide top panel). So maybe in my laptop I simply had bad luck. I think you start to know me, this entry is mainly for me, the next time I see a major version of gnome-shell in the upgrade list I will come here to revise this information.
Cheerio!
Saturday, November 19. 2011
Gnome-Shell Extensions
Some weeks ago I realized that gnome-shell and all gnome3 packages were ready to be installed in my wheezy box. Cos I were (and I still am) very busy with a project I am involved, I decided not to upgrade my system at that moment. I had heard such bad comments about this new version that I felt afraid about the change (I was very comfortable with my old desktop). But I have always been a loyal gnome user so the previous weekend my new gnome3/gnome-shell environment was installed, tested and customized.
Obviously the bad comments about the new version are justified in the big differences between both versions. In my opinion plain gnome 3.0 (current version in wheezy), though very eye-candy, is very very restrictive and unproductive in its use. Lots of clicks are wasted to do the same thing you previously did in just one. This annoying fact is very related to the lost of many applets I usually managed (virtual desktop management, menus, launchers, window selector, weather,...), which made your life easier. But finally I discovered that gnome-shell introduces a new idea: gnome shell extensions. The gnome-shell uses extensions in a very similar way than firefox does but, right now, there is not a trusted gnome extension repository or a extension manager application (easy installation, auto-update and so on). But it is clear for me that it is planned for the near future.
I spent short time studying how extensions work and finally I realized they are a very good idea. From a technical view a extension consists in some JSON (configuration), JavaScript (code) and CSS (aspect) files (all HTML standards which is a good thing, at least for me). I am sure that you will can easily replace anything you did in gnome2 with a suitable extension in gnome3 but, as always, nowadays all this stuff is quite immature. One important aspect is that these extensions can also be installed in your ~/.local directory (you do not need packages from your linux distribution, although it is sure that some basic extensions will be installed by default in all distros, check this debian bug for example).
In order to configure gnome-shell and its extensions you better install gnome-tweak-tool application. But you always can do all configuration using typical gsettings command or dconf-editor application (utilities to manage the gnome configuration in general). So once I had understood new gnome-shell stuff I installed the following extensions to be comfortable with my new desktop:
Standard gnome-shell-extensions
Gnome itself has a collection of extensions (these are the ones that I think, at least, are going to be in any linux distro by default). I installed two of them:
- dock: Shows a dock-style task switcher on the right side of the screen (it replaces my typical launchers and window selectors). Next version 3.2 adds configuration properties for changing the default position and auto-hiding.
- user-theme: Loads a shell theme from ~/.themes/<name>/gnome-shell (I like to customize my desktop ).
The installation process is the following:
Get the source from GIT:
$ git clone git://git.gnome.org/gnome-shell-extensions
Go to tag gnome 3.0.2 (version of my current wheezy gnome-shell):
$ cd gnome-shell-extensions/ $ git checkout 3.0.2
Autogen, make and install them (only the two extensions):
$ ./autogen.sh --prefix=$HOME/.local --enable-extensions="user-theme dock" $ make $ make install
Right now there is a bug in glib-2.0 that it does not take into account extended schemas you have in your ~/.local/share/glib-2.0/schemas directory. So you have to copy the new schemas from there to the global directory and compile them:
$ cd ~/.local/share/glib-2.0/schemas/ $ sudo cp org.gnome.shell.extensions.dock.gschema.xml \ org.gnome.shell.extensions.user-theme.gschema.xml /usr/share/glib-2.0/schemas/ $ sudo glib-compile-schemas /usr/share/glib-2.0/schemas/
- All the themes for gnome3 (GTK, window manager or gnome-shell itself) can be download from gnome-look.org. They are installed as always inside ~/.themes and ~/.icons directories. Use gnome-tweak-tool to change any theme.
gnome-shell-weather-extension
Another applet I used to add to my gnome2 panel was the weather applet. An equivalent extension is the gnome-shell-weather-extension done by Simon Legner but it nowadays does not have several locations like the old applet . The installation is more or less the same:
Clone the repository with git (branch 3.0):
$ git clone -b gnome3.0 https://github.com/simon04/gnome-shell-extension-weather
Install:
$ cd gnome-shell-extension-weather/ $ ./autogen.sh --prefix=$HOME/.local $ make $ make install
Because of the commented glib2 bug you need to include the schemas globally:
$ cd ~/.local/share/glib-2.0/schemas $ sudo cp org.gnome.shell.extensions.weather.gschema.xml /usr/share/glib-2.0/schemas/ $ sudo glib-compile-schemas /usr/share/glib-2.0/schemas/
Then you need to set the city for the weather, in my case Madrid. I did it via gsettings (you can also use dconf-editor):
$ gsettings set org.gnome.shell.extensions.weather woeid "'766273'"
gnome-shell-workspace-indicator
Finally workspaces in default gnome3 needs too many clicks for me (I change working workspace very often to waste time doing that). So I installed another extension that adds workspace selection in gnome-shell toolbar. This extension has been incorporated to default gnome-shell extensions in latest version 3.2 (but it does not exist in the 3.0.2/wheezy version I installed in the first point).
The installation is pretty the same:
Clone the sources:
$ git clone git://github.com/erick2red/shell-extensions.git
Generate and install:
$ cd shell-extensions/ $ ./autogen.sh --prefix=$HOME/.local --enable-extensions="workspace-indicator" $ make $ make install
Installation of the schemas:
$ cd schemas/ $ sudo cp org.gnome.shell.extensions.workspace-indicator.gschema.xml \ /usr/share/glib-2.0/schemas/ $ sudo glib-compile-schemas /usr/share/glib-2.0/schemas/
I prefer wide indicator (with wide indicator you see Workspace 1 instead of the concise 1 you get with default configuration):
$ gettings set org.gnome.shell.extensions.workspace-indicator \ wide-indicator true
I tried to be comfortable but with the least number of extensions. Think you have to re-add them every time you upgrade gnome-shell version (until there was a better solution: a gnome extension manager infraestructure, distro provided extensions or whatever). My desktop currently has the following aspect.
I have written this entry because, as I commented before, I will need to update my extensions when a new version of the gnome-shell arrives (3.2 for example). I hope that shortly some extension management will come to gnome3 and all this stuff will be automatically done (as firefox does), but right now extensions need to be installed manually. There are a lot of them scattered throughout the internet and there are also several links which comment the must-have ones (for example this, this or this). Installation can be independent of the linux distribution (although some basic extensions will come by default for sure). I have only installed four extensions in my desktop: user-theme support, dock, weather and workspace. You can enable or disable extensions and customize them via gnome-tweak-tool (coarse-grained changes) and gsettings or dconf-editor (fine-grained configuration).
Finally I got the conclusion that gnome3 and its extensions are a brilliant idea. I think that, with a proper management and repository, its future is awesome but right now gnome3 falls a bit short. In my opinion that is the reason for all the bad comments and the negative impression of many users.
Long life gnome3!
Comments