[compiz] Flat file backend (ini)
Mike Dransfield
mike at blueroot.co.uk
Mon Mar 5 10:03:56 PST 2007
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)
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.
Regards
Mike
More information about the compiz
mailing list