Fallback config

From awesome
Jump to: navigation, search

When you are changing your rc.lua, it's easy to break something, reload with Win+Ctrl+R and find your awesome session unusable. Of course, you should have tested it before using Xephyr but, just in case, I use this hack.

It will try to load my config file: if there are errors, though, it will safely abort and load another file (which we rarely change and _is_ stable).

 cd ~/.config/awesome
 cp rc.lua rc.lua.fallback
 mv rc.lua rc.lua.read

Note that we are now using the current file both for "normal" and fallback session. If you want, you can put a different file as a fallback.

Now, let's create rc.lua

 status, ret = pcall(loadfile, 'rc.lua.real')
 if status == true then
   status, ret = pcall(ret)
 end
 if status == false then
   loadfile('rc.lua.fallback')()
 end

I suggest you putting some difference in your fallback file, so that you can immediately realize that something went wrong; I have a textbox widget displaying "FALLBACK".

Personal tools