Skip to content

Add window with catalog of keyboard shortcuts#2172

Open
robertoffmoura wants to merge 9 commits into
PintaProject:masterfrom
robertoffmoura:shortcuts-window
Open

Add window with catalog of keyboard shortcuts#2172
robertoffmoura wants to merge 9 commits into
PintaProject:masterfrom
robertoffmoura:shortcuts-window

Conversation

@robertoffmoura

Copy link
Copy Markdown
Contributor

This addresses issue 1434 by adding a dialog with all keyboard shortcuts and their actions. This dialog can be accessed via Pinta > Settings or via keyboard shortcut with ctrl + comma. The shortcuts are separated by category, such as tool shortcuts, layer shortcuts, and top bar menu items. The shortcuts are searchable by clicking the magnifying glass icon on top of the dialog.

shortcuts

@badcel

badcel commented May 27, 2026

Copy link
Copy Markdown
Contributor

Did you see that there is a special adwaita shortcut window?

https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1-latest/class.ShortcutsDialog.html

@robertoffmoura

Copy link
Copy Markdown
Contributor Author

ShortcutsDialog was introduced in Adw 1.8, but it looks like Pinta requires libadwaita 1.7+. Would it be OK to update the minimum version requirement of Adw to 1.8?

@JGCarroll

Copy link
Copy Markdown
Contributor

Libadwaita 1.8 would prevent making .deb packages for Debian 13, which isn't done officially anyway, but could knock on any third party repos that might wish to do so.

If we were to update Libadwaita, we might as well update Libgtk alongside it; if Debian 13 stops being supportable directly, it'd make sense to pin the requirements to match Ubuntu 26.04 instead which has Libadwaita 1.9 and GTK 4.22, other distributions are generally rolling release already or have a much faster release cycles in general (e.g., technically Pinta wouldn't support Fedora 43 either, but Flatpak exists and 43 will be EOL by November; Debian 13 is likely the only "real" loss).

This assumes that Flatpak/Snap runtimes are updated with those libraries, Snap isn't quite ready yet, Flatpak I don't know directly but expect is probably fine, by the time Pinta 3.2 releases I wouldn't expect either to be lacking support.

@cameronwhite

Copy link
Copy Markdown
Member

I'd be fine with bumping the required version as long as snap supports or will soon support it - snap & flatpak compatibility is the main mandatory requirement, although being able to build on Ubuntu and other recent distros is a nice bonus.

The other option here would be using https://docs.gtk.org/gtk4/class.ShortcutsWindow.html which would work as-is (I assume its deprecation is because the Adw.ShortcutsDialog will replace it)

@cameronwhite cameronwhite left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dialog looks good! Just left a few comments with some suggestions

return;

Adw.ShortcutsSection section = new ();
section.Title = Translations.GetString (title);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Translations.GetString() needs to be called with a string literal, e.g. Translations.GetString("File"), otherwise this won't be picked up by the tools which build the translation template (https://github.com/PintaProject/Pinta/wiki/Translations)

So here it's likely better to pass an already translated string into this function

Translations.GetString ("About"),
null,
Resources.StandardIcons.HelpAbout);
Preferences = new Command (

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The labels for this dialog are fairly inconsistent ("Preferences" vs "Keyboard Shortcuts", and on macOS this also instead shows up under "Settings" in the app menu - that must be some GTK behaviour based on the action name?)

I'd propose just using "Keyboard Shortcuts" since this dialog only shows shortcuts and doesn't configure any preferences - leaving room for an actual preferences dialog is something we might want in the future

"preferences",
Translations.GetString ("Keyboard Shortcuts"),
null,
"preferences-system-symbolic",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Icons should be added to the appropriate list of constants (e.g. StandardIcons) so they're easier to change in the future, although the icons are really only used for toolbar buttons currently

{
app.AddCommands ([
About,
Preferences,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For platforms other than macOS, I think you'll need to also register a menu item separately since there isn't a global application menu - see HelpActions.cs for how the About item is handled).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants