Current Release
This release is my current progress. At this point, I’ve cleaned up a lot of the various threading bugs (paho server running on separate thread from UI, updating status, etc. so need to use safe invokes) as well as some other potential spots for things to go wrong.
The UI for the control sets now lock whenever they’re enabled. I chose to allow the name to be editable even when the control is enabled as that is just for display. (You do have to click the save button to save those changes - the save button graphic adds a little asterisk whenever any edits are made).
The above is definitely not an exhaustive list of all the bug-fixes that went into this release. It really was the bulk of the work. There was a LOT of clean-up. Everything that was sort of working (such as saving control sets, etc.) is now fully functional and working as expected. System.XML functionality ported to the LINQ implementation for easy sort saves. This really helped cut down on the code complexity quite a bit.
There was actually a memory leak in the PAHO code. Someone beat me to calling it out on GIT (almost 2 years ago at this point) but apparently Eclipse isn’t doing a good job maintaing the library as it still hasn’t been pulled into the release. I made some variant code changes to fix the memory leak to the library for my build which have worked perfectly thus far.
I’m going on about a week now of using it straight. It’s configured to start on boot and the program by default opens to the tray with very low impact to start-up and only around 20 megs of ram utilization, even with hundreds of control sets enabled (for testing purposes - in reality I only need like 20). While there’s still tons of work to go to get it “fully functional” I’m happy I have a tool that ALREADY accomplishes what I originally set out to accomplish.
There are two main features implemented that are new: Media Controls (in ui) and Mouse Control. These involved a full re-write of how the subscribe engine worked to allow for a single command to represent multiple commands (with wild-card * to differentiate the topic subscribes).
Media Controls
Media controls are now fully in the UI. Previously I had them thrown in without UI for testing purposes but that was removed. Users can choose to either pick and choose the media functions they want to enable OR they can choose “Full Stack” which will implement the entire set of controls. With full stack, users can still customize the topics by creating whatever topic path they want as a pre-fix/suffix to the core command. I choose to just use the wild card by itself, but wanted to include the option in case there was a potential use case.
For example: media-*-control as the MQTT path/topic will subscribe the following topics:
DEVICE-NAME/media-vol-up-control - Volume Up
DEVICE-NAME/media-play-control - Play/Pause
…
I really tackled this re-write because I want to eventually create extensible control sets where the wild-card may be more useful and wanted to just have it built into the subscribe engine up front. (One of many use cases: retro cheat code control sets in the format of -* where is the game name and * is the cheat code based on a library of code look-ups that trigger the appropriate macros, etc.)
For now though, I’m able to have my 3rd monitor playing the Level 1 news while I work on my work computer hooked up to monitors 1 and 2 without having to toggle the KVM to pause the youtube video whenever I need to take a work call ;).
Mouse Controls
Mouse controls are also now fully functional in the UI. In reality this isn’t terribly useful at the current time unless I build a control client to simplify this. However the nifty thing about that is once it’s working it’s a lightweight method of remote mouse control that’s surprisingly fast.
Really though the end goal here is just to allow the macro feature to have mouse functionality as an option in case there’s something that can only be accessed via mouse. While I don’t have the macro functionality built in yet, I hard coded a few for testing purposes. In testing running auto-hotkey scripts vs. using this, I can cut down on end-to-end latency from push button to desired effect by close to a second. That is very much so the difference between something feeling magical and not being sure if it’s working! So this is a feature that is more so about the “potential” than anything BUT I can control the mouse from home assistant which is nifty.
The implementation here involves 2 “stacks”, 1 coordinate move function, and 4 click commands.
The 4 click commands are: Click, Double Click, Right Click, Middle Click.
(There may be a need for double middle, double right, and separating click-up and click down which I plan to implement as well)
The coordinate move function (Move X/Y) takes a comma separated payload and will move the cursor to the appropriate point on the screen. For example on a dual 4k montior setup, 4040,200 would move the cursor to monitor 2 top left corner 200 pixels from left, 200 pixels from right. Once again a feature that in and of itself isn’t terribly useful BUT can obviously be useful for some macros to for example start up an old school RTS straight into a certain mode, etc.
The first stack is Move (ALL) which includes 5 commands:
Same as media the path requires a single * which will be replaced by the text below
Move X/Y (topic replace: move-to)
Move X- (topic replace: move-left)
Move X+ (topic replace: move-right)
Move Y- (topic replace: move-down)
Move Y+ (topic replace: move-up)
I do plan to eventually add a gear edit to the UI to allow these defaults to be edited on any stack. This would probably be very useful for the media controls and I suspect not so useful here on the mouse which I doubt many will implement unless I build a hassio mouse card (thinking about it).
The other stack is “Full Stack” which implements Move (ALL) plus all 4 click commands.
Room to Grow
At this point I’ve got a tool that I use all of the time that is always present on my taskbar tray. I’m definitely looking to put the pin in this for “now” (I don’t plan to get batch/macro done by the end of devember because of how ambitious my plan is for macro).
Short term:
Custom title bar
Win32 doesn’t let you over-write the app titlebar colors by default. So I’m just going to make the app frameless, put a 40 pixel border on the top and implement my own title bar as it’s just bugging me as-is.
Long term:
-
User customizable color schemes
I realize the color scheme is very very personal. Heck I would only want it on this one pc that happens to be stylized with the orange/green but would not want it like that on all machines either! (I plan to use this on like 6 pcs).
-
Batch Functionality (will be implemented such that it’s able to be used in macros)
-
Macro functionality (this really is the BIG missing feature!)
-
Additional keysets (I don’t have F13 - F2x implemented. Those will probably be useful to have)
-
UI updates for Key controls. Dropdown will become clunkier and clunkier as more controls are added.
-
Web UI - optional mini-web-server that would allow
-
Python Port with web-ui (headless support) - this will require a LOT more work as it needs to be cross-platform compatible
Additional Exploration:
Will UWP allow xbox controls via background? The xbox remote control is very un-reliably slow. Faster remote media controls would be too great an opportunity to pass up. It’s already C# right now, so it would just be a matter of cutting out the features that don’t apply to an xbox.