What Is the sessionrc File in PhotoGIMP? A Complete Guide to Layout Persistence

The sessionrc file is a GIMP-specific configuration file that records window positions, dock layouts, and UI state to restore your exact PhotoGIMP workspace on restart.

PhotoGIMP, the popular Diolinux customization of GIMP, relies on the standard GIMP session management system to maintain its user interface layout. Located in .config/GIMP/3.0/sessionrc, this file captures the runtime geometry of your workspace so that every panel, dialog, and window returns exactly where you left it. Understanding how sessionrc works allows you to backup, customize, or troubleshoot your PhotoGIMP layout persistence.

What Does the sessionrc File Store in PhotoGIMP?

The sessionrc file in PhotoGIMP's configuration directory uses a Lisp-like syntax to serialize the entire UI state. When GIMP (and by extension PhotoGIMP) shuts down, it overwrites this file with current window data, then reads it on launch to reconstruct the interface.

Window Geometry and Position

The file stores absolute coordinates and dimensions for all top-level windows. In the PhotoGIMP source at .config/GIMP/3.0/sessionrc lines 8-16, you will find entries like:

(position 200 100)
(size 640 480)

These coordinates control where the main image window appears on your screen and how large it is, ensuring the canvas opens at your preferred size every time.

Dock Layout and Panel Configuration

PhotoGIMP's signature panel arrangement—tool options on the right, brushes on the left—is defined in the dock sections of sessionrc. Lines 24-48 in the source file contain gimp-dock entries that specify:

  • Which side docks appear (side right or side left)
  • Which dockable dialogs are active (such as gimp-tool-options, gimp-font-list, or gimp-brush-grid)
  • Tab styles and ordering within each dock column

This section is what makes PhotoGIMP look like PhotoGIMP rather than stock GIMP when you first launch it.

Auxiliary UI Settings

Between the window geometry and dock definitions, sessionrc stores miscellaneous layout flags in aux-info blocks. According to lines 19-22 of the PhotoGIMP configuration, these include:

  • left-docks-width and right-docks-width (e.g., "66" pixels)
  • maximized state ("no" or "yes")
  • Whether docks are currently hidden

These values ensure your sidebar widths and maximization preferences survive between sessions.

Dialog Window States

Individual floating dialogs—like the Preferences window or color palette—have their own factory-entry blocks. Lines 73-76 in sessionrc show examples such as:

(factory-entry "gimp-preferences-dialog") (position 1340 397)

This allows PhotoGIMP to reopen specific dialogs in their last-known locations if they were open when you last quit.

Global Interface Flags

At the end of the file (lines 102-103), sessionrc stores boolean flags for:

  • single-window-mode (Yes/No)
  • hide-docks (Yes/No)

These determine whether PhotoGIMP launches in single-window mode (the default) or multi-window mode, and whether docks start visible or collapsed.

How PhotoGIMP Writes and Reads sessionrc

The sessionrc file operates on a write-on-exit, read-on-startup cycle. As noted in the header comment at lines 1-6 of .config/GIMP/3.0/sessionrc, GIMP rewrites this file every time you quit the application. This means manual edits are temporary unless you modify the file while PhotoGIMP is not running.

Because PhotoGIMP is essentially a pre-configured GIMP build with custom defaults, it ships with a baseline sessionrc that establishes its characteristic layout. Once you run PhotoGIMP, your personalized window movements overwrite the defaults in your local ~/.config/GIMP/3.0/sessionrc.

Locating and Modifying the sessionrc File

You can inspect or backup your current layout persistence file using standard file operations. The file resides at:


~/.config/GIMP/3.0/sessionrc

Inspect Current Session Data

To view your layout configuration programmatically:

from pathlib import Path

session_path = Path.home() / ".config" / "GIMP" / "3.0" / "sessionrc"
print(session_path.read_text())

Force Custom Window Geometry

To preset a specific window size before launching PhotoGIMP (useful for scripting or multi-monitor setups), append a custom toplevel entry:

echo '(session-info "toplevel" (factory-entry "gimp-single-image-window") (position 50 50) (size 1200 800))' >> \
  ~/.config/GIMP/3.0/sessionrc
gimp

Important: Run this command when PhotoGIMP is closed, or your changes will be overwritten when you quit.

Relationship to Other GIMP Configuration Files

While sessionrc handles runtime geometry, PhotoGIMP uses separate files for other settings:

  • gimprc – Core preferences like theme, tool settings, and plug-in paths
  • toolrc – Current tool options and presets
  • dockrc – Default dockable dialog registrations (templates, not current state)

Only sessionrc captures the live window arrangement. According to the PhotoGIMP README.md at line 178, sessionrc is explicitly documented as the "Window layout and panel positions" file, distinguishing it from the static configuration in other RC files.

Summary

  • The sessionrc file in .config/GIMP/3.0/ is a Lisp-formatted session state file that PhotoGIMP inherits from GIMP.
  • It stores window positions, sizes, dock layouts, and dialog states to reconstruct your UI on launch.
  • PhotoGIMP writes to this file on every exit, overwriting any manual changes made while the app was running.
  • You can script modifications to force specific geometries, but only before launching the application.
  • Unlike gimprc or toolrc, sessionrc specifically handles spatial UI persistence, not tool settings.

Frequently Asked Questions

What happens if I delete the sessionrc file in PhotoGIMP?

If you delete ~/.config/GIMP/3.0/sessionrc, PhotoGIMP will regenerate it using default layout values on the next launch. You will lose any custom window positions or panel arrangements, reverting to the PhotoGIMP default layout (or GIMP's stock layout if PhotoGIMP defaults are not present).

Can I copy my sessionrc file to another computer to replicate my layout?

Yes, copying the sessionrc file to another machine's .config/GIMP/3.0/ directory (assuming the same GIMP version) will移植 your exact window positions, dock widths, and panel arrangements. However, if the screen resolution differs significantly, window coordinates may place dialogs off-screen.

Why do my manual edits to sessionrc keep disappearing?

GIMP and PhotoGIMP rewrite sessionrc every time the application closes to capture the current UI state. To preserve manual edits, you must modify the file after quitting PhotoGIMP and before launching it again. Alternatively, set the file to read-only (not recommended as it prevents saving new layouts).

How does PhotoGIMP differ from standard GIMP in its sessionrc usage?

PhotoGIMP ships with a pre-configured sessionrc file in its source repository (.config/GIMP/3.0/sessionrc) that arranges panels to resemble Adobe Photoshop's layout. Beyond this initial configuration, PhotoGIMP uses the same sessionrc mechanism as standard GIMP to persist user-specific layout changes.

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:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →