Skip to content

Instantly share code, notes, and snippets.

View yilozt's full-sized avatar
🐢

Yi yilozt

🐢
View GitHub Profile
@yilozt
yilozt / shell_object_sample.js
Created July 4, 2022 02:22 — forked from buzztaiki/shell_object_sample.js
Using shell object in gjs
// LD_LIBRARY_PATH=/usr/lib64/gnome-shell/ gjs shell_object_sample.js
const GIRepository = imports.gi.GIRepository;
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
function findLib(path, prefix) {
const libdir = Gio.File.new_for_path(path);
const files = libdir.enumerate_children('', Gio.FileQueryInfoFlags.NONE, null);
for (;;) {
@yilozt
yilozt / watching_dir.js
Created July 23, 2022 16:09
Watch Directory With Gio
const GLib = imports.gi.GLib
const Gio = imports.gi.Gio
const loop = new GLib.MainLoop (null, false)
const home = GLib.get_home_dir ()
const file = Gio.File.new_for_path (home + '/a/b')
const monitor = file.monitor (Gio.FileMonitorFlags.WATCH_MOVES, null)
monitor.connect ('changed', (monitor, file, otherFile, eventType) => {