Skip to content

Show keyboard shortcut on button tooltip #1408

Description

@pedropaulosuzuki

Description
As discussed in #1404, having the keyboard shortcut appear on the button tooltip helps users to discover (or remind of) new shortcuts. We already do this for tools, so having this on the other panels (such as Layers and History) is a good idea.

Additional context
Add New Layer button showing keyboard shortcut on hover

Activity

  1. pedropaulosuzuki commented on May 3, 2025

    @pedropaulosuzuki
    ContributorAuthor

    Maybe we could even have an additional line for displaying action names (mainly for scripting), like Blender does. Might be too specific tho.

    Image

    Image

    This would only require adding "\n\nAction: " + action.Name to CreateToolBarItem(), so this addition wouldn't be that difficult.

  2. cameronwhite commented on May 5, 2025

    @cameronwhite
    Member

    Adding the Shortcut key: ... line to match how the tool buttons behave sounds good to me. I'd skip adding the Action: ... line since that seems confusing for most users who won't know what it means

    Re: the discussion in #1404, my original thinking was that CreateToolBarItem() could append the Shortcut key: ... text to the label to build the tooltip, if the command doesn't have an explicit tooltip (I'm not sure offhand which actions actually set a tooltip explicitly).
    So that avoids the construction issue and it just boils down to passing the Gtk.Application instance into CreateToolbarItem().

    But I think your suggestion of having Command take the Gtk.Application and an optional shortcut seems like it would be a cleaner API.

  3. Lehonti commented on May 7, 2025

    @Lehonti
    Contributor

    But I think your suggestion of having Command take the Gtk.Application and an optional shortcut seems like it would be a cleaner API.

    I just tried passing Gtk.Application to Command. We would end up having to pass it from the static constructor (⚠️) of PintaCore:

    • PintaCore creates ActionManager
    • ActionManager creates action bundles like EditActions, ViewActions...
    • Action bundles create Command objects

    What about passing just the shortcut info for now, and then reading it both at the call sites of AddAccelAction and the method that creates the toolbar items (CreateToolbarItem)?

  4. cameronwhite commented on May 8, 2025

    @cameronwhite
    Member

    Thanks for looking into it! That is indeed a big problem, so I think your suggestion of just storing the shortcut info sounds good for now

  5. added this to the 3.1 milestone on May 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions