DistributedProofreaders / guiguts-py

Guiguts rewrite using Python/tkinter
GNU General Public License v2.0
2 stars 7 forks source link

Idea: command palette #135

Open tangledhelix opened 6 months ago

tangledhelix commented 6 months ago

133 got me thinking about keyboard shortcuts and where we should and should not be using them. I think I'll err on the side of "no shortcuts" for that use-case, in the spirit of the Apple HIG viewpoints:

  1. Support keyboard-only interaction when possible
  2. Don't re-purpose standard shortcuts
  3. Define custom shortcuts only for the most common actions (emphasis mine)
  4. Prefer Cmd, then Shift+Cmd. Use Opt only sparingly. Avoid Ctrl whenever possible.

Having fewer shortcuts avoids overloading people, since there is less to memorize in an app. But GG1 has a lot of menu items, and thus we can expect GG2 will eventually have many menu items.

Perhaps we can follow a command-palette model to make the commands findable via keyboard-only interaction, and also more findable in general.

Brief description of a command palette for those not familiar with the term:

Example: type "low" into palette and it might locate the "lowercase selection" command. Or type "proofer" or "comment" to choose the "Find Next Proofer Comment" or "Find Previous Proofer Comment" commands. The entire catalog of available commands could be available.

To improve discoverability, it wouldn't be a bad idea to have a visible button on the window that triggers the palette, and perhaps some sort of tooltip text to hint what to do next when it appears.

tangledhelix commented 6 months ago

Further thoughts:

windymilla commented 6 months ago

Palette idea is interesting - I hadn't come across it, but just downloaded the NppMenuSearch plugin, which effectively provides that feature for Notepad++, so I can have a play with it. It adds a permanent text field to the immediate right of the toolbar where you can search for menu or preference options: image

Since every command would then have to have a unique "name", e.g. "Uppercase Selection" (maybe the text from the menu entry), that would also potentially allow the future ability for user-defined shortcut keys. A shortcut can be multiple keystrokes, so the user could pick more or less any keystroke to follow after an introductory one, e.g. Ctrl+u, Ctrl+t could mean "User shortcut", "Title case". Similarly, it would be quite easy to allow the user to configure the Context menu, if that were desirable.

windymilla commented 6 months ago
  • Fewer shortcut keys would probably help us to keep the entire shortcut key set more consistent among platforms (modulo the typical Cmd vs Ctrl thing)

We'd need to think about the pros and cons of consistent shortcut keys: it would make documentation and discussion about GG easier, but most users (particularly the less-techy ones) only use one platform, so we may want to avoid subverting a shortcut they are used to in other apps. For example, when I saw the suggestion for Ctrl+p for palette, my immediate thought was "Print", which is what Ctrl+p does in many Windows apps (though not relevant to GG).

  • If we encourage this model we could probably move away from the ~ letter thing in the menus, which appears to not be available on all platforms anyway

It's very common in Windows apps, like NP++, Chrome, Libre Office, etc., so unless it causes problems, it may be more friendly for Windows users if we retain it. Something to consider though.

srjfoo commented 6 months ago

For example, when I saw the suggestion for Ctrl+p for palette, my immediate thought was "Print", which is what Ctrl+p does in many Windows apps (though not relevant to GG).

Ditto -- Cmd+p on macOS, I ordinarily associate with print.

  • If we encourage this model we could probably move away from the ~ letter thing in the menus, which appears to not be available on all platforms anyway

It's very common in Windows apps, like NP++, Chrome, Libre Office, etc., so unless it causes problems, it may be more friendly for Windows users if we retain it. Something to consider though.

I think I finally figured out (or @windymilla pointed me at) fn+F10 to trigger that, but I find it so awkward that I'd rather actually go to the menu. (Perhaps that's just because of lack of experience.)


I have mixed feelings about the ~ shortcuts, and trying to provide what's in gg1 in gg2. In general, I think trying to make them operate the same is likely to be an exercise in frustration. ("That way lies madness"?)

Would it be worth opening a discussion in the forums asking PPers which shortcuts they think are most important? If there are some that nobody mentions, leave them out to begin with.

I like the idea of allowing user-defined shortcuts, which could mitigate missing shortcuts from above. Photoshop, BBEdit, and even macOS (on a limited scale) allow this. I'm sure there are others, but those are the ones that I am most familiar with.

I also liked the tear-off menus, especially for those things I'm not familiar with the exotic shortcuts for. Though if there are menu items that will pop out a box of options (like preferences) that's a good alternative.

tangledhelix commented 6 months ago

We'd need to think about the pros and cons of consistent shortcut keys: it would make documentation and discussion about GG easier, but most users (particularly the less-techy ones) only use one platform, so we may want to avoid subverting a shortcut they are used to in other apps. For example, when I saw the suggestion for Ctrl+p for palette, my immediate thought was "Print", which is what Ctrl+p does in many Windows apps (though not relevant to GG).

As you and Sharon both pointed out, it's usually for Print, but this particular feature is most often used in apps where people are probably not printing (I see it mostly in code editors, although I've seen it elsewhere). In any case, we could use any trigger key we like, or even let the user choose.

tangledhelix commented 6 months ago

I have mixed feelings about the ~ shortcuts, and trying to provide what's in gg1 in gg2. In general, I think trying to make them operate the same is likely to be an exercise in frustration. ("That way lies madness"?)

Agreed.

I also liked the tear-off menus, especially for those things I'm not familiar with the exotic shortcuts for. Though if there are menu items that will pop out a box of options (like preferences) that's a good alternative.

I'm not sure it's even possible on Mac with the shared menu bar, which tkinter is using. We'd need to create our own widget to do something like that (I assume). I believe it was only possible (for Mac, if not for others) in GG1 because it was built on top of the X11 system.

srjfoo commented 6 months ago

I'm not sure it's even possible on Mac with the shared menu bar, which tkinter is using. We'd need to create our own widget to do something like that (I assume). I believe it was only possible (for Mac, if not for others) in GG1 because it was built on top of the X11 system.

I obviously expressed myself poorly. I think that menu items that pop out a dialog box can be a reasonablle substitute. (I have just started reading in the BBEdit manual for the new version and seen multiple instances of "you can't do it that way anymore, and it's mostly because Apple won't let us"....)

windymilla commented 6 months ago

I've posted in Slack for a slightly wider audience on this.