Difference between revisions of "Environment variables"

From Inkscape Wiki
Jump to: navigation, search
(Initial list of Inkscape environment variables)
 
(Section for Python (PYTHONPATH))
(One intermediate revision by the same user not shown)
Line 15: Line 15:
 
: Specifies a different location for the folder where Inkscape looks for the translation catalog (i.e. binary inkscape.mo files).
 
: Specifies a different location for the folder where Inkscape looks for the translation catalog (i.e. binary inkscape.mo files).
 
: By default this equals to something like <tt>/share/locale</tt> (*nix) or <tt>%ProgramFiles%/Inkscape/share/locale</tt> (Windows).
 
: By default this equals to something like <tt>/share/locale</tt> (*nix) or <tt>%ProgramFiles%/Inkscape/share/locale</tt> (Windows).
 
 
<!--  
 
<!--  
  
Line 27: Line 26:
  
 
-->
 
-->
 +
 +
== glib / gtk ==
 +
 +
Environment variables specific to Inkscape's core libraries and GUI toolkit. For a full list, see
 +
* [https://developer.gnome.org/glib/stable/glib-running.html Running GLib Applications] and
 +
* [https://developer.gnome.org/gtk3/stable/gtk-running.html Running GTK+ Applications] respectively
 +
 +
Particularly helpful for general debugging purposes are the environment variables that control debug output, namely glib's <code>G_MESSAGES_DEBUG</code> and gtk's <code>GTK_DEBUG</code>. Setting either of those to the special value <code>all</code> will print a lot of additional debug output to the console. Be aware that there will be ''a lot'' of output when using <code>all</code>, so you might want to fine-tune the debug options to only output information of relevant program components.
 +
 +
To trace warnings and critical debug messages, the environment variable <code>G_DEBUG</code> can prove useful. Setting it's value to <code>fatal-warnings</code> causes glib to abort the program on all warnings, i.e. the first call to either of <code>g_warning()</code> and <code>g_critical()</code>. Setting it to <code>fatal-criticals</code> will only abort on calls to <code>g_critical()</code>.
 +
 +
=== Visually debugging gtk ===
 +
 +
A very helpful way to "debug" GUI issues (like fine-tuning CSS or inspecting the individual parts of the GUI and their properties) is the [https://blog.gtk.org/2017/04/05/the-gtk-inspector/ GTK Inspector]. It can be accessed by setting the environment variable <code>GTK_DEBUG=interactive</code>
 +
 +
== Python ==
 +
 +
Environment variables specific to Python:
 +
 +
; <code>PYTHONPATH</code>
 +
: Allows you to add additional directories to the list of paths Python is searching for modules to load.
 +
: Usually there's no need to adjust this variable (Inkscape adds the system-wide extensions directory as well as the extensions directory in the user profile folder automatically). However if you're writing an extension and would like to load some modules from other locations this is an way to do this. Note that Inkscape will prepend the <code>PYTHONPATH</code> with the default module locations, so you can't use this method to override modules shipped with Inkscape.

Revision as of 19:01, 8 July 2019

This is a list of some helpful environment variables, that you can use to modify the behavior of Inkscape itself as well as of the libraries it uses.

Inkscape

Environment variables specific to Inkscape:

INKSCAPE_PROFILE_DIR
Specifies a different location for the user profile directory (i.e. the folder where preferences and user data are saved).
By default this equals to something like ~/.config/inkscape (*nix) or %appdata%/inkscape (Windows)
INKSCAPE_DATADIR
Specifies a different location for the Inkscape data directory (i.e. the system folder where Inkscape looks for shared files).
By default this equals to something like /share (*nix) or %ProgramFiles%/Inkscape/share (Windows).
Make sure there's a share/inkscape folder present in this location that contains system-wide Inkscape data like extensions, filters, gradients, icons, etc.
INKSCAPE_LOCALEDIR
Specifies a different location for the folder where Inkscape looks for the translation catalog (i.e. binary inkscape.mo files).
By default this equals to something like /share/locale (*nix) or %ProgramFiles%/Inkscape/share/locale (Windows).

glib / gtk

Environment variables specific to Inkscape's core libraries and GUI toolkit. For a full list, see

Particularly helpful for general debugging purposes are the environment variables that control debug output, namely glib's G_MESSAGES_DEBUG and gtk's GTK_DEBUG. Setting either of those to the special value all will print a lot of additional debug output to the console. Be aware that there will be a lot of output when using all, so you might want to fine-tune the debug options to only output information of relevant program components.

To trace warnings and critical debug messages, the environment variable G_DEBUG can prove useful. Setting it's value to fatal-warnings causes glib to abort the program on all warnings, i.e. the first call to either of g_warning() and g_critical(). Setting it to fatal-criticals will only abort on calls to g_critical().

Visually debugging gtk

A very helpful way to "debug" GUI issues (like fine-tuning CSS or inspecting the individual parts of the GUI and their properties) is the GTK Inspector. It can be accessed by setting the environment variable GTK_DEBUG=interactive

Python

Environment variables specific to Python:

PYTHONPATH
Allows you to add additional directories to the list of paths Python is searching for modules to load.
Usually there's no need to adjust this variable (Inkscape adds the system-wide extensions directory as well as the extensions directory in the user profile folder automatically). However if you're writing an extension and would like to load some modules from other locations this is an way to do this. Note that Inkscape will prepend the PYTHONPATH with the default module locations, so you can't use this method to override modules shipped with Inkscape.