My *nix world

Xfce Desktop grey

If for some reasons or another you noticed that your Xfce desktop became grey out of a clear blue sky, nonetheless the mouse left-right click responding in a weird manner, you better read this first.

First thing you tried was to logout-login your Xfce session. It didn't help. Then you tried to restart your system (just in case). Obviously this didn't work too because Linux doesn't need a restart like Windows for every single tiny problem. Well, some of you perhaps thought to reinstall the Xfce desktop (xfdesktop) or Xfce Window Manager (xfwm4) or (why not) the Xfce session (xfce4-session). Neither one of these worked. Then you asked your best friend, the Google and it come up with some brilliant (?!) ideas like: "try delete these folders entirely:"

~/.cache/sessions/
~/.config/xfce4/

STOP! Read this first!

I haven't deleted my files yet

In the rush of getting this annoying problem fixed you might try one of these crazy ideas but first let me tell what are you "advised" to do.

The ~/.cache/session contains any previously Xfce saved session settings like the active workspace, the current home/working directory, nothing that seems to have a crucial importance to me.

The ~/.config/xfce4 is another story. Just a simple ls -la ~/.config/xfce4 would reveal what you are going to permanently remove:


Just to give you a hint I should tell you that the panel folder contains all your panels and launchers/shortcuts definitions. Before you remove it make sure that either you don't need them or if you do then make a backup first. The desktop folder contains the desktop shortcut definitions which may be just as important as the panel folder is.

Now regarding the xfconf folder just let's see what is inside:


If the panel folder earlier contained the launchers definitions the xfce4-panel.xml file on the other hand contains how these launchers are organized on your panel so basically this contains your panels definitions.
Never the less the xfce4-keyboard-shortcuts.xml file has a crucial importance to me because I am lazy and I don't like moving the mouse in all directions just to launch a shortcut. I (still) have a good memory and a lots of keyboard shortcuts (like 30 or so) so I don't want to accidentally remove them because, as I've said earlier, I'm lazy and don't like to redefine the whole desktop scheme just because of a stupid Xfce desktop grey thing. Look at the size of these files: the bigger one is xfce4-keyboard-shortcuts.xml so it might be important, right? What's next? Exactly, the xfce4-panel.xml. It is very important too, I cannot stress enough this (fixed) idea.
If we take a look at the xfwm4.xml file it seems to contain other settings related to Windows Manager.

I kept the juice for the end: the "delete these files" solution above will fix your Xfce desktop grey issue but keep in mind all I told you before. The folders you are going to delete (in order to fix the damn thing) contain capital information about how you organized your keyboard shortcuts, desktops, panels, windowing settings, whatever.

Oops, I deleted my files. Now what?

Ok, so you deleted your files. Now what? The only way to recover from this situation is to try to recover the deleted files. There are numerous methods of restoring deleted files in Linux (depending on their types, the filesystem you have, etc) but the one that works for this case is just to look up for all all inodes - even the deleted ones - (on the partition where those files were stored) that contain some keyword that we know it appears only within these "deleted files".

The Linux grep command is all we need. But what we know about these files is as important as the grep command itself:

  1. are they binary or just plain text files
  2. what are the keywords that only these files might contain
  3. which is the partition where these files were stored

(1) Basically these files are .ini files or .xml files so we can assume they are just plain TEXT files.

(2) Supposing you deleted these files probably you started with a default desktop scheme (default panels, default window settings, default anything). Perhaps these default files took place instead of your custom (but unfortunately deleted) files. Then just cat any of these files and find a piece of text that looks characteristic for these kind of files.

(3) The file system disk space Linux tool (df) is all you need. Just df ~/.config and you will get something like:


So we see that this folder belongs to a partition mounted as /. Which might be that partition you may ask? Well, just cat/etc/fstab and check which partition has the mount-point /:


In my case the / is mounted on partition /dev/sdc2 so this is where I would look for my deleted files if I need to. But please note that your partition configuration has perhaps nothing in common with my local configuration so don't just copy-paste these thing on your terminal hoping that your problem get fixed that way, right?

Now that we have all the 1-2-3 answers let's see how we can use grep.

By grepping the inodes on the /dev/sdc2 partition we we get a bunch of binary blocks that might contain our keywords. So certainly they don't have plain text only and that is why we should inform grep to treat binary as text (the -a parameter). We can pass our keywords pattern by using the -F paramter. The grep will output by default all the contents to the stdout (your terminal) and, considering that the output may be anything from 5MB to 100MB, we want to capture this output to a file, right?

Finally the grep command should look like this:


Note: it would be nice if your /tmp folder is mounted to a memory filesystem (like tmpfs) or to any partition that is not the same your deleted files were stored. The reason for that is that you don't want to give Linux the chance of overwriting these - now available - inodes such that the content of the previous deleted files get overwritten by your temporary dump file. Does it make sense? Just think about it!

It may take a while, depending on the keywords used, the partition size, the hard-disk read-write performances, etc. Anyway, after a while you get that dump.txt file. Now use whatever program you like and search for these keywords within the dump.txt file. They should appear in the neighbourhood of the file content that had/has the respective keyword within. If that is what you are looking for then use that piece of info and reconstruct manually the lost shortcut/whatever, otherwise just keep searching. Note that the grep command can be also used for this too (like grep keyword dump.txt)

Conclusion: backup the folders first and later do whatever works for you. It took ~1300 words to me just to explain you how to solve this!

Now, if you think that this article was interesting don't forget to rate it. It shows me that you care and thus I will continue write about these things.

 
The following two tabs change content below.
Xfce Desktop grey

Eugen Mihailescu

Founder/programmer/one-man-show at Cubique Software
Always looking to learn more about *nix world, about the fundamental concepts of math, physics, electronics. I am also passionate about programming, database and systems administration. 16+ yrs experience in software development, designing enterprise systems, IT support and troubleshooting.
Xfce Desktop grey

Latest posts by Eugen Mihailescu (see all)

Leave a Reply

Your email address will not be published. Required fields are marked *

Follow

Get every new post on this blog delivered to your Inbox.

Join other followers: