(Update: ok, so I posted this quickly without having used it a lot. I don’t use the Gimp much anyway, so this mostly meets my needs, but it does have issues. If I get motivated to look into them, I’ll update with a fix if I can.)

I just came up with an xmonad layout for gimp that I like quite a bit, so I have to share it… it uses the IM layout (twice) combined with the Full layout to get tools on each side of the screen, with images taking up the whole space between them. Here’s the code (updated to include requirements, etc):

import XMonad.Layout.IM
import XMonad.Layout.PerWorkspace
import XMonad.Layout.Reflect

main = do
  xmonad defaultConfig
    { layoutHook = onWorkspace "gimp" gimp }
    where
      gimp = withIM (0.11) (Role "gimp-toolbox") $
             reflectHoriz $
             withIM (0.15) (Role "gimp-dock") Full

You’ll probably want to change the widths assigned to the two IM docks to fit your screen, but those settings work nicely for me on a 1920×1200 24″ screen. Here’s a shot of it (click for a full-size view):

My xmonad layout for gimp

My xmonad layout for gimp

Loading image

Click anywhere to cancel

Image unavailable


16 Comments on “Xmonad and the Gimp”

You can track this conversation through its atom feed.

  1. Felipe says:

    Awesome!

  2. Porges says:

    I'd like a way for XMonad to start a new workspace when a program is detected to be running; e.g. starting gimp creates the "gimp" workspace and sets it up like this.

    Possible?

  3. Nathan says:

    Porges, yes that's possible. I just got that working recently with much help from sereven in the #xmonad irc channel. The main bit of code that makes it work came from the Scratchpad module. Here's the key stuff from my manageHook:

    import XMonad.Actions.DynamicWorkspaces

    myManageHook = composeAll [ className =? "Gimp-2.6" --> doNewWS "gimp" ]
    where
    doNewWS tg = (liftX $ addUniqueHiddenWS tg) >> doShift tg
    addUniqueHiddenWS tg = withWindowSet $ s ->
    if null (filter ( (== tg) . W.tag) (W.workspaces s))
    then addHiddenWorkspace tg
    else return()

    You can change addHiddenWorkspace to addWorkspace to switch to the workspace when creating it.

    (Sorry, can't seem to make these intense debate comments preserve indenting)

  4. richard says:

    doesnt work nicely with simpleFloat – tags move in one direction while you move the window in another.

  5. Weeble says:

    I tried this, but I have problems any time there are multiple image windows. When I move the mouse cursor between windows the first image pops in front of whichever one is currently showing. Is there some way to prevent this?

  6. Tobi says:

    Is it possible to set the width of the tools to something like "detect automatically" so that it could be used on any screen sizes?

  7. JamesD says:

    Thanks for the useful info. It’s so interesting

  8. Eric Kow says:

    Here's a small variant with thanks to aavogt on #xmonad.

    The goal was to avoid committing myself to dedicated "gimp" workspace — I don't just gimp *that* often — but also to avoid a lot of fancy hackery as I didn't understand the DynamicWorkspaces stuff.

    Solution: omit the (onWorkspace "gimp") and change Full to (layoutConfig defaultConfig). This means that all non-gimp windows continue behaving normally, but wherever I launch gimp, I get the nice toolboxes.

  9. Nick says:

    Very cool post and comments.

    The above highlights one of the core strengths of xmonad. You can really mold it and adapt it to your workflow and needs. Yes it might get tricky in the configuration sometimes but there are very few things you can't do.

    On the other hand the basic defaults are a joy to use. As I said many times, things become effortless. I'll definitely use all this for gimp as well, coool!!

    Now here's why since I also use a Mac, I am working on a tiling window manager for OSX based on enso (http://code.google.com/p/enso/) which I aptly named, effortless. :D

    Nick

  10. Nathan says:

    Thanks for the comments and tips, guys. Xmonad is indeed excellent. I've had to work on windows boxes more often lately and I sure miss it.

  11. Eric Kow says:

    Whoops! In case anybody's windows got reversed by this, adding a second reflectHoriz should do the trick.

    Now I have:

    myLayout = withIM (0.11) (Role "gimp-toolbox") $ reflectHoriz

    $ withIM (0.15) (Role "gimp-dock") $ reflectHoriz

    $ layoutHook defaultConfig

  12. yac says:

    IM layout worked fine, but one day it mysteriously started doing what you describe. Try combineTwoP combinator. I use:

    combineTwoP (TwoPane 0.03 0.15) (myTabs) (reflectHoriz $ combineTwoP (TwoPane 0.03 0.2) myTabs (myTabs ||| Grid) (Role "gimp-dock")) (Role "gimp-toolbox")

  13. Jonathan says:

    Thanks, this was really useful. I am using gnomeConfig so I had to add desktopLayoutModifiers $ to the layouthook line just after the = so that the panels aren't covered (import XMonad.Config.Desktop is also needed).

  14. zak says:

    Thanks for this! I’m in the process of tweaking my xmonad.hs and this was one of the things I had been trying to figure out… without success :P

  15. Bruno says:

    Can anybody come with the final merge between the Gimp setup and the basic gnomeConfig?

    I only have this:

    import XMonad
    import XMonad.Config.Gnome

    main = xmonad gnomeConfig

    What I want is to have gimp loaded on my last workspace (9)

  16. JaMeSiTeGeN says:

    Can you please re-post/edit this with a link to a text-pastie site such as http://sprunge.us/

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>