Comments (6)
I did a little bit of hacking around to expose the names of the layers to the main struct, but ideally I think it would be nice to have a vec of parsed layers made available in the main struct which you could access a .name member of as a String
Combining the layer strings and layer names into a single struct would be good since they are currently Vec
s of the same length. Nothing needs the fully parsed layer at this time, but it can be added later if needed.
pub struct LayerInfo {
pub name: String,
pub cfg_text: String,
}
I would also move the TCP client handling code out of check_handle_layer_change
and instead write the EventNotification
to a channel, with a separate thread listening on the channel writing to the TCP clients. The fn check_handle_layer_change
is part of the processing loop that handles and writes OS events, so it would be good to keep the TCP writing out of that loop.
from kanata.
First cut of outputs that would be sent:
- layer change
- custom event (single string only)
from kanata.
Is there a preference for the communication protocol that should be used and how/where receivers should be configured? I was thinking that one or more local TCP server addresses could be passed to kanata
as command-line options on startup but I wanted to open it up for discussion before I start hacking around.
from kanata.
I have no preference for protocol as long as it's a commonly used one.
Rather than taking a command line option, perhaps it would be better to put it into the configuration file? I don't imagine a user would want to change it frequently, though I could be mistaken in this. I don't have a strong preference either way though.
from kanata.
I have just thrown together something minimally functioning on a branch here. I'm currently starting the binary with a --port
flag which is otherwise given a random default value.
Using a basic TCP client in Python, I'm able to receive events:
import socket
client = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
ip=socket.gethostbyname("localhost")
port=9999
address=(ip,port)
client.connect(address)
while True:
data = client.recv(1024)
print(data.decode("utf-8"))
{"LayerChange":{"old":"ff","new":"qwerty"}}
{"LayerChange":{"old":"qwerty","new":"ff"}}
{"LayerChange":{"old":"ff","new":"qwerty"}}
{"LayerChange":{"old":"qwerty","new":"ff"}}
{"LayerChange":{"old":"ff","new":"qwerty"}}
{"LayerChange":{"old":"qwerty","new":"ff"}}
For this initial implementation I'm serializing the events as JSON with serde_json
and sending them as bytes to be decoded on the client side; I'm not sure if there are any other serialization formats you'd be interested in for this functionality.
I did a little bit of hacking around to expose the names of the layers to the main struct, but ideally I think it would be nice to have a vec of parsed layers made available in the main struct which you could access a .name
member of as a String.
It's still pretty rough so take a look and let me know what you'd like me to change and how to fit in better with the rest of the codebase.
from kanata.
I've updated what I have on my branch, I'll open a PR so that you can annotate the changes with any further comments directly.
from kanata.
Related Issues (20)
- Bug: Invalid quoting in systemd service file shown in docs HOT 3
- Upstream forked keyberon changes? HOT 1
- Feature request: Interception as a seperated OS HOT 10
- Feature request: be able to perform an action when sldr ends unsuccessfully HOT 4
- Bug: remapping arrow keys and sixpack results inn numberpad keys being pressed. HOT 4
- Bug: PrintScreen not triggering HOT 6
- Feature request: RPM SPEC file HOT 2
- Why doesn't `C-S-mlft` (open link in new tab and move to that tab in Chrome) work when mapped to anything? HOT 2
- Feature request: AHK style hotstrings HOT 2
- kanata.service error finding config file HOT 4
- Feature request: Accessible output messages HOT 9
- Feature request: Reverse the release order of (multi) keys
- Bug: unmod-ing modded keys not possible ({, }, !, $, etc.) HOT 3
- [minor] Prefix a new line after some secs idling in the debug log HOT 2
- Bug: "switch" & "not" operator not working HOT 6
- Bug: kanata interception gui executable does not use interception HOT 1
- Bug: Unable to find a keyboard device HOT 2
- Bug: Ctrl Shift W doesnt work in remapper ctrl key. HOT 3
- Bug: Second character of macro disappears when it is used in chord HOT 4
- help: remap fn key nixos-asahi m1 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kanata.