Arch-Linux

如何從 XMonad 中的所有全屏浮動視窗中刪除邊框

  • April 6, 2022

一段時間以來,我一直在努力實現這一目標。但無法弄清楚我該怎麼做。在這個主題上,我發現這個影片很好地解釋了我想要實現的目標,但我無法理解它,因為我的配置文件的編寫方式與他在影片中的不同。一樣東西。我有兩個顯示器設置。

有人能幫忙嗎?非常感謝任何解釋或幫助。

xmonad.hs這是我的配置文件中的相關部分

import System.IO
import System.Exit

import XMonad
import XMonad.Hooks.SetWMName
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageHelpers(doFullFloat, doCenterFloat, isFullscreen, isDialog)
import XMonad.Config.Desktop
import XMonad.Config.Azerty
import XMonad.Util.Run(spawnPipe)
import XMonad.Actions.SpawnOn
import XMonad.Util.EZConfig (additionalKeys, additionalMouseBindings)
import XMonad.Actions.CycleWS
import XMonad.Hooks.UrgencyHook
import qualified Codec.Binary.UTF8.String as UTF8

import XMonad.Layout.Spacing
import XMonad.Layout.Gaps
import XMonad.Layout.ResizableTile
import XMonad.Layout.NoBorders
import XMonad.Layout.Fullscreen (fullscreenFull)
import XMonad.Layout.Cross(simpleCross)
import XMonad.Layout.Spiral(spiral)
import XMonad.Layout.ThreeColumns
import XMonad.Layout.MultiToggle
import XMonad.Layout.MultiToggle.Instances
import XMonad.Layout.IndependentScreens


import XMonad.Layout.CenteredMaster(centerMaster)

import Graphics.X11.ExtraTypes.XF86
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import qualified Data.ByteString as B
import Control.Monad (liftM2)
import qualified DBus as D
import qualified DBus.Client as D


myStartupHook = do
   spawn "$HOME/.xmonad/scripts/autostart.sh"
   setWMName "LG3D"

-- colours
normBord = "#4c566a"
focdBord = "#5e81ac"
fore     = "#DEE3E0"
back     = "#282c34"
winType  = "#c678dd"

--mod4Mask= super key
--mod1Mask= alt key
--controlMask= ctrl key
--shiftMask= shift key

myModMask = mod4Mask
encodeCChar = map fromIntegral . B.unpack
myFocusFollowsMouse = True
myBorderWidth = 2
myWorkspaces    = ["\61612","\61899","\61947","\61635","\61502","\61501","\61705","\61564","\62150","\61872"]
--myWorkspaces    = ["1","2","3","4","5","6","7","8","9","10"]
--myWorkspaces    = ["I","II","III","IV","V","VI","VII","VIII","IX","X"]

myBaseConfig = desktopConfig

-- window manipulations
myManageHook = composeAll . concat $
   [ [isDialog --> doCenterFloat]
   , [className =? c --> doCenterFloat | c <- myCFloats]
   , [title =? t --> doFloat | t <- myTFloats]
   , [resource =? r --> doFloat | r <- myRFloats]
   , [resource =? i --> doIgnore | i <- myIgnores]
   -- , [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "\61612" | x <- my1Shifts]
   -- , [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "\61899" | x <- my2Shifts]
   -- , [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "\61947" | x <- my3Shifts]
   -- , [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "\61635" | x <- my4Shifts]
   -- , [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "\61502" | x <- my5Shifts]
   -- , [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "\61501" | x <- my6Shifts]
   -- , [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "\61705" | x <- my7Shifts]
   -- , [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "\61564" | x <- my8Shifts]
   -- , [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "\62150" | x <- my9Shifts]
   -- , [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "\61872" | x <- my10Shifts]
   ]
   where
   -- doShiftAndGo = doF . liftM2 (.) W.greedyView W.shift
   myCFloats = ["Arandr", "Arcolinux-calamares-tool.py", "Arcolinux-tweak-tool.py", "Arcolinux-welcome-app.py", "Galculator", "feh", "Xfce4-terminal"]
   myTFloats = ["Downloads", "Save As..."]
   myRFloats = []
   myIgnores = ["desktop_window"]
   -- my1Shifts = ["Chromium", "Vivaldi-stable", "Firefox"]
   -- my2Shifts = []
   -- my3Shifts = ["Inkscape"]
   -- my4Shifts = []
   -- my5Shifts = ["Gimp", "feh"]
   -- my6Shifts = ["vlc", "mpv"]
   -- my7Shifts = ["Virtualbox"]
   -- my8Shifts = ["Thunar"]
   -- my9Shifts = []
   -- my10Shifts = ["discord"]




myLayout = spacingRaw True (Border 0 5 5 5) True (Border 5 5 5 5) True $ mkToggle (NBFULL ?? NOBORDERS ?? EOT) $ tiled ||| Mirror tiled ||| spiral (6/7)  ||| ThreeColMid 1 (3/100) (1/2) ||| noBorders Full
   where
       tiled = Tall nmaster delta tiled_ratio
       nmaster = 1
       delta = 3/100
       tiled_ratio = 1/2

我終於找到了解決方案。我進行了xmonad.hs徹底的研究,並開始了解事物是如何工作的,以及我應該更換什麼以使其按照我想要的方式正常工作。所以我將我的舊配置文件(它具有我想要並習慣的鍵綁定)與這個具有我想要的佈局的配置文件合併。如果您想更深入地了解這一點,也許DTs 配置會有所幫助,因為那裡也有很多東西。

無論如何,這就是我解決這個問題的方法(也許它會對某人有所幫助)

------------------------------------------------------------------------
-- import
------------------------------------------------------------------------

import XMonad hiding ( (|||) ) -- jump to layout
import XMonad.Config.Desktop
import qualified XMonad.StackSet as W
import System.Exit
import System.IO

-- data
import Data.Char (isSpace)
import Data.List
import Data.Monoid
import Data.Maybe (isJust)
import Data.Ratio ((%)) -- for video
import qualified Data.Map as M
import Graphics.X11.ExtraTypes.XF86
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import qualified Data.ByteString as B
import Control.Monad (liftM2)
import qualified DBus as D
import qualified DBus.Client as D

-- util
import XMonad.Util.Run (safeSpawn, unsafeSpawn, runInTerm, spawnPipe)
import XMonad.Util.SpawnOnce
import XMonad.Util.EZConfig (additionalKeysP, additionalMouseBindings)  
import XMonad.Util.NamedScratchpad
import XMonad.Util.NamedWindows
import XMonad.Util.WorkspaceCompare

-- hooks
--import XMonad
import XMonad.Hooks.SetWMName
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks (avoidStruts, docksStartupHook, manageDocks, ToggleStruts(..))
import XMonad.Hooks.EwmhDesktops -- to show workspaces in application switchers
import XMonad.Hooks.ManageHelpers (isFullscreen, isDialog,  doFullFloat, doCenterFloat, doRectFloat) 
import XMonad.Hooks.Place (placeHook, withGaps, smart)
import XMonad.Hooks.UrgencyHook
import qualified Codec.Binary.UTF8.String as UTF8

-- actions
import XMonad.Actions.UpdatePointer -- update mouse postion
import XMonad.Actions.SpawnOn
import XMonad.Actions.CycleWS


-- layout 
import XMonad.Layout.LayoutCombinators (JumpToLayout(..), (|||)) -- jump to layout
import XMonad.Layout.Renamed (renamed, Rename(Replace))
-- import XMonad.Layout.NoBorders
import qualified XMonad.Layout.NoBorders as BO
import XMonad.Layout.Spacing
import XMonad.Layout.GridVariants
import XMonad.Layout.ResizableTile
import XMonad.Layout.BinarySpacePartition
import XMonad.Layout.Fullscreen (fullscreenFull)
import XMonad.Layout.Cross(simpleCross)
import XMonad.Layout.Spiral(spiral)
import XMonad.Layout.ThreeColumns
import XMonad.Layout.MultiToggle
import XMonad.Layout.MultiToggle.Instances
import XMonad.Layout.IndependentScreens
import XMonad.Layout.CenteredMaster(centerMaster)


------------------------------------------------------------------------
-- variables
------------------------------------------------------------------------

myModMask = mod4Mask -- Sets modkey to super/windows key
myTerminal = "alacritty" -- Sets default terminal
myBorderWidth = 2 -- Sets border width for windows
encodeCChar = map fromIntegral . B.unpack
myFocusFollowsMouse = True
--myNormalBorderColor = "#839496"
--myFocusedBorderColor = "#268BD2"
myWorkspaces    = ["\61612","\61899","\61947","\61635","\61502","\61501","\61705","\61564","\62150","\61872"]
--myWorkspaces    = ["1","2","3","4","5","6","7","8","9","10"]
--myWorkspaces    = ["I","II","III","IV","V","VI","VII","VIII","IX","X"]


------------------------------------------------------------------------
-- desktop notifications -- dunst package required
------------------------------------------------------------------------

data LibNotifyUrgencyHook = LibNotifyUrgencyHook deriving (Read, Show)

instance UrgencyHook LibNotifyUrgencyHook where
   urgencyHook LibNotifyUrgencyHook w = do
       name     <- getName w
       Just idx <- fmap (W.findTag w) $ gets windowset

       safeSpawn "notify-send" [show name, "workspace " ++ idx]

------------------------------------------------------------------------
-- Startup hook
------------------------------------------------------------------------

myStartupHook = do
     spawn "$HOME/.xmonad/scripts/autostart.sh"
     setWMName "LG3D"

-- colours
normBord = "#4c566a"
focdBord = "#5e81ac"
fore     = "#DEE3E0"
back     = "#282c34"
winType  = "#c678dd"

------------------------------------------------------------------------
-- layout
------------------------------------------------------------------------

myLayout = BO.lessBorders BO.Never $ avoidStruts (full ||| tiled ||| grid ||| bsp)
 where
   
     -- full
    full = renamed [Replace "Full"] 
         $ BO.noBorders (Full)
     
     --- tiled
    tiled = renamed [Replace "Tall"] 
          $ spacingRaw True (Border 10 0 10 0) True (Border 0 10 0 10) True
          -- $ spacingRaw True (Border 0 5 5 5) True (Border 5 5 5 5) True 
          $ ResizableTall 1 (3/100) (1/2) []
     -- grid
   
    grid = renamed [Replace "Grid"] 
         $ spacingRaw True (Border 10 0 10 0) True (Border 0 10 0 10) True 
         $ Grid (16/10)
   
    -- bsp
    bsp = renamed [Replace "BSP"] 
        $ emptyBSP

    -- The default number of windows in the master pane
    nmaster = 1
    
    -- Default proportion of screen occupied by master pane
    ratio   = 1/2

    -- Percent of screen to increment by when resizing panes
    delta   = 3/100

------------------------------------------------------------------------
-- Window rules:
------------------------------------------------------------------------

myManageHook = composeAll
   [ isDialog                      --> doCenterFloat
   , isFullscreen                  --> doFullFloat
   , className =? "mpv"            --> doRectFloat (W.RationalRect (1 % 4) (1 % 4) (1 % 2) (1 % 2))
   , title =?  "virt-manager"      --> doFloat
   , className =? "Gimp"           --> doFloat 
   --, className =? "Brave"          --> doFloat
   , className =? "Firefox" <&&> resource =? "Toolkit" --> doFloat -- firefox pip
   --, title =? "emacs-capture"      --> doRectFloat (W.RationalRect (1 % 4) (1 % 4) (1 % 2) (1 % 2)) -- emacs org capture
   , title =?  "Downloads"         --> doCenterFloat
   , title =?  "Save As..."        --> doCenterFloat
   , title =?  "Arandr"                        --> doCenterFloat
   , title =?  "Arcolinux-calamares-tool.py"   --> doCenterFloat
   , title =?  "Arcolinux-tweak-tool.py"       --> doCenterFloat
   , title =?  "Arcolinux-welcome-app.py"      --> doCenterFloat
   , title =?  "galculator"                    --> doCenterFloat
   , title =?  "feh"                           --> doCenterFloat
   , title =?  "Xfce4-terminal"                --> doCenterFloat
   --, title =?  ""                  --> doCenterFloat
   --, title =?  ""                  --> doCenterFloat
   , resource  =? "desktop_window" --> doIgnore
   , resource  =? "kdesktop"       --> doIgnore 
   ]
   
------------------------------------------------------------------------
-- Key bindings. Add, modify or remove key bindings here.
------------------------------------------------------------------------

myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $

   -- mod-button1, Set the window to floating mode and move by dragging
   [ ((modMask, 1), (\w -> focus w >> mouseMoveWindow w >> windows W.shiftMaster))

   -- mod-button2, Raise the window to the top of the stack
   , ((modMask, 2), (\w -> focus w >> windows W.shiftMaster))

   -- mod-button3, Set the window to floating mode and resize by dragging
   , ((modMask, 3), (\w -> focus w >> mouseResizeWindow w >> windows W.shiftMaster))

   ]
--
--myKeys =
--  [("M-" ++ m ++ k, windows $ f i)
--        | (i, k) <- zip (myWorkspaces) (map show [1 :: Int ..])
--        , (f, m) <- [(W.view, ""), (W.shift, "S-"), (copy, "S-C-")]]
--    ++
--    [("S-C-a", windows copyToAll)   -- copy window to all workspaces
--     , ("S-C-z", killAllOtherCopies)  -- kill copies of window on other workspaces
--     , ("M-a", sendMessage MirrorExpand)
--     , ("M-z", sendMessage MirrorShrink)
--     , ("M-s", sendMessage ToggleStruts)
--     , ("M-f", sendMessage $ JumpToLayout "Full")
--     , ("M-t", sendMessage $ JumpToLayout "Tall")
--     , ("M-g", sendMessage $ JumpToLayout "Grid")
--     , ("M-b", sendMessage $ JumpToLayout "BSP")
--     , ("M-p", spawn "rofi -show drun") -- rofi
--     , ("S-M-t", withFocused $ windows . W.sink) -- flatten floating window to tiled
--     , ("M-C-<Space>", namedScratchpadAction myScratchpads "terminal")
--     , ("M-C-<Return>", namedScratchpadAction myScratchpads "emacs-scratch")
--    ]

myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
 ----------------------------------------------------------------------
 -- SUPER + FUNCTION KEYS

 [ ((modMask, xK_d ), spawn $ "dmenu_run -i -nb '#191919' -nf '#fea63c' -sb '#fea63c' -sf '#191919' -fn 'NotoMonoRegular:bold:pixelsize=15'")
 --, ((modMask, xK_f), sendMessage ToggleGaps >> spawn "polybar-msg cmd toggle" )
 --, ((modMask, xK_b), sendMessage $ Toggle NBFULL)
 , ((modMask, xK_a), sendMessage MirrorExpand )
 , ((modMask, xK_z), sendMessage MirrorShrink )
 , ((modMask, xK_s), sendMessage ToggleStruts )
 , ((modMask, xK_f), sendMessage $ JumpToLayout "Full" )
 , ((modMask, xK_t), sendMessage $ JumpToLayout "Tall" ) 
 , ((modMask, xK_g), sendMessage $ JumpToLayout "Grid" ) 
 , ((modMask, xK_b), sendMessage $ JumpToLayout "BSP" ) 
 , ((modMask, xK_Return), spawn $ "alacritty" )
 , ((modMask, xK_q), kill )
 , ((modMask, xK_space), spawn $ "rofi -show drun" )
 , ((modMask, xK_x), spawn $ "arcolinux-logout" )
 , ((modMask, xK_Escape), spawn $ "xkill" )
 , ((modMask, xK_e), spawn $ "" )
 , ((modMask, xK_y), spawn $ "polybar-msg cmd toggle" )
 --, ((modMask, xK_s ), spawn $ "")
 --, ((modMask, xK_v), spawn $ "" )
 --, ((modMask, xK_c), spawn $ "conky-toggle" )
 

 -- FUNCTION KEYS
 , ((0, xK_F12), spawn $ "xfce4-terminal --drop-down" )

 -- SUPER + SHIFT KEYS

 
 , ((modMask .|. shiftMask , xK_r ), spawn $ "xmonad --recompile && xmonad --restart")
 , ((modMask .|. shiftMask , xK_q ), kill)
 , ((modMask .|. shiftMask , xK_Return ), spawn $ "termite")
 --, ((modMask .|. shiftMask , xK_h ), spawn $ "betterlockscreen -l && arcolinux-logout && xdotool key h"   )
 -- , ((modMask .|. shiftMask , xK_x ), io (exitWith ExitSuccess))


 -- CONTROL + KEYS
   

 -- CONTROL + ALT KEYS
 , ((controlMask .|. mod1Mask , xK_l), spawn $ "betterlockscreen -l")
 , ((controlMask .|. mod1Mask , xK_v ), spawn $ "virt-manager")
 , ((controlMask .|. mod1Mask , xK_Prior ), spawn $ "conky-rotate -p")
 , ((controlMask .|. mod1Mask , xK_a ), spawn $ "xfce4-appfinder")
 , ((controlMask .|. mod1Mask , xK_b ), spawn $ "brave")
 , ((controlMask .|. mod1Mask , xK_e ), spawn $ "thunar")
 , ((controlMask .|. mod1Mask , xK_w ), spawn $ "waterfox-g4")
 --, ((controlMask .|. mod1Mask , xK_ ), spawn $ "")
 , ((controlMask .|. mod1Mask , xK_f ), spawn $ "firefox")
 , ((controlMask .|. mod1Mask , xK_t ), spawn $ "telegram-desktop")
 , ((controlMask .|. mod1Mask , xK_s ), spawn $ "signal-desktop")
 --, ((controlMask .|. mod1Mask , xK_v ), spawn $ "pavucontrol")
 --, ((controlMask .|. mod1Mask , xK_t ), spawn $ "xfce4-terminal")
 --, ((controlMask .|. mod1Mask , xK_i ), spawn $ "nitrogen")
 --, ((controlMask .|. mod1Mask , xK_r ), spawn $ "rofi-theme-selector")
 --, ((controlMask .|. mod1Mask , xK_o ), spawn $ "$HOME/.xmonad/scripts/picom-toggle.sh")
 --, ((controlMask .|. mod1Mask , xK_c ), spawn $ "catfish")
 --, ((controlMask .|. mod1Mask , xK_k ), spawn $ "arcolinux-logout")
 --, ((controlMask .|. mod1Mask , xK_l ), spawn $ "arcolinux-logout")
 --, ((controlMask .|. mod1Mask , xK_Next ), spawn $ "conky-rotate -n")
 
 
 -- ALT + ... KEYS

 , ((mod1Mask, xK_n), spawn $ "variety -n" )
 , ((mod1Mask, xK_F3), spawn $ "xfce4-appfinder" )
 , ((mod1Mask, xK_p), spawn $ "variety -p" )
 , ((mod1Mask, xK_r), spawn $ "xmonad --restart" )
 --, ((mod1Mask, xK_f), spawn $ "variety -f" )
 --, ((mod1Mask, xK_t), spawn $ "variety -t" )
 --, ((mod1Mask, xK_Up), spawn $ "variety --pause" )
 --, ((mod1Mask, xK_Down), spawn $ "variety --resume" )
 --, ((mod1Mask, xK_Left), spawn $ "variety -p" )
 --, ((mod1Mask, xK_Right), spawn $ "variety -n" )
 --, ((mod1Mask, xK_F2), spawn $ "xfce4-appfinder --collapsed" )

 --VARIETY KEYS WITH PYWAL

 --, ((mod1Mask .|. shiftMask , xK_f ), spawn $ "variety -f && wal -i $(cat $HOME/.config/variety/wallpaper/wallpaper.jpg.txt)&")
 --, ((mod1Mask .|. shiftMask , xK_n ), spawn $ "variety -n && wal -i $(cat $HOME/.config/variety/wallpaper/wallpaper.jpg.txt)&")
 --, ((mod1Mask .|. shiftMask , xK_p ), spawn $ "variety -p && wal -i $(cat $HOME/.config/variety/wallpaper/wallpaper.jpg.txt)&")
 --, ((mod1Mask .|. shiftMask , xK_t ), spawn $ "variety -t && wal -i $(cat $HOME/.config/variety/wallpaper/wallpaper.jpg.txt)&")
 --, ((mod1Mask .|. shiftMask , xK_u ), spawn $ "wal -i $(cat $HOME/.config/variety/wallpaper/wallpaper.jpg.txt)&")

 --CONTROL + SHIFT KEYS
 --, ((mod1Mask .|. shiftMask , xK_Return ), spawn $ ""
 

 --SCREENSHOTS

 , ((0, xK_Print), spawn $ "flameshot gui")
 --, ((0, xK_Print), spawn $ "scrot 'ArcoLinux-%Y-%m-%d-%s_screenshot_$wx$h.jpg' -e 'mv $f $$(xdg-user-dir PICTURES)'")
 , ((controlMask, xK_Print), spawn $ "xfce4-screenshooter" )
 , ((controlMask .|. shiftMask , xK_Print ), spawn $ "xfce4-screenshooter -r -c")


 --MULTIMEDIA KEYS

 -- Mute volume
 , ((0, xF86XK_AudioMute), spawn $ "amixer -q set Master toggle")

 -- Decrease volume
 , ((0, xF86XK_AudioLowerVolume), spawn $ "amixer -q set Master 5%-")

 -- Increase volume
 , ((0, xF86XK_AudioRaiseVolume), spawn $ "amixer -q set Master 5%+")

 -- Increase brightness
 , ((0, xF86XK_MonBrightnessUp),  spawn $ "light -A 5")

 -- Decrease brightness
 , ((0, xF86XK_MonBrightnessDown), spawn $ "light -U 5")

--  , ((0, xF86XK_AudioPlay), spawn $ "mpc toggle")
--  , ((0, xF86XK_AudioNext), spawn $ "mpc next")
--  , ((0, xF86XK_AudioPrev), spawn $ "mpc prev")
--  , ((0, xF86XK_AudioStop), spawn $ "mpc stop")

 , ((0, xF86XK_AudioPlay), spawn $ "playerctl play-pause")
 , ((0, xF86XK_AudioNext), spawn $ "playerctl next")
 , ((0, xF86XK_AudioPrev), spawn $ "playerctl previous")
 , ((0, xF86XK_AudioStop), spawn $ "playerctl stop")


 --------------------------------------------------------------------
 --  XMONAD LAYOUT KEYS

 -- Cycle through the available layout algorithms.
 , ((modMask .|. shiftMask , xK_l), sendMessage NextLayout )

 --Focus selected desktop
 , ((mod1Mask, xK_Tab), windows W.focusDown)

 --Focus selected desktop
 , ((modMask, xK_Tab), nextWS)

 --Focus selected desktop
 , ((controlMask .|. mod1Mask , xK_Left ), prevWS)

 --Focus selected desktop
 , ((controlMask .|. mod1Mask , xK_Right ), nextWS)

 --  Reset the layouts on the current workspace to default.
 , ((modMask .|. shiftMask, xK_space), setLayout $ XMonad.layoutHook conf)

 -- Move focus to the next window.
 , ((modMask, xK_j), windows W.focusDown)

 -- Move focus to the previous window.
 , ((modMask, xK_k), windows W.focusUp  )

 -- Move focus to the master window.
 , ((modMask .|. shiftMask, xK_m), windows W.focusMaster  )

 -- Swap the focused window with the next window.
 , ((modMask .|. shiftMask, xK_j), windows W.swapDown  )

 -- Swap the focused window with the next window.
 , ((controlMask .|. modMask, xK_Down), windows W.swapDown  )

 -- Swap the focused window with the previous window.
 , ((modMask .|. shiftMask, xK_k), windows W.swapUp    )

 -- Swap the focused window with the previous window.
 , ((controlMask .|. modMask, xK_Up), windows W.swapUp  )

 -- Shrink the master area.
 , ((controlMask .|. shiftMask , xK_h), sendMessage Shrink)

 -- Expand the master area.
 , ((controlMask .|. shiftMask , xK_l), sendMessage Expand)

 -- Push window back into tiling.
 , ((modMask .|. shiftMask , xK_t), withFocused $ windows . W.sink)

 -- Increment the number of windows in the master area.
 , ((controlMask .|. modMask, xK_Left), sendMessage (IncMasterN 1))

 -- Decrement the number of windows in the master area.
 , ((controlMask .|. modMask, xK_Right), sendMessage (IncMasterN (-1)))

 ]
 ++

 -- mod-[1..9], Switch to workspace N
 -- mod-shift-[1..9], Move client to workspace N
 [((m .|. modMask, k), windows $ f i)

 --Keyboard layouts
 --qwerty users use this line
  | (i, k) <- zip (XMonad.workspaces conf) [xK_1,xK_2,xK_3,xK_4,xK_5,xK_6,xK_7,xK_8,xK_9,xK_0]

      , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)
     , (\i -> W.greedyView i . W.shift i, shiftMask)]]

 -- ++
 -- ctrl-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
 -- ctrl-shift-{w,e,r}, Move client to screen 1, 2, or 3
 --[((m .|. controlMask, key), screenWorkspace sc >>= flip whenJust (windows . f))
 --    | (key, sc) <- zip [xK_w, xK_e] [0..]
 --    , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]


------------------------------------------------------------------------
-- scratchpads
------------------------------------------------------------------------

--myScratchpads = [ NS "terminal" spawnTerm findTerm manageTerm
--              , NS "emacs-scratch" spawnEmacsScratch findEmacsScratch manageEmacsScratch
--                ] 
--    where
--    role = stringProperty "WM_WINDOW_ROLE"
--    spawnTerm = myTerminal ++  " -name scratchpad"
--    findTerm = resource =? "scratchpad"
--    manageTerm = nonFloating
--    findEmacsScratch = title =? "emacs-scratch"
--    spawnEmacsScratch = "emacsclient -a='' -nc --frame-parameters='(quote (font . \"Inconsolata:size=24:weight=regular:antialias=true:hinting=true:hintstyle=hintfull\")(name . \"emacs-scratch\"))'"
--    manageEmacsScratch = nonFloating
   
------------------------------------------------------------------------
-- main
------------------------------------------------------------------------
main :: IO ()
main = do
   dbus <- D.connectSession
   -- Request access to the DBus name
   D.requestName dbus (D.busName_ "org.xmonad.Log")
       [D.nameAllowReplacement, D.nameReplaceExisting, D.nameDoNotQueue]

   
   
   xmonad $ withUrgencyHook LibNotifyUrgencyHook $ ewmh desktopConfig
       { manageHook = ( isFullscreen --> doFullFloat ) <+> manageDocks <+> myManageHook <+> manageHook desktopConfig
       , startupHook        = myStartupHook
       , layoutHook         = myLayout
       , handleEventHook    = handleEventHook desktopConfig
       , workspaces         = myWorkspaces
       , borderWidth        = myBorderWidth
       , terminal           = myTerminal
       , modMask            = myModMask
       , normalBorderColor  = normBord
       , focusedBorderColor = focdBord
       , logHook            = updatePointer (0.25, 0.25) (0.25, 0.25)
       , keys = myKeys
       , mouseBindings = myMouseBindings
       }

引用自:https://unix.stackexchange.com/questions/697441