Open Bug 403436 Opened 18 years ago Updated 1 year ago

Add service for inotify support (or simulated for non-supporting platforms)

Categories

(Firefox :: File Handling, enhancement)

enhancement

Tracking

()

People

(Reporter: docwhat, Unassigned)

References

Details

Attachments

(1 file)

Linux (and other OSes) support inotify (or similar services); You can request that a directory or file is monitored -- when it changes, you are immediately notified. This would be very handy for applications that need to watch the file-system for changes. If he os doesn't support this service, it can be emulated by checking the file-system every so often. http://www-128.ibm.com/developerworks/linux/library/l-inotify.html Ciao!
An example where this would be useful is the extension It's All Text! https://addons.mozilla.org/en-US/firefox/addon/4125
This would also work really well for web development: edit and save an HTML page or its supporting CSS files, and have Firefox automatically notice and reload the page.
OS: Linux → All
Hardware: PC → All
Bug 403943 comment 0 has some opening thoughts on implementation.
hm, I never did get an answer on the OSX API's.
*sigh* I'd forgotten about this bug when I filed bug 608251. :( Attachment 507363 [details] [diff] has my first attempt at a stub for Linux. Currently, it fails in linking. I need some help figuring that out.
Severity: normal → S3

This would be really nice to have if it were properly built into the web-development platform. Would love to see it!

I have got something that works decently under Linux, and it's a good self-contained way to easily experience the feature:
https://www.neillconsulting.co.uk/images/misc/refresher.txt

  1. Be on Linux, and have xdotool and inotifywait installed.
  2. Go into the project root directory, and invoke this script (rename to .sh and make executable)
  3. Click the firefox window to identify it.
  4. Now, every time you Ctrl-S in your text editor, firefox will automatically reload the page!

It works by using inotifywait to watch the directory, then triggers xdotool to give focus to Firefox, send a Ctrl-R (or Ctrl-shift-R),
then focus the mouse back.

This also works well for PHP scripts.

It isn't perfect - because the Ctrl-R goes to the Firefox Window (it is not bound to the tab you were developing in, if that tab is not currently active).
It can also potentially have a race-condition if you move the mouse between windows in the 25ms or so it takes for xdotool to do its work.

This is a demo, using a shell script (rename from .txt to .sh), and xdotool + inotifywait
(It's the same file I referenced in comment #7, but now uploading it to ensure long-term consistency).

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: