Xinerama workspace sorting for dynamicLogWithPP

Hello,
Attached is a darcs patch useful mainly for users using xinerama
(multiple screens). It adds xinerama sorting algorithm for sorting
workspace identifiers done in dynamicLogWithPP. After applying the
patch, you need to modify your PP in xmonad.hs, e.g:
myPP = defaultPP {
-- your previous PP settings
, ppSort = getSortByXineramaRule
}
Regards,
Juraj
New patches:
[Extended PP with sorting algorithm specification and added xinerama sorting
Juraj Hercek

Hi Juraj,
Could you please resend this patch as an attachment rather than pasted into
the body of the e-mail?
Thanks!
-Brent
2008/1/9 Juraj Hercek
Hello,
Attached is a darcs patch useful mainly for users using xinerama (multiple screens). It adds xinerama sorting algorithm for sorting workspace identifiers done in dynamicLogWithPP. After applying the patch, you need to modify your PP in xmonad.hs, e.g:
myPP = defaultPP { -- your previous PP settings , ppSort = getSortByXineramaRule }
Regards, Juraj
New patches:
[Extended PP with sorting algorithm specification and added xinerama sorting Juraj Hercek
**20080109154923 algorithm - idea is to specify sorting algorithm from user's xmonad.hs - xinerama sorting algorithm produces same ordering as pprWindowSetXinerama - default ppSort is set to getSortByTag, so the default functionality is the same as it was before ] { hunk ./XMonad/Hooks/DynamicLog.hs 111 - sort' <- getSortByTag + sort' <- ppSort pp hunk ./XMonad/Hooks/DynamicLog.hs 203 + , ppSort :: X ([WindowSpace] -> [WindowSpace]) hunk ./XMonad/Hooks/DynamicLog.hs 219 + , ppSort = getSortByTag hunk ./XMonad/Util/WorkspaceCompare.hs 12 -module XMonad.Util.WorkspaceCompare ( getWsIndex, getWsCompare, getSortByTag ) where +module XMonad.Util.WorkspaceCompare ( getWsIndex + , getWsCompare + , getSortByTag + , getSortByXineramaRule ) where hunk ./XMonad/Util/WorkspaceCompare.hs 21 +import Data.Ord +import Data.Maybe hunk ./XMonad/Util/WorkspaceCompare.hs 36 - where - f Nothing Nothing = EQ - f (Just _) Nothing = LT - f Nothing (Just _) = GT - f (Just x) (Just y) = compare x y + where + f Nothing Nothing = EQ + f (Just _) Nothing = LT + f Nothing (Just _) = GT + f (Just x) (Just y) = compare x y + +-- | A comparison function for Xinerama based on visibility, workspace and +-- screen id. It produces same ordering as pprWindowSetXinerama does. +getXineramaWsCompare :: X(WorkspaceId -> WorkspaceId -> Ordering) +getXineramaWsCompare = do + w <- gets windowset + return $ \ a b -> case (isOnScreen a w, isOnScreen b w) of + (True, True) -> comparing (tagToSid (onScreen w)) a b + (False, False) -> compare a b + (True, False) -> LT + (False, True) -> GT + where + onScreen w = S.current w : S.visible w + isOnScreen a w = a `elem` map (S.tag . S.workspace) (onScreen w) + tagToSid s x = S.screen $ fromJust $ find ((== x) . S.tag . S.workspace) s + --S.screen $ head $ filter ((== x) . S.tag . S.workspace) s hunk ./XMonad/Util/WorkspaceCompare.hs 64 +-- | Sort serveral workspaces for xinerama displays +getSortByXineramaRule :: X ([WindowSpace] -> [WindowSpace]) +getSortByXineramaRule = do + cmp <- getXineramaWsCompare + return $ sortBy (\a b -> cmp (S.tag a) (S.tag b)) + + } Context:
[Correct caps in module header. Joachim Fasting
**20071230061920] [Use LANGUAGE pragma. Joachim Fasting **20071230061817] [shiftPrevScreen and shiftNextScreen, to make CycleWS consistent mail@joachim-breitner.de**20071231171609] [formatting Don Stewart **20071204174920] [PerWorkspace.hs: add an explanatory note Brent Yorgey **20071231135806] [Add ShowWName a layout modifier to show the workspace name Andrea Rossato **20071231130441 This module requires dzen ] [ManageDocks: some documentation fixes Andrea Rossato **20071231101820] [-Wall police (again) Spencer Janssen **20071228061841] [-Wall police Spencer Janssen **20071228061822] [Fulfill the EWMH specification by listing the supported ATOMs, doesnt really make a differene AFAIK mail@joachim-breitner.de**20071227215607] [display all visible windows on the current desktop in the pager mail@joachim-breitner.de**20071227204349 This is my best shot at modeling xmonad's WM behaviour in a way that the Extended Window Manager Hints specification allows. Unfortunately, we can not tell the panel what size and position it should think the apps are. ] [Although I do not need the curr variable after all, this is nicer mail@joachim-breitner.de**20071227190113] [Add support for cycling through screens to CycleWS mail@joachim-breitner.de**20071227182635] [Clear _NET_ACTIVE_WINDOW when nothing is focused mail@joachim-breitner.de**20071228154222] [textExtentsXMF doesn't require the display Andrea Rossato
**20071228125913] [Don't bother checking executable bits of items in $PATH, yields a significant speed-up Spencer Janssen **20071226032412] [ResizableTile.hs: fix resizing to work in the presence of floating windows (resolves issue #100) Brent Yorgey **20071225135839] [LayoutScreens: haddock fixes Andrea Rossato **20071225105316] [XMonad.Actions.Search: haddock fix Andrea Rossato **20071224171115] [Fix isssue 105 Andrea Rossato **20071224171020 issue 105 was due to the fact that tab windows created when bootstrapping the windowset after a restart where managed. Setting the override_redirect attributes to True fixes the issue. Added the possibility to set the override_redirect attribute with XMonad.Util.XUtils.creationNewWindow ] [Prompt.hs: mv .xmonad_history into .xmonad/ gwern0@gmail.com**20071224054610 See my email to mailing list. This will slightly break anyone who upgrades while running and expects to see their prompt history, and leave a stray file, I think, but nothing else, and it'll permanently improve tab-completion, and is tidier. ] [Search.hs: +docs, and export simpleEngine so users can define their own gwern0@gmail.com**20071224043828] [Search.hs: mv into Actions/ per IRC suggestion gwern0@gmail.com**20071224043735] [add XMonad.Actions.NoBorders Lukas Mai
**20071220203953] [AvoidStruts: add support for partial struts Spencer Janssen **20071222133425] [Search.hs: add hoogle Brent Yorgey **20071222184912] [ManageDocks: ignore desktop windows also Spencer Janssen **20071222113808] [Wibble Spencer Janssen **20071222110641] [EwmhDesktops: add _NET_ACTIVE_WINDOW support Spencer Janssen **20071222110552] [A few short comments for WorkspaceCompare Spencer Janssen **20071222105045] [EwmhDesktops: drop 'Workspace' from displayed workspace names Spencer Janssen **20071222104559] [Factor workspace sorting into a separate module Spencer Janssen **20071222104114] [No more tabs Spencer Janssen **20071222050439] [Refactor Search.hs Spencer Janssen **20071222044714] [Generalize XSelection functions to MonadIO Spencer Janssen **20071222044514] [Search.hs: +imdb & amazon engines for unk_red gwern0@gmail.com**20071222035837] [Search.hs: cleanup and refactor gwern0@gmail.com**20071220174001] [Update various restart bindings Spencer Janssen **20071219220634] [Fix typo. Roman Cheplyaka **20071219073857] [Doc/Developing.hs: add some information about Haddock documentation. Brent Yorgey **20071219215300] [require haddock documentation to build successfully in order to record a patch. Brent Yorgey **20071219215217] [Remove inaccurate comment about 'banish' Spencer Janssen **20071217231540] [Warp.hs: haddock fixes Brent Yorgey **20071217224712] [Warp.hs: +doc gwern0@gmail.com**20071216030015 Describe how to emulate Ratpoison's 'banish' functionality on one's config ] [Util/Search.hs: a few updates/fixes Brent Yorgey **20071217222930 * fix shadowing warning (ghc 6.8.2 complains) * export a few more of the functions * re-de-obfuscate generated URLs by not escaping alphanumerics or punct. ] [Util.Search: import escapeURIString, and fall back on the ugly const false hack to avoid copy-pasting even more gwern0@gmail.com**20071215211638] [update Config.Droundy to use a few nice hooks. David Roundy **20071216185653] [Add UrgencyHook support to Tabbed Shachaf Ben-Kiki **20071215171617] [DynamicLog.hs: some documentation updates. Brent Yorgey **20071215143727] [DynamicLog.hs: fix shadowing warning Brent Yorgey **20071215143227] [Add UrgencyHook support to DynamicLog Shachaf Ben-Kiki **20071214043528 Someone with Xinerama should look at this -- I don't know exactly how that should behave. ] [Depend on X11-1.4.1, it has crucial bugfixes Spencer Janssen **20071215022151] [Remove network dependency, potentially breaking XMonad.Util.Search Spencer Janssen **20071214231859] [Search.hs: fix shadowing warning and haddock errors Brent Yorgey **20071214163119] [+cabal support for XMonad.Util.Search gwern0@gmail.com**20071213205654] [+XMonad.Util.Search: new module gwern0@gmail.com**20071213205159 This module is intended to provide helpful functions for easily running web searchs; just hit a bound key, enter your query, and up opens a new tab/browser/window with the search results. In theory anyway; the Wikipedia and Google ones work fine for me, but the Internet Archive's docs on how to do don't necessarily seem to be correct. If you were, like me, previously running shell commands to call Surfraw or similar shell scripts to do the same thing, you can now scrap them and replace them. There aren't too many search engines defined here; new ones would be good, and they're easy to add! ] [Add support for _NET_WM_STRUT_PARTIAL Spencer Janssen
**20071213021704] [ManageDocks: when there are struts on opposing edges, the right/bottom strut Spencer Janssen **20071210021030 was ignored. TODO: quickchecks ] [Run.hs: fix documentation, cleanup whitespace "Valery V. Vorotyntsev" **20071212091516] [Man.hs: input speedup "Valery V. Vorotyntsev" **20071212090256 Descend manpage directories once -- when `manPrompt' is called. (Previous version used to search directories upon each character arrival.) ] [new XMonad.Hooks.ManageHelpers module Lukas Mai
**20071211183040] [Magnifier: custom zoom ratio for magnifier' too intrigeri@boum.org**20071211015554] [Magnifier.hs: minor haddock fixes Brent Yorgey **20071211011154] [fix haddock on Magnifier tim.thelion@gmail.com**20071210231942] [Custom zoom levels for magnifier tim.thelion@gmail.com**20071208230844] [TAG 0.5 Spencer Janssen **20071209233056] Patch bundle hash: 1a9bcd0514d272b8693904b8072119ce00553c1d _______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad

Hi Brent, Actually, I've sent it as attachment first time. Maybe it's my mail client/server that put it into body of e-mail, not sure. Because I don't know whether attaching it again to this e-mail would solve the problem, I've put the patch on web site, you can download it here: https://www.hck.sk/haskell/xinerama_sort_darcs_patch.txt It will live there at least couple of weeks. If you have any troubles getting it, just let me know. Thanks, Juraj Brent Yorgey wrote:
Hi Juraj,
Could you please resend this patch as an attachment rather than pasted into the body of the e-mail?
Thanks! -Brent
2008/1/9 Juraj Hercek
: Hello,
Attached is a darcs patch useful mainly for users using xinerama (multiple screens). It adds xinerama sorting algorithm for sorting workspace identifiers done in dynamicLogWithPP. After applying the patch, you need to modify your PP in xmonad.hs, e.g:
myPP = defaultPP { -- your previous PP settings , ppSort = getSortByXineramaRule }
Regards, Juraj
New patches:
[Extended PP with sorting algorithm specification and added xinerama sorting Juraj Hercek
**20080109154923 algorithm - idea is to specify sorting algorithm from user's xmonad.hs - xinerama sorting algorithm produces same ordering as pprWindowSetXinerama - default ppSort is set to getSortByTag, so the default functionality is the same as it was before ... [TAG 0.5 Spencer Janssen
**20071209233056] Patch bundle hash: 1a9bcd0514d272b8693904b8072119ce00553c1d _______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad

On Wed, Jan 30, 2008 at 2:12 AM, Juraj Hercek
Hi Brent,
Actually, I've sent it as attachment first time. Maybe it's my mail client/server that put it into body of e-mail, not sure. Because I don't know whether attaching it again to this e-mail would solve the problem, I've put the patch on web site, you can download it here:
https://www.hck.sk/haskell/xinerama_sort_darcs_patch.txt
It will live there at least couple of weeks. If you have any troubles getting it, just let me know.
Applied, thanks.
participants (2)
-
Brent Yorgey
-
Juraj Hercek