How to Modify the PhotoGIMP shortcutsrc File Directly
You can directly customize PhotoGIMP's keyboard shortcuts by editing the shortcutsrc file in GIMP's configuration directory using GIMP's RC syntax with (action "name" "shortcut") expressions.
PhotoGIMP, an open-source project by Diolinux that brings Photoshop-style shortcuts to GIMP, stores its keyboard mappings in a plain-text shortcutsrc file. While GIMP provides a GUI for shortcut editing, directly modifying this configuration file allows for bulk changes, version control, and customization of shortcuts not exposed in the interface.
Locate the shortcutsrc File on Your System
The shortcutsrc file resides in GIMP's user configuration directory, with the specific path varying by operating system:
- Linux:
~/.config/GIMP/3.0/shortcutsrc - Windows:
%APPDATA%\GIMP\3.0\shortcutsrc - macOS:
~/Library/Application Support/GIMP/3.0/shortcutsrc
In the PhotoGIMP repository, the default template is located at ./.config/GIMP/3.0/shortcutsrc. When you install PhotoGIMP, this file populates your local GIMP configuration, establishing the Photoshop-style keybindings documented in the project's [README.md](https://github.com/Diolinux/PhotoGIMP/blob/master/README.md) around line 176.
Understand the shortcutsrc File Format
The shortcutsrc file uses GIMP RC syntax, a Lisp-like format where each shortcut mapping follows this pattern:
(action "action-name" "key-combination")
action-name: The internal GIMP command identifier (e.g.,edit-undo,layers-duplicate).key-combination: Uses modifier placeholders and literal keys:<Primary>represents Ctrl on Linux, Cmd on macOS, and the Windows key on Windows.<Shift>and<Alt>represent their respective modifier keys.- Literal keys (e.g.,
s,F1,Page_Down) are written directly.
Lines beginning with # are comments and are ignored by GIMP, allowing you to disable mappings by commenting them out.
Step-by-Step Guide to Editing shortcutsrc
Follow these steps to safely modify your PhotoGIMP shortcuts directly:
-
Back up the original file before making changes:
cp ~/.config/GIMP/3.0/shortcutsrc ~/.config/GIMP/3.0/shortcutsrc.backup -
Open the file in your preferred text editor (VS Code, nano, Vim, or Notepad).
-
Locate the action you want to modify or add. Use GIMP's internal action names (visible in Edit → Keyboard Shortcuts when hovering over commands).
-
Modify an existing entry by changing the second string. For example, to change the Undo shortcut to Ctrl+U:
(action "edit-undo" "<Primary>u") -
Add new shortcuts by inserting new lines. To assign Ctrl+Shift+D to Duplicate Layer:
(action "layers-duplicate" "<Primary><Shift>d") -
Save the file and close your editor.
-
Restart GIMP or reload shortcuts via Edit → Keyboard Shortcuts → Refresh to apply your changes.
Practical shortcutsrc Modifications
Here are concrete examples you can copy directly into your shortcutsrc file:
Change the Save Shortcut to Ctrl+Alt+S
Replace the default Ctrl+S with Ctrl+Alt+S:
# Modified save shortcut
(action "file-save" "<Primary><Alt>s")
Add a Shortcut for New Layer from Visible
Assign Ctrl+Shift+N to the New from Visible layer command:
(action "layer-new-from-visible" "<Primary><Shift>n")
After saving and restarting GIMP, verify these mappings by searching for the action names in Edit → Keyboard Shortcuts.
Summary
- PhotoGIMP stores its Photoshop-style shortcuts in the
shortcutsrcfile located in GIMP's configuration directory. - The file uses
(action "name" "shortcut")syntax with modifiers like<Primary>,<Shift>, and<Alt>. - You can modify the file directly to bulk-edit shortcuts, add custom bindings, or override defaults not exposed in the GUI.
- Always back up your
shortcutsrcbefore editing, and restart GIMP to apply changes. - The source template is maintained in the Diolinux/PhotoGIMP repository at
.config/GIMP/3.0/shortcutsrc.
Frequently Asked Questions
Where does PhotoGIMP store the shortcutsrc file on Windows?
On Windows systems, the shortcutsrc file is located at %APPDATA%\GIMP\3.0\shortcutsrc. You can paste this path into File Explorer's address bar to navigate directly to the file, then open it with Notepad or any text editor to modify PhotoGIMP's keyboard shortcuts.
What does the <Primary> modifier represent in the shortcutsrc file?
The <Primary> placeholder maps to Ctrl on Linux, Cmd on macOS, and the Windows key on Windows systems. This allows the shortcutsrc file to remain portable across operating systems while maintaining consistent physical key positions for core shortcuts like saving, undoing, and copying.
Can I comment out shortcuts instead of deleting them?
Yes, you can disable any shortcut by adding a # at the beginning of the line. GIMP ignores lines starting with #, allowing you to preserve the original syntax for reference or easily re-enable mappings later without searching through git history or backups.
Why do my shortcutsrc changes not appear in GIMP?
Changes to the shortcutsrc file require a GIMP restart to take effect, or you can reload them without restarting by opening Edit → Keyboard Shortcuts and clicking the Refresh button. If changes still don't appear, ensure you saved the file in plain text format and used correct GIMP action names and syntax.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →