Skip to content

Instantly share code, notes, and snippets.

@wjt
Created March 28, 2019 09:12
Show Gist options
  • Select an option

  • Save wjt/cf0fa99d4dbdeaa5ad0a2647cfb3a0f3 to your computer and use it in GitHub Desktop.

Select an option

Save wjt/cf0fa99d4dbdeaa5ad0a2647cfb3a0f3 to your computer and use it in GitHub Desktop.
#!/usr/bin/gjs
const Lang = imports.lang;
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
let file = Gio.file_new_for_path(ARGV[0]);
let monitor = file.monitor_file(Gio.FileMonitorFlags.WATCH_HARD_LINKS, null);
monitor.connect('changed', (monitor, file, otherfile, ev, data) => {
log('file changed with event ' + ev);
});
let main_loop = new GLib.MainLoop(null, false);
main_loop.run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment