0

Now that I know how to play with python fu, there are certain things I want gimp to do when started, in there a way to do this via python script?

2 Answers 2

0

Depending on what you want to do you could simply edit the gimp.desktop file in
/usr/share/applications.
Just look up the Exec=gimp-2.8 %U value and change it to something like
Exec=gimp-2.8 | python /path/to/your/script.py.

Or you can put your script in one of the gimp plugins folders at /usr/share/gimp/2.0/plug-ins or ~/.gimp-2.8/plug-ins
(obviously using replacing these version numbers with the appropriate ones for you).

This is probably the better way to go if you want to do gimp stuff with your script because it will be loaded properly when gimp starts.

1
  • This way (the second one), I'll have to click a menu item, right? Is there a way to keep this available without creating an image first?
    – Yotam
    Oct 1, 2013 at 7:55
0

You can do this by writing a wrapper for gimp as follow:

  • Get root privileges:

    sudo -i
    
  • Move gimp file in another directory which is not in any user's PATH (for example /opt- don't forget where you move it):

    mv /usr/bin/gimp-2.8 /new/path/to/gimp-2.8
    
  • Create your wrapper for gimp in /usr/bin:

    gedit /usr/bin/gimp-2.8
    

    Add the following script inside:

    #!/bin/bash
    
    #first run your executable script
    /path/to/your/script
    
    /new/path/to/gimp-2.8
    

    Save the file and close it.

  • Make the new wrapper executable:

    chmod +x /usr/bin/gimp-2.8
    
  • Logout from root session:

    exit
    

Next, when you will start gimp, /path/to/your/script will be run first.

2
  • I want the script to do something within gimp. My question wasn't clear enough probably.
    – Yotam
    Oct 1, 2013 at 7:53
  • Ok, this was a very simple example how you can do it. You can replace that wrapper script as you wish, even with your script if this in the end opens gimp. Oct 1, 2013 at 7:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .