[compiz] Flat file backend (ini)

David Reveman davidr at novell.com
Mon Mar 5 05:41:42 PST 2007


On Mon, 2007-03-05 at 18:03 +0000, Mike Dransfield wrote:
> Gerd Kohlberger wrote:
> >
> > The IN_MODIFY bit isn't really useful for text files.
> >
> > If you watch the event sequence which get emited by inotify you'll see 
> > something like:
> >
> > 1) MOVE compiz.conf -> compiz.conf~
> > 2) MOVE compiz.conf~ -> compiz.conf
> > 3) DELETE compiz.conf~
> >
> > So if you watch compiz.conf directly and you open it in a text editor 
> > it gets moved.
> > After that inotify seems to loose track of that file and the kernel 
> > will send an IN_IGNORED event,
> > which automatically removes the watch. This is why modify only works 
> > the first time.
> >
> > I think the best solution would be to watch only the ~/.compiz/options 
> > dir and put all files in
> > this directory. You could changed the filenames to something like 
> > <plugin>-<screen>.conf to represent
> > the different screens. 
> 
> Thanks for the advice, I have changed it to do exactly that and it now
> seems to be working perfectly for all editors that I have.
> 
> It seems that I still need IN_MODIFY because without it I was only
> receiving notifications on the temp file.
> 
> I think all the major problems are solved now, its just a case of tidying
> up here and there.  I will probably need to add proper file locking but
> it shouldn't cause too many problems.  What happens when a file is
> deleted will still need to be resolved (at the moment it just writes it 
> back)

Great!

> 
> http://www.anykeysoftware.co.uk/compiz/plugins/ini.c
> 
> I have ifdef'd out the MODIFY bit so it will still compile without the
> IN_MODIFY patch.

IN_MODIFY is already in head so you don't need that anymore.

It looks good. I'd like to get this into head today but the header needs
to be fixed first. Novell, Inc. clearly don't hold the copyright to this
file. Do "s/Novell, Inc./Mike Dransfield/" if nothing else.

Thanks,

- David



More information about the compiz mailing list