Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Isn't there a way to force all apps to start up minimized or make them load in the background so they won't be opened on top of the window that I'm working on, besides making the window to be always on top?

I notice lot of similar questions like this one get blindly answered with solution that involves fiddling with window rules setting in CompizConfig > General > Focus & Raise Behavior but that actually does nothing to prevent this kind of focus stealing.

share|improve this question
2  
Different applications use different flags to start minimized, and not all have this functionality. You have to look at each man page individually and hand-edit each .desktop file in ~/.local/share/applications. Are you willing to do this? If not, try using Devilspie. Some good instructions are here in this question, which is the exact opposite of yours. –  Tom Brossman Jul 15 '12 at 18:44

2 Answers 2

up vote 2 down vote accepted

Check GDevilSpie from the Software Center, here is a tutorial http://www.webupd8.org/2011/02/how-to-start-applications-minimized.html

share|improve this answer
    
That's exactly what I need! Why we can't have something like this built into Compiz by default? –  Flint Jul 16 '12 at 1:25

If you are using workspaces (called viewports in Compiz), you can use devilspie2 to open applications maximalized in a different workspace. It uses lua as its scripting language so it is quite powerfull. It does not work that well with viewports as they are technically only a section of one big workspace, so some workarounds and external tools are needed. This is a script I use to place pidign conversation to viewport 3,3 (third from the top and left) of my fullHD screen (1920×1080):

-- a helper function to capture string from external command output
function os.capture(cmd, raw)
  local f = assert(io.popen(cmd, 'r'))
  local s = assert(f:read('*a'))
  f:close()
  if raw then return s end
  s = string.gsub(s, '^%s+', '')
  s = string.gsub(s, '%s+$', '')
  s = string.gsub(s, '[\n\r]+', ' ')
  return s
end


if (get_window_class()=="Pidgin" and get_window_role()=="conversation") then
    -- get the current viewport
    vp = os.capture("xprop -root |grep '_NET_DESKTOP_VIEWPORT(CARDINAL) = ' |cut -d ' ' -f 3-4 |tr -d ','")
    -- unfortunately, the below does not work due to a bug in xdotool
    -- vp = os.capture("xdotool get_desktop_viewport")
    -- set_window_geomtery is relative to current position, it seems, so go to the left and top most vieport
    os.execute("xdotool set_desktop_viewport 0 0")
    -- set the window maximized and to viewport 3,3
    set_window_geometry(3930,2250,650,950)
    maximize()
    -- now go to the original viewport
    os.execute("xdotool set_desktop_viewport " .. vp)
end

The script depends on x11-utils and xdotool. It results in a very short flicker when the app is open. It can be eliminated by using CCSM and setting Wall sliding duration time to zero milliseconds.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.