Adds 'Mods only' visualizer#203
Conversation
|
I updated this yesterday to include fixes for clicking "through" the window when no (or few) mods are visible. In sonoma, anyway, the mods window was swallowing clicks. |
|
Hey thanks for reviving this PR! I will make time to review it soon and try to figure out how we can incorporate it into an upcoming release. In my own work there's been some tension between adding more features to the default visualizer vs introducing a new one, so I'm eager to (finally) give this a closer look alongside the upcoming mouse visualizer improvements. |
|
Rad! Happy to make changes to it, it's a bit niche at the moment (it scratches an itch I have, but ofc I'd like it to be useful to more). The default and Svelte plugins are useful and distinct (podcasts, pair programming) - this is more for personal use. But yeah improvements welcome. 👍 |
akitchen
left a comment
There was a problem hiding this comment.
A licensing change and a couple minor formatting nits; I will look at more of the functional code locally and follow up later.
|
One other thing -- of course there's no real style guide or anything here, but at one point I thought it would make sense for the order of modifiers to match what Apple's macOS apps show in their menu items. Pretty sure it's control-option-shift-command. |
|
Good changes, I'll ship these soon.
|
|
How's that? 🙂 |
|
Overall this is fantastic to see and I can see how it could be useful. Thanks again. Additional code feedback is mainly just about code formatting for now -- please use Xcode's default formatting for multi-line statements just to keep things as consistent as possible. A few more thoughts:
|
I'm struggling with how easy this should be vs how easy it is... [_visualizerWindow setFrameUsingName:@"mods visualizerFrame" force:YES];
[_visualizerWindow setFrameAutosaveName:@"mods visualizerFrame"];This used to "just work", but is having no effect now. Anything obvious I'm getting wrong? NSRect windowFrame = { MODS_WIDTH, 100, 0, 100 };
_visualizerWindow = [[NSWindow alloc]
initWithContentRect:windowFrame
styleMask:NSWindowStyleMaskBorderless
backing:NSBackingStoreBuffered
defer:NO];
[_visualizerWindow setLevel:NSScreenSaverWindowLevel];
[_visualizerWindow setBackgroundColor:[NSColor clearColor]];
[_visualizerWindow setMovableByWindowBackground:YES];
[_visualizerWindow setFrameUsingName:@"mods visualizerFrame" force:YES];
[_visualizerWindow setFrameAutosaveName:@"mods visualizerFrame"];
[_visualizerWindow setOpaque:NO];
_visualizerView = [[ModsVisualizerView alloc] init];
[_visualizerWindow setContentView:_visualizerView];
[_visualizerView noteFlagsChanged:0];
// ... below ...
- (void)noteFlagsChanged:(uint32_t)flags {
[_visualizerView noteFlagsChanged:flags];
NSRect r = _visualizerWindow.frame;
CGFloat right = r.origin.x + r.size.width;
r.size.width = _visualizerView.frame.size.width;
r.origin.x = right - r.size.width;
[_visualizerWindow setFrame:r display:NO];
}
// ModsVisualizerView
- (void)noteFlagsChanged:(uint32_t)flags {
_flags = flags;
NSRect frame = self.frame;
frame.size.width = MODS_WIDTH / 4 * (CGFloat)[self flagsCount];
self.frame = frame;
[self setNeedsDisplay:YES];
} |
These... maybe I could use some help on these. 😬 The rest are done, except I can't figure out the frame-auto-save feature. |
|
@akitchen I added you as a contributor to my fork, in case you wanted to do any more features/clean-up there. |
|
Let's not let another year go by! 😬 What's next? I tried again today to save/restore the frame using |
|
I haven't debugged this or spent too much time looking at it, but your starting frame is a bit suspicious to me at first glance. Maybe use the NSMakeRect function to help create your initial frame and ensure the origin and size are set properly. This code is manipulating the frame of both the window and the view, which may or may not be correct. A frame's origin is in its parent view's coordinate system. Not sure if you're using a flipped coordinate system or not, but you have to account for that as well. I hope it helps! |
akitchen
left a comment
There was a problem hiding this comment.
'REQUEST_CHANGES' performed by Xcode.
|
Hi, I just discovered Keycastr and I wanted to chime in here, because this is exactly the last feature I am missing! |
|
Yup, I'm back. It's working as intended now, rebased on main, updated the code to grow the mods view according to its position on the current screen. I avoided the autosave bug by simply not using it 🤷♂️ – it uses NSUserDefaults under the hood, so that's what I used, too. |
|
Hey @colinta thank you for following up here, I'll pull this locally and give it a try. |
|
This is really great to see - thanks again! One thing I noticed, the second and subsequent times I run the app after enabling this visualizer, on startup I see a blank square until the first modifier key event comes through. If you could find a fix for that, I'd be happy taking this pretty much as-is and maybe doing some minor cleanups before an upcoming release. Also, let me know your thoughts on maintaining this visualizer going forward. There are a lot of obvious enhancements that could be done as well as potential other issues, and any release of KeyCastr has to be as high quality as possible given limited development time and potentially long gaps between releases. Thanks again for your contribution! Much appreciated! |
akitchen
left a comment
There was a problem hiding this comment.
Fix for phantom box on second and subsequent launch. TY!
|
Hey @colinta , I've been trying this out for a little while and I really like it! I'd like to figure out the remaining steps needed to include it in an upcoming release. Thanks again for sharing the work you put into this! There are a few minor internal changes/improvements which I'll be happy to make, but I think we would need a few more user-facing things. Mainly color and size options, and the ability to include other keystrokes and even mouseclicks like the other visualizers. I can help with some or all of that, but it also brings me to another topic. With the additional functionality to display regular keystrokes and mouse clicks it becomes more than just a "Mods" visualizer. Any thoughts on what it should be called? |
|
Awesome! Yeah funny after all these years, but it's still my daily driver!
I know we have "Svelte" but what about "Minimal"? "Chromeless"?
|
|
Any update on the status of this? 👀 |
|
just found this, this is exactly what I ned as well. is there anything I can help with to get this over the line? |
|
Glad to see there's interest in this, I like it too :) I have a local branch with a handful of fixups and updates, but it will also need a bit more work before I'm comfortable including it in an official release. I hope to be able to share more of an update soon. |
|
I'm happy to help test it! |
|
Hey @colinta , sorry this has dragged on for so long. I had your changes on a local branch where I did some cleanups and started to pave the way for the rest of the changes I think this needs in order to be included in the app, but haven't been able to make much progress on it for a while. If you're still interested you can check out the minimal-visualizer branch and consider opening some new PRs to that branch after you've had a chance to test and play around with it for a bit. Adding a third visualizer plus the need to add more options to the mouse visualizer means other infrastructure work is needed in the app before this can be launched as a part of the app, but I'd still like to do it. |
|
#330 is relevant to this |
|
I changed the target branch for this to the minimal-visualizer branch. Please merge that into your local copy or open a new PR if that's easier. Thanks! |
8a2ef2b to
d15cb0e
Compare
I made this for my own purposes, but I'll offer it up in the spirit of open source. Based on the Svelte visualizer, this one displays the current modifiers and nothing more.
I use it because I have a custom keyboard that implements sticky keys, and I needed to see them on screen (it's easy to lose track of which keys are pressed).
Not really useful for screencasting, but it does show how to create a new visualizer. 🤷♂️
Example of pressing "command+shift" and "command+control+alt+shift".