Issue 548 in xmonad: Feature request: greedyFocusWindow

Status: New Owner: ---- New issue 548 by yurac...@gmail.com: Feature request: greedyFocusWindow http://code.google.com/p/xmonad/issues/detail?id=548 It would be nice to have a greedy counterpart of the focusWindow function. I work with two screens, one of which is my main screen and the other one used occasionally. I use WindowGo.runOrRaise to focus my browser window and I expect the focusing to be greedy. Currently I use the following code (with focusWindowGreedy being a copy of focusWindow with view replaced by greedyView). If you find this relevant, I can provide a patch. Thanks! focusWindowGreedy :: (Eq s, Eq a, Eq i) => a -> W.StackSet i l a s sd -> W.StackSet i l a s sd focusWindowGreedy w s | Just w == W.peek s = s | otherwise = fromMaybe s $ do n <- W.findTag w s return $ until ((Just w ==) . W.peek) W.focusUp (W.greedyView n s) raiseGreedy :: Query Bool -> X () raiseGreedy = raiseMaybeGreedy $ return () runOrRaiseGreedy :: String -> Query Bool -> X () runOrRaiseGreedy = raiseMaybeGreedy . safeSpawnProg raiseMaybeGreedy :: X () -> Query Bool -> X () raiseMaybeGreedy f qry = ifWindow qry raiseHookGreedy f raiseHookGreedy :: ManageHook raiseHookGreedy = ask >>= doF . focusWindowGreedy browserQuery = className =? "Google-chrome" -- You received this message because this project is configured to send all issue notifications to this address. You may adjust your notification preferences at: https://code.google.com/hosting/settings

Updates: Status: Accepted Owner: vogt.a...@gmail.com Labels: Component-Core Component-Contrib Type-Enhancement Priority-Low Comment #1 on issue 548 by vogt.a...@gmail.com: Feature request: greedyFocusWindow http://code.google.com/p/xmonad/issues/detail?id=548 Yes these are useful. A good question is whether these versions/copies belong alongside the versions based on W.view, or maybe there's a better approach: It should be possible to write a function which corrects which workspaces are on each screen after some other action runs (which is slightly bad because then you have two calls to `XMonad.Operations.windows'): greedy :: X () -> X () It could do something similar to the following: greedy2 :: (Eq s, Eq i) => (W.StackSet i l1 a1 s sd1 -> W.StackSet i l a s sd) -> W.StackSet i l1 a1 s sd1 -> W.StackSet i l a s sd greedy2 f ws0 = let swap a b = W.greedyView a . W.view b s0 = W.screen $ W.current ws0 ws1 = f ws0 in if s0 == W.screen (W.current ws1) then ws1 else swap (W.currentTag ws1) (W.currentTag ws0) ws1 At least to some approximation, greedy2 . W.view == W.greedyView -- You received this message because this project is configured to send all issue notifications to this address. You may adjust your notification preferences at: https://code.google.com/hosting/settings

Comment #2 on issue 548 by yurac...@gmail.com: Feature request: greedyFocusWindow http://code.google.com/p/xmonad/issues/detail?id=548 Seems like the greedy2 function you propose is the more generic and useful solution Thanks! -- You received this message because this project is configured to send all issue notifications to this address. You may adjust your notification preferences at: https://code.google.com/hosting/settings
participants (1)
-
codesite-noreply@google.com