Closed crystalcommunication closed 2 weeks ago
Good point, thanks. I'll test and update it
It is async now: Gio.Subprocess.new + communicate_utf8_async.
Probably I'll try to rewrite this without subprocesses at all, by working with fn_lock file directly from the main JS code. Not sure if it'll be faster though. The main problem now is that I have some issues with the symlink to that fn_lock file. I tried to add it in udev rules, but SYMLINK didn't work, and smth like 'ln -f - s' in RUN or PROGRAM gave me the wrong link time to time, it seems like duplicated udev events for some reason, with duplicated devices in the end.
The current code uses GLib.spawn_command_line_sync to spawn the shells that are used to swap the state of the FnLk indicator, but this causes GNOME Shell to freeze up while it waits for the shell to exit. I found that launching it asynchronously still caused the FnLk state to be updated immediately without making the shell freeze for a second sometimes.