cmdRelay
- 10 Devlogs
- 45 Total hours
A remote HID(Human Interface Device) project with some more QoL features, in Rust Tauri V2 and Reactjs for mobile client
A remote HID(Human Interface Device) project with some more QoL features, in Rust Tauri V2 and Reactjs for mobile client
linux as well, mac and windows does not mean corss platformlinux gonna get from me.windows soon, (i have mac, i am gonna borrow from a friend)3000 to more random port, as 3000 is commonly busySpecial Function can now be executed on the Linux
Layout Builder/Settings to the main application from web client to make it feel like a native app instead of a web UIkey mappings for cross platform supportassets were not loading in the producition build, moved the assets to the public directory for direct access after produciton build virtual keyboard. They are bounded to pressing keys in physical keyboard.Apple script on macOS, but Apple script are still failing on some casesswift language code , I did not understand how I could write swift inside rust but, stack overflow works. I got the code from stack overflow.VS code, Photoshop, fusion 360 and while giving presentations.i will be straight forward
(CPU/RAM) and some other system details of the computer right on the mobile app."extras" and I really didn’t want to slow down my core functionality.Gemini about it and guess what? There is always a solution I mean, what did I expect? Its engineering after allI am well aware my app won’t probably be used by more than 10 people for 10 minutes, but my Senior Software Engineer came shouting -
“Your current method to render different views, that too without using
react-router, it will become scalability issue as application grow”
in my initial HL system design i was going to use a single page and conditional rendering for different layouts on same page to avoide a package i decided not to use the react-router for my client web page
but now i have like 5 pages and as i am building i keep getting more and more ideas…
I fixed this issue by
component mapping (view registry) for all the views. Now I can just plug in any number of views without writing spaghetti if/else statements.The important thing is as i am not using the react-router, i will to keep an eye on memory and
component lifecycleto free up the space inmemoryfrom components which are not in view.
😭
10 hour limit of the hackclub.RUST
Its gonna be long Devlog read at your own risk(10 hours dump. Note: the maximum limit is 4000 characters so I cannot write everything here just this much)
So if you may know that in this project, one of the things is to simulate the actual keyboard through the application
MacBook, we press F1 to decrease brightness, so i coded my applicaiton to to press the F1 but nothing happenedOS do not registers the F1 and F2 key for changing the brightness but it actually uses some code tied to hardware to trigger the special fucitionalityOperating systems register the keys, and trigger those special functions.shortcuts were not triggering those special functionalities into the computer. As the OS was not looking for me to press F1. it looks for a special code which is tied with the keyboard itself, which was not in virtual keyboard,code is used by a particular operating system to increase or decrease the brightness, and then you will have to trigger that code when the key is pressed.I implemented macros, you can basically press a sequence of keys with control delay. Just on a single click. It is spamming a key running some keyboard shortcuts on a single click.
thread to run this macro so that it does not freeze my main applicationconcurrency and threading in Python and I did it again in rust this time. I used MPSC (Multi-Producer, Single-Consumer) here. I don’t fully understand it, though, but yeah, I know why I used it and how I used itSo I just liked a button, which upon clicking will open up any application on your computer
command on operating system, you have to know their exact official names, and a normal user does not know thatapplication folder onto the operating system and found out the official names of each application. Then I showed the list in a dropdown to user, from where user can select the names of applications.This is it. The big one. This was the most important, most time-consuming, and absolute flagship feature of the entire project.
context aware layouts? So in the application, one of the parts is to create layouts, which helps with your work aespecially in the productivity/professional applications
desktop apps, with your phone sitting on your desk acting as your custom macro pad. This feature actively extracts the currently focused application on your computer and instantly switches the layout on your phone to match it.system design,improving existing features and make them actually usableSo basically, I had done a dumb thing very dumb thing. I did not realize that the buttons on the actual keyboard have different states, you know when they are being held down OR they’re being pressed OR they are being released, this info matters and I completely missed it.
so now, basically, my key presses have a state
So the SHIFT button which I had implemented earlier was only clickable, user couldn’t hold it, but the shift button is meant to be held, so I fixed this and other similar buttons like alt, control and command
Improved the portrait and landscape switching between the views in layout builder. This is just normal UI improvement Nothing special here
Other than these two improvements above, there has been numerous other small little improvements which took me a lot of time, so I don’t really have much to write on this devlog, changes are like
conditional rendering thing, it was messy as I decided not to use react router for this project as there weren’t any actual pages or URLs, just bunch of different control layouts.state management to handle menu overlay properlyutility functions and type safety.Rust as this is like my second project in rust (i leanred rust like a year ago and now i remember nothing, thanks to my good c++, i have held my ground so far)UI and UX, button can now be held and tracked weather they are being pressed or released
first i would like to define what i call a control layout, as i reliased i never relly defined it properly
Control Layout: It is a layout of buttons and other control elements like
So basically, these controls can trigger and functionality or a shortcut or a macro onto the computer that the client is connected with
Single click on the phone screen will be able to run a complex keyboard shortcut
User can map shortcuts based on particular applications, and he does not need to remember keyboard shortcut.
They don’t even need to click anywhere on their screen. The phone will act as a secondary keyboard or a small macropad.
The application contains some prebuilt control layouts
But different user user different application and have different workflow, so i created a featrure to let users
basically, I have an interface which tries to mimic a mobile screen, and I have divided that screen into grids with CSS
I can move the elements around and resize them.
I track the position, height and width of those elements and store them in a JSON config file upon saving these layouts. This JSON config is sent over local web socket to the Rust server.
Along with just the information about the UI, there is also working information, like name of button, its functionality etc
I have a component which is quite opposite of a builder which is a renderer.
This renderer takes up JSON config and renderes the different components and maps the functionality, in smple word it takes json and create UI.
desktop
Single Click, Double Click, Two-Tap Secondary Click
Two Finger scroll gesture is s supportedUsed a blocking thread to offlaod the hardware control operations (60 times per second)
The hardest part now is supporting the ability to drag and supporting more gestures, It will requires complex math and numerous trial & error iterations.
a simple textarea where user can type with his native keyboard of the phone and the text gets typed live on the on computer.
Buttons like Backspace, Enter required different approach as they cant be clubed with normal text typing feature of Enigo.text()
accelaration detection for smooth scrollingwell in my last devlog in mentioned i wanted to improve code quality and modularity, but guess what its still spaghetti code.
Arrow Keys
Enigo to simulates key pressesSo basically now i can contorl the keys of my laptop with phone over local network and that under 5ms latency
Client Sends data over websocket –> Rust appliaction listening to the socket recieves it –> formats the incoming data to decide the appropirate action –> uses Enigo to simulate Key presses
basically a controlling a device with another device, here controlling a computer with mobile phone
Problem: On my desk i have a windos pc (with top tier monitor) and i also have a macbook, and i lie on the bed and play movies on the monitor, but then i cant control the playback, volume, and cant scroll youtube.
kde connect, was usable, but it uses an ios app on the iphone and due to app store restriction, it offers limited functionlality on ios, compares to android, also its complex to use and consumes more battery and lack modern features and UI.cmdRelay solves these problemsPWA(Progressive Web App) is used in my idea, which solves the app store’s restrictionsRust, cross platform support. (an installation is required on the desktop, though its under 10 MB)LAN, to reduce latency to about 5ms
trackpad, keyboard, run big keyboard shortcuts on just a click, i will try for `gesture₹₹ support as well can’t promise anything right now.websocket connecion.Rust and React js client, and establised the connection successfuly