0.3.0 • Published 5 years ago

interflug v0.3.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

npm.io

Prerequisites

Interflug uses the wmctrl and xte command line tools for window management and sending keystrokes. Furthermore, it depends on sindresorhus/clipboardy which in turn requires xsel. All of these can be installed on Debian-ish/Ubuntu-ish systems with apt:

sudo apt install xautomation wmctrl xsel

Demos

Demo One

From the command line, execute node lib/demos/demo1.js.

Create an Interflug context module and set window IDs. This records the window ID of the currently active window—in this case the window of the terminal emulator—and prompt the user to switch to aome other application and click into that window. That window ID—the target ID—will subsequently be used to send text to:

ifl = IFL.new()
IFL.set_window_ids ifl

Demo Two

Once you know the target window ID, you can send arbitrary text to that window:

ifl = IFL.new()
IFL.set_window_ids              ifl
IFL.send_text_to_target_window  ifl, "demonstrating Unicode: äöü𤬣"

IFL.send_text_to_target_window switches to the target window, paste the text passed as second argument, and then switch back to the own window. The text argument is optional; if it is omitted, then the current X11 clipboard contents will be used.