Commits

anekos  committed da7d0f3

Hint chars are sorted by the position.

  • Participants
  • Parent commits c71c413

Comments (0)

Files changed (1)

File lib/Anekos/HitAHint.hs

 
 import Control.Monad (when, forM_)
 import Control.Monad.Fix (fix)
-import Data.List (isPrefixOf, sort, intersect, nubBy)
+import Data.List (isPrefixOf, sort, intersect, nubBy, sortBy)
+import Data.Ord (comparing)
 import XMonad
 import qualified XMonad.StackSet as SS
 import XMonad.Util.Font (initXMF, textWidthXMF, textExtentsXMF, releaseXMF, Align(..))
 cmpwi a b = snd a == snd b
 
 
+sortByPos = sortBy $ comparing $ \(_, (x, y, _, _)) -> [x, y]
+
+
 showWindowHints :: HAHConfig -> (Window -> X ()) -> X ()
 showWindowHints c f = do
     XConf { display = dpy, theRoot = rootw } <- ask
     vis <- gets (concatMap screenWindows . SS.visible . windowset)
     (_, _, qws) <- io $ queryTree dpy rootw
     wis <- mapM (withWindowInfo dpy) (cur ++ vis)
-    let cvs = map fst $ nubBy cmpwi wis
-        ws  = zip (hahHints c $ length cvs) $ sort cvs
+    let cvs = map fst $ sortByPos $ nubBy cmpwi wis
+        ws  = zip (hahHints c $ length cvs) cvs
     hints <- mapM (uncurry $ showHint c dpy) ws
     io $ sync dpy False
     status <- io $ grabKeyboard dpy rootw False grabModeAsync grabModeAsync currentTime