mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-04 22:21:54 -07:00
Match 'Remove Operations functions which have StackSet equivalents' from the core
This commit is contained in:
15
Commands.hs
15
Commands.hs
@@ -27,6 +27,7 @@ module XMonadContrib.Commands (
|
|||||||
|
|
||||||
import XMonad
|
import XMonad
|
||||||
import Operations
|
import Operations
|
||||||
|
import StackSet hiding (sink)
|
||||||
import XMonadContrib.Dmenu (dmenu)
|
import XMonadContrib.Dmenu (dmenu)
|
||||||
import {-# SOURCE #-} Config (workspaces)
|
import {-# SOURCE #-} Config (workspaces)
|
||||||
|
|
||||||
@@ -63,13 +64,13 @@ commandMap :: [(String, X ())] -> M.Map String (X ())
|
|||||||
commandMap c = M.fromList c
|
commandMap c = M.fromList c
|
||||||
|
|
||||||
workspaceCommands :: [(String, X ())]
|
workspaceCommands :: [(String, X ())]
|
||||||
workspaceCommands = [((m ++ show i), f i)
|
workspaceCommands = [((m ++ show i), windows $ f i)
|
||||||
| i <- workspaces
|
| i <- workspaces
|
||||||
, (f, m) <- [(view, "view"), (shift, "shift")]
|
, (f, m) <- [(view, "view"), (shift, "shift")]
|
||||||
]
|
]
|
||||||
|
|
||||||
screenCommands :: [(String, X ())]
|
screenCommands :: [(String, X ())]
|
||||||
screenCommands = [((m ++ show sc), screenWorkspace (fromIntegral sc) >>= flip whenJust f)
|
screenCommands = [((m ++ show sc), screenWorkspace (fromIntegral sc) >>= flip whenJust (windows . f))
|
||||||
| sc <- [0, 1]::[Int] -- TODO: adapt to screen changes
|
| sc <- [0, 1]::[Int] -- TODO: adapt to screen changes
|
||||||
, (f, m) <- [(view, "screen"), (shift, "screen-to-")]
|
, (f, m) <- [(view, "screen"), (shift, "screen-to-")]
|
||||||
]
|
]
|
||||||
@@ -85,11 +86,11 @@ defaultCommands = workspaceCommands ++ screenCommands
|
|||||||
, ("run", spawn "exe=`dmenu_path | dmenu -b` && exec $exe")
|
, ("run", spawn "exe=`dmenu_path | dmenu -b` && exec $exe")
|
||||||
, ("kill", kill)
|
, ("kill", kill)
|
||||||
, ("refresh", refresh)
|
, ("refresh", refresh)
|
||||||
, ("focus-up", focusUp)
|
, ("focus-up", windows $ focusUp)
|
||||||
, ("focus-down", focusDown)
|
, ("focus-down", windows $ focusDown)
|
||||||
, ("swap-up", swapUp)
|
, ("swap-up", windows $ swapUp)
|
||||||
, ("swap-down", swapDown)
|
, ("swap-down", windows $ swapDown)
|
||||||
, ("swap-master", swapMaster)
|
, ("swap-master", windows $ swapMaster)
|
||||||
, ("sink", withFocused sink)
|
, ("sink", withFocused sink)
|
||||||
, ("quit-wm", io $ exitWith ExitSuccess)
|
, ("quit-wm", io $ exitWith ExitSuccess)
|
||||||
]
|
]
|
||||||
|
@@ -36,8 +36,8 @@ import Data.List
|
|||||||
-- > , ((modMask , xK_period), nextWS )
|
-- > , ((modMask , xK_period), nextWS )
|
||||||
|
|
||||||
nextWS, prevWS :: X ()
|
nextWS, prevWS :: X ()
|
||||||
nextWS = withWindowSet $ \s -> view (workspaces !! (setWS s N))
|
nextWS = withWindowSet $ \s -> windows $ W.view (workspaces !! (setWS s N))
|
||||||
prevWS = withWindowSet $ \s -> view (workspaces !! (setWS s P))
|
prevWS = withWindowSet $ \s -> windows $ W.view (workspaces !! (setWS s P))
|
||||||
|
|
||||||
data Dir = P | N deriving Eq
|
data Dir = P | N deriving Eq
|
||||||
setWS :: WindowSet -> Dir -> Int
|
setWS :: WindowSet -> Dir -> Int
|
||||||
|
@@ -22,9 +22,8 @@ module XMonadContrib.DynamicWorkspaces (
|
|||||||
import Control.Monad.State ( gets, modify )
|
import Control.Monad.State ( gets, modify )
|
||||||
|
|
||||||
import XMonad ( X, XState(..), Layout, WorkspaceId, trace )
|
import XMonad ( X, XState(..), Layout, WorkspaceId, trace )
|
||||||
import Operations ( windows, view )
|
import Operations
|
||||||
import StackSet ( tagMember, StackSet(..), Screen(..), Workspace(..),
|
import StackSet hiding (filter, modify, delete)
|
||||||
integrate, differentiate )
|
|
||||||
import Data.Map ( delete, insert )
|
import Data.Map ( delete, insert )
|
||||||
import Graphics.X11.Xlib ( Window )
|
import Graphics.X11.Xlib ( Window )
|
||||||
|
|
||||||
@@ -51,7 +50,7 @@ removeWorkspace = do s <- gets windowset
|
|||||||
case s of
|
case s of
|
||||||
StackSet { current = Screen { workspace = torem }
|
StackSet { current = Screen { workspace = torem }
|
||||||
, hidden = (w:_) }
|
, hidden = (w:_) }
|
||||||
-> do view $ tag w
|
-> do windows $ view (tag w)
|
||||||
modify $ \st -> st { layouts = delete (tag torem) $ layouts st }
|
modify $ \st -> st { layouts = delete (tag torem) $ layouts st }
|
||||||
windows (removeWorkspace' (tag torem))
|
windows (removeWorkspace' (tag torem))
|
||||||
_ -> return ()
|
_ -> return ()
|
||||||
|
@@ -25,7 +25,7 @@ import Data.Maybe ( isNothing )
|
|||||||
import XMonad
|
import XMonad
|
||||||
import StackSet
|
import StackSet
|
||||||
|
|
||||||
import qualified Operations as O
|
import Operations
|
||||||
|
|
||||||
-- $usage
|
-- $usage
|
||||||
--
|
--
|
||||||
@@ -64,9 +64,9 @@ withEmptyWorkspace f = do
|
|||||||
-- | Find and view an empty workspace. Do nothing if all workspaces are
|
-- | Find and view an empty workspace. Do nothing if all workspaces are
|
||||||
-- in use.
|
-- in use.
|
||||||
viewEmptyWorkspace :: X ()
|
viewEmptyWorkspace :: X ()
|
||||||
viewEmptyWorkspace = withEmptyWorkspace O.view
|
viewEmptyWorkspace = withEmptyWorkspace (windows . view)
|
||||||
|
|
||||||
-- | Tag current window to an empty workspace and view it. Do nothing if
|
-- | Tag current window to an empty workspace and view it. Do nothing if
|
||||||
-- all workspaces are in use.
|
-- all workspaces are in use.
|
||||||
tagToEmptyWorkspace :: X ()
|
tagToEmptyWorkspace :: X ()
|
||||||
tagToEmptyWorkspace = withEmptyWorkspace $ \w -> O.shift w >> O.view w
|
tagToEmptyWorkspace = withEmptyWorkspace $ \w -> windows $ view w . shift w
|
||||||
|
@@ -25,7 +25,7 @@ import Data.Ord ( comparing )
|
|||||||
|
|
||||||
import XMonad
|
import XMonad
|
||||||
import StackSet hiding (filter)
|
import StackSet hiding (filter)
|
||||||
import qualified Operations as O
|
import Operations
|
||||||
|
|
||||||
-- $usage
|
-- $usage
|
||||||
-- You can use this module with the following in your Config.hs file:
|
-- You can use this module with the following in your Config.hs file:
|
||||||
@@ -46,4 +46,4 @@ rotView b = do
|
|||||||
sortWs = sortBy (comparing tag)
|
sortWs = sortBy (comparing tag)
|
||||||
pivoted = uncurry (flip (++)) . span ((< m) . tag) . sortWs . hidden $ ws
|
pivoted = uncurry (flip (++)) . span ((< m) . tag) . sortWs . hidden $ ws
|
||||||
nextws = listToMaybe . filter (isJust . stack) . (if b then id else reverse) $ pivoted
|
nextws = listToMaybe . filter (isJust . stack) . (if b then id else reverse) $ pivoted
|
||||||
whenJust nextws (O.view . tag)
|
whenJust nextws (windows . view . tag)
|
||||||
|
Reference in New Issue
Block a user