mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-07-31 20:21:51 -07:00
Reduce head usage
This commit is contained in:
@@ -39,8 +39,9 @@ cycleToNext lst a = do
|
||||
-- | If the current layout is in the list, cycle to the next layout. Otherwise,
|
||||
-- apply the first layout from list.
|
||||
cycleThroughLayouts :: [String] -> X ()
|
||||
cycleThroughLayouts lst = do
|
||||
cycleThroughLayouts [] = pure ()
|
||||
cycleThroughLayouts lst@(x: _) = do
|
||||
winset <- gets windowset
|
||||
let ld = description . S.layout . S.workspace . S.current $ winset
|
||||
let newld = fromMaybe (head lst) (cycleToNext lst ld)
|
||||
let newld = fromMaybe x (cycleToNext lst ld)
|
||||
sendMessage $ JumpToLayout newld
|
||||
|
@@ -27,7 +27,7 @@ module XMonad.Actions.OnScreen (
|
||||
) where
|
||||
|
||||
import XMonad
|
||||
import XMonad.Prelude (fromMaybe, guard)
|
||||
import XMonad.Prelude (fromMaybe, guard, empty)
|
||||
import XMonad.StackSet hiding (new)
|
||||
|
||||
|
||||
@@ -140,10 +140,9 @@ toggleOrView' f i st = fromMaybe (f i st) $ do
|
||||
let st' = hidden st
|
||||
-- make sure we actually have to do something
|
||||
guard $ i == (tag . workspace $ current st)
|
||||
guard $ not (null st')
|
||||
-- finally, toggle!
|
||||
return $ f (tag . head $ st') st
|
||||
|
||||
case st' of
|
||||
[] -> empty
|
||||
(h : _) -> return $ f (tag h) st -- finally, toggle!
|
||||
|
||||
-- $usage
|
||||
--
|
||||
|
Reference in New Issue
Block a user