and still may not

Month: February 2012

After running the usual apt upgrade the nautilus menu items suddenly appeared below gnome-shell’s top panel. By below I mean that I have a transparent top bar under which the menu items are showing, but can’t be clicked at all.

Following this post (scroll down to the “Fix Nautilus menu being displayed under the GNOME Shell top bar when using transparent GNOME Shell themes” paragraph) I managed to remove them by simply going to the gnome tweak tool and disabling the Have file manager handle the desktop option under Desktop.

I don’t even know why that option has been set on in the first place…

[Edit]: when disabling the Nautilus desktop management option not only icons will disappear from the desktop, but you you won’t be able to right-click and execute scripts either (and with gnome-shell being very unstable with the latest ATI drivers I very often rely on my gnome-shell restart script, so this is a show stopper).

The only solution I found (and I actually had to struggle a bit, since it doesn’t seem to be a very common issue yet) is to set the top panel background to some opaque image or gradient. Since I installed a gnome-shell theme (you can find the option in the gnome tweak tool under Theme/Shell theme) called Nord, the CSS files to be edited can be found inside ~/.themes/Nord/gnome-shell/, and all styles for the top panel are defined in ~/.themes/Nord/gnome-shell/panel.css.

If you don’t have a custom theme you’ll find the top panel background definition in a file with a path like /usr/share/themes/Ambiance/gtk-3.0/apps/gnome-panel.css (change Ambiance with the name of the GTK+ theme you use).

You must find the #panel definition, and change the background- tags to set an alpha (the fourth in rgba values) of 1.0 like I did:

Yet another c++ error that isn’t immediate to recover: I wanted to compile and run a program that uses the awesome Boost libraries, but after successfully compiling the program against the libraries I managed to download and install I got the error in the title.

After some googling, I found that you have to add the path to the boost libraries to the environment variable LD_LIBRARY_PATH. You can check whether that’s the problem you have by running your program in a shell like this:

export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
./my_program

Replace /usr/local/lib/ with the path you chose to install boost libraries to (that’s the default path if you installed them as root).

If your program runs fine, there’s your problem!

To make changes permanent in Ubuntu you have to add a new configuration file for ldconfig:

sudo vim /etc/ld.so.conf.d/libboost.conf

(my editor of choice is VIM, and the name of the file itself doesn’t matter)
Add the library path to that file, i.e. /usr/local/lib/.
Save the file, quit and reload your configuration by calling

sudo ldconfig

Note that your LD_LIBRARY_PATH won’t change, but your program will now run!

This I found it surprisingly hard to Google: I want Eclipse to open Glade files with.. er.. Glade, and I don’t want to right click into Open with... every single time.

What I immediately tried to do was to right-click on the file, go to Properties and I expected to find some Open with... option, you know, like in Ubuntu. At least I hoped to find a link to another menu entry, like there are several spread over Eclipse menus.

The right thing to do instead is to go to Window/Preferences/General/Editors/File associations, pick the extension (or add it, as was my case) and add or edit the “editor” (which can actually be any application, as long as all it takes to open the file with it is to feed it the file name).

The same thing can be done to use Eclipse own editors, say you want to open XML files with a text editor instead of the structured one that Eclipse uses by default..

I know that there’s a function called fullscreen() that you can call on a window to set it fullscreen. I also know that my screen resolution is 1920×1080, so I supposed that explicitly setting the window’s height and width to the exact screen size would have forced mutter to put my window above everything else.

But…

No, it doesn’t. There’s a sneaky little option called Window Type that has to be set to Popup to make gnome’s top bar surrender and let your window dominate the screen. You can find it in the General tab in Glade (it’s the third field in Glade 3.10.0, I don’t know about the other versions).

Is this some kind of common knowledge that doesn’t have to be put on tutorials? I find the lack of documentation on GTK+3 disturbing.. 🙂 (I know that the API is quite well documented, but we’re still missing the plethora of examples you can find for GTK+2 on the web)

[Edit – April 2014]:I noticed my python script here didn’t do a very good job at not showing the same wallpaper twice before all wallpapers in a folder were shown. Hence, I created another simpler version of the script in bash that does a better job at that. You can find it here

I hoped Gnome3 would have had an integrated function to create custom wallpapers that change throughout the day by picking a folder with your images and choose some refresh interval, but still you have to rely on external scripts or programs.

I’ve been using WallCh for quite some time under Unity, and it suited me well. It was a bit too much for what I wanted to actually do, grabbing pictures in a folder and set them as wallpaper every 3 minutes that is.

Another thing that “annoyed” me is that while in Unity minimized windows are quite the same thing as background processes — in that they just stay on the Unity dash and as long as you don’t hit Alt+Tab they never show up — in Gnome3 I very often go through the list of all open applications, and WallCh by default is always there. I’m not a fan of Alt+Tab in Gnome3: I find it faster to hit Super with my left hand and click on a window I instantly recognize with my right hand than to cycle through small pictures with titles. I don’t know whether WallCh has an option to run in the background, but if it does I didn’t instantly find it and I opted for a little DIY 😛

That being said I thought that surely a simple command must exist to just change the wallpaper, and it does! It’s gsettings, with its org.gnome.desktop.background keys. So, to set your ~/Images/1080p/wall_0.png as background you just call

you can just add these two system calls in some simple script in whatever language you like and there you have your custom wallpaper changer!

I came up with a simple python script which is actually a stripped-down version of this nice little script by Romano Giannetti. I simply removed all verbosity and moved the pictures folder definition to a properties file that is checked at every interval, so I never have to change the script itself. If anyone is interested, I’ll post it (it’s less than 50 LOC in the end).

Then, I added the script as a startup application with gnome-session-properties so I finally have my lightweight background wallpaper changer 🙂

Well, if truth be told my version of the script has no error checks whatsoever, but since somebody may try to use this I thought that some information on what’s going on may be helpful. You can list several folders in the configuration file; if you change the configuration file while the script is running the list gets parsed again and reset.

Of all the C++ testing libraries I googled for, the most powerful and easiest to use seems to be… er… Google’s 🙂

Me being mostly a Java/Python programmer (and proud to be!), I still can’t find it “easy” but… it’s mostly like using JUnit (well, mostly).

You get your SetUp() and TearDown() functions, your ::testing::Test class to extend and your TEST_F()s with all their EXPECT_whatever() to be run stuffing ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); into your main() function.

Ok, the first test I wrote actually shattered my “oh-my-it’s-just-like-JUnit!” dream.. I just wanted to write a test for a class that needs a std::string as argument. The easiest way I found to do that is to have your test class extend the class under test, and wrap the super class constructor with a no-args one.

Of course this is just a toy to understand the framework, but it’s a little example I couldn’t easily find on the web right now..
I’m no C++ expert at all, so if anyone reading this feels insulted by something I wrote, please, please post a comment and teach me how this should be done, I’m more than willing to learn! 🙂

[Update – July 2013]: Mark Abraham posted how it’s done, just scroll down to his comment!