codehenry / xmonad

Automatically exported from code.google.com/p/xmonad
0 stars 0 forks source link

Too small remembered pids hooks in XMonad.Actions.SpawnOn #523

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I use spawnOn in the startup hook because I want to run all needed programs at 
the their workspaces on window manager start. (I don't want to use manageHook 
because I may start using them on another workspaces.)
The hook looks like this:

startupHook' :: X ()
startupHook' = do
    args <- io getArgs
    -- Check for the first start
    unless ("--resume" `elem` args) $ do
        spawnOn "1" "firefox-bin"
        spawnOn "1" "deadbeef"
        spawnOn "2" "gajim"
        spawnOn "2" "thunderbird-bin"

It works great but as soon as I need more programs for startup it doesn't shift 
all of them to the right place because spawnOn remember only 5:

XMonad/Actions/SpawnOn.hs
maxPids :: Int
maxPids = 5

I tried to increase it to 20 and it keep working as supposed. So could you 
please apply it to upstream as well?
However "20" fails in this issue too: it could be too small for some people, so 
maybe it should be "100" or even we should simply strip out any restrictions on 
max number of remembered pid/hook pairs.
The only drawback that I can see in the last case: if window with remembered 
pid property will not appear, we will keep info about it in the state forever. 
But I don't think that it is a big problem.

Labels: Component-Contrib

Original issue reported on code.google.com by kag...@genshiken.org on 13 Jan 2013 at 5:34

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I've pushed patch adding a slightly incorrectly named:

manageSpawnWithGC :: ([(ProcessID, ManageHook)] -> X [(ProcessID, ManageHook)]) 
-> ManageHook

Some options for the first argument are:

f1 = return -- never delete anything old

f2 = return . take 100 -- keep 100

f3 xs = do -- keep roughly the number of processes you have
  ps <- readProcess "ps" ["u"] ""
  return (take (length (lines ps)) xs)

Original comment by vogt.a...@gmail.com on 14 Jan 2013 at 1:57

GoogleCodeExporter commented 8 years ago
That fixed the issue. Thanks.

Original comment by kag...@genshiken.org on 14 Jan 2013 at 5:30