Git Product home page Git Product logo

Comments (8)

joeljfischer avatar joeljfischer commented on August 28, 2024

+1

from masshortcut.

shpakovski avatar shpakovski commented on August 28, 2024

Hi guys, thanks a lot for the feedback! I thought about this case for a while, but not sure how to fix it easily. The thing is that the shortcut “handler” is fully decoupled from the shortcut “assigner”:

Typically, you define the code block for reacting to the shortcut in the AppDelegate.m. However, the view responsible for re-defining the shortcut is usually managed in another location ie. in GeneralPreferenceViewController.m.

To avoid the UX “problem” demonstrated by video, the MASShortcutView component must know about the shortcut handler and “disable” it. Or, the internal hotkey processor must know that “some” view is now editing “some” shortcut. So, fixing this would require quite deep coupling between model and view components.

One possible solution would be to manually check the editing property of the MASShortcutView in the shortcut handler block. Please let me know if I miss something, or you have an idea for a better workaround…

Hope this helps!
Vadim

from masshortcut.

pencil avatar pencil commented on August 28, 2024

The solution I have in mind is to temporary delete the shortcut from the NSUserDefaults once the user starts editing the shortcut. From what I understand, we would have to set the shortcutValue to nil. Maybe we would have to backup the original value somewhere in case the user cancels the recording. Would that work?

from masshortcut.

joeljfischer avatar joeljfischer commented on August 28, 2024

That could work, although I would worry about crashes or force quits in
this state losing the stored default. An edge case, sure, but it might
happen.
On Jul 18, 2014 7:09 AM, "Nils Caspar" [email protected] wrote:

The solution I have in mind is to temporary delete the shortcut from the
NSUserDefaults once the user starts editing the shortcut. From what I
understand, we would have to set the shortcutValue to nil. Maybe we would
have to backup the original value somewhere in case the user cancels the
recording. Would that work?


Reply to this email directly or view it on GitHub
#37 (comment)
.

from masshortcut.

shpakovski avatar shpakovski commented on August 28, 2024

@pencil I think you have to try how it works.

@joeljfischer Well, I would hope for better :)

Overall, this situation is quite interesting. Maybe there is no need to handle each shortcut this way?
For example, you set the shortcut to open the Search Panel from the status bar. Then you start editing the shortcut, press that already taken hotkey, and BOOM — the Search Panel pops up! So what? :) Now you can be sure that it is active until you hit the Delete button. I am not a user experience expert, but this sounds like quite expected behavior.

from masshortcut.

joeljfischer avatar joeljfischer commented on August 28, 2024

Personally, I would expect that while editing a shortcut, all shortcuts would be disabled, because I'm in a special "editing" mode. I would also expect it to tell me if a shortcut is already taken, whether disabled or not (I believe you already do this). I don't think a deep coupling is necessary, but a coupling of a sort may be required.

For instance, a message telling the model that a hotkey is being edited, so that the model can temporarily disable the hotkeys it knows about, or at least calling their handlers, and a message when the hotkey stops being edited, so that it can re-enable all shortcuts firing.

If that is too difficult, I can do something similar manually. I'm thinking I could observe the editing property and fire a notification when one starts being edited (and stops being edited), and use that to disable the handlers manually.

from masshortcut.

shpakovski avatar shpakovski commented on August 28, 2024

I don't think a deep coupling is necessary, but a coupling of a sort may be required.

This is a key. I do not want to couple MASShortcut and MASShortcutView at all. I like that MASShortcut has no idea about any MASShortcutView interactions.

from masshortcut.

shpakovski avatar shpakovski commented on August 28, 2024

I'm thinking I could observe the editing property and fire a notification when one starts being edited (and stops being edited), and use that to disable the handlers manually.`

Sounds great!

from masshortcut.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.