<commit_before>-----------------------------------------------------------------------------
-- |
-- Module      :  XMonadContrib.DwmPromote
-- Copyright   :  (c) <NAME> 2007
-- License     :  BSD3-style (see LICENSE)
--
-- Maintainer  :  <EMAIL>
-- Stability   :  unstable
-- Portability :  unportable
--
-- Dwm-like swap function for xmonad.
-- 
-- Swaps focused window with the master window. If focus is in the
-- master, swap it with the next window in the stack. Focus stays in the
-- master.
--
-----------------------------------------------------------------------------

module XMonadContrib.DwmPromote (
                                 -- * Usage
                                 -- $usage 
                                 dwmpromote
                                ) where

import XMonad
import Operations (windows)
import StackSet

-- $usage
--
-- To use, modify your Config.hs to:
--
-- >    import XMonadContrib.DwmPromote
--
-- and add a keybinding or substitute promote with dwmpromote:
--
-- >   , ((modMask,               xK_Return), dwmpromote)

-- %import XMonadContrib.DwmPromote
-- %keybind , ((modMask,               xK_Return), dwmpromote)

dwmpromote :: X ()
dwmpromote = windows swap

swap :: StackSet i a s sd -> StackSet i a s sd
swap = modify' $ \c -> case c of
    Stack _ [] []     -> c
    Stack t [] (x:rs) -> Stack x [] (t:rs)
    Stack t ls rs     -> Stack t [] (ys ++ x : rs) where (x:ys) = reverse ls<commit_msg>cleanup in DwmPromote.<commit_after>-----------------------------------------------------------------------------
-- |
-- Module      :  XMonadContrib.DwmPromote
-- Copyright   :  (c) <NAME> 2007
-- License     :  BSD3-style (see LICENSE)
--
-- Maintainer  :  <EMAIL>
-- Stability   :  unstable
-- Portability :  unportable
--
-- Dwm-like swap function for xmonad.
-- 
-- Swaps focused window with the master window. If focus is in the
-- master, swap it with the next window in the stack. Focus stays in the
-- master.
--
-----------------------------------------------------------------------------

module XMonadContrib.DwmPromote (
                                 -- * Usage
                                 -- $usage 
                                 dwmpromote
                                ) where

import XMonad
import Operations (windows)
import StackSet

-- $usage
--
-- To use, modify your Config.hs to:
--
-- >    import XMonadContrib.DwmPromote
--
-- and add a keybinding or substitute promote with dwmpromote:
--
-- >   , ((modMask,               xK_Return), dwmpromote)

-- %import XMonadContrib.DwmPromote
-- %keybind , ((modMask,               xK_Return), dwmpromote)

dwmpromote :: X ()
dwmpromote = windows $ modify' $
             \c -> case c of
                   Stack _ [] []     -> c
                   Stack t [] (x:rs) -> Stack x [] (t:rs)
                   Stack t ls rs     -> Stack t [] (ys ++ x : rs) where (x:ys) = reverse ls
{'fraction_non_alphanumeric': 0.21455544112598696, 'fraction_numerical': 0.0034328870580157913, 'mean_word_length': 1.2227307398932112, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6364403', 'n_tokens_mistral': 837, 'n_tokens_neox': 811, 'n_words': 252}