npm install
./node_modules/.bin/electron-rebuild
pip install grpc grpc-tools
# At the root directory of python grpc (e.g "hitrans/rpc")
python3 -m grpc_tools.protoc -I../rpc --python_out=. --grpc_python_out=. ../rpc/protos/*.proto
Open a terminal and type:
npm start
Open another terminal and type:
python ./rpc/main.py
Electron Architecture has 1 Main Process and Many Renderer Processes.
Renderer Processes communicates with each other via Main Process.
Renderer Process communicates with Main Process via Electron IPC Mechanism.
React is the main frontend of the application.
PopUp is a frameless window implemented in pure html codes.
This process holds an important role in the application. The gRPC Second Services will be running in this process as Node gRPC Server to handle PopUp request from Python gRPC Client where the gRPC First Services will be the Node gRPC Client that sends requests to Python gRPC Server.
Electron Main Process uses Node gRPC to create independent client and server processes to communicate with Python gRPC processes via sockets.
- Create Config File
- Get Config File
- Write Config File
- PopUp (show translated text in frameless window)
This process will use the gRPC First Services as Python gRPC Server to handle requests made from Node gRPC Client.
This process will use the gRPC Second Services as Python gRPC Client to make requests to Node gRPC Server.
This process has following services:
- Detect mouse position
- Detect mouse clicks, double click.
- Get primary selection text of the OS.
- Detect keyboard shortcuts.