diff --git a/xmonad.hs b/xmonad.hs index a61aedb..4176baa 100644 --- a/xmonad.hs +++ b/xmonad.hs @@ -8,7 +8,11 @@ import XMonad.Actions.CycleWS import XMonad.Layout.ResizableTile import XMonad.Actions.WindowGo import XMonad.Util.Scratchpad (scratchpadSpawnAction, scratchpadManageHook, scratchpadFilterOutWorkspace) -import XMonad.Config.Azerty +import XMonad.Layout.WindowNavigation +import XMonad.Actions.FloatSnap +import XMonad.Actions.PhysicalScreens + +import qualified XMonad.Actions.FlexibleManipulate as Flex import qualified XMonad.StackSet as W import qualified Data.Map as M @@ -22,12 +26,12 @@ main = xmonad $ gnomeConfig , focusedBorderColor = "#ffbb00" , borderWidth = 3 -- Switch workspaces with default first azerty row instead of plain numbers - , keys = \c -> azertyKeys c `M.union` keys gnomeConfig c + , keys = \c -> bepoKeys c `M.union` keys gnomeConfig c -- add a fullscreen tabbed layout that does not avoid covering -- up desktop panels before the desktop layouts -- desktopLayoutModifiers still allow toggling panel visibility - , layoutHook = desktopLayoutModifiers( simpleTabbed ||| rtall ) + , layoutHook = windowNavigation( desktopLayoutModifiers( simpleTabbed ||| rtall ) ) } -- Simple notation ala emacs `additionalKeysP` @@ -41,27 +45,58 @@ main = xmonad $ gnomeConfig , ("M-b d", kill ) , ("M-x", kill ) -- Got to workspaces - , ("M-b p", prevWS ) + , ("M-b p", prevWS ) , ("M-b n", nextWS ) + , ("C-M-", prevWS ) + , ("C-M-", nextWS ) -- Move windows among workspaces , ("M-u ", shiftToPrev ) , ("M-u ", shiftToNext ) -- Shrink the master area - , ("M-", sendMessage Shrink) + , ("M-S-r", sendMessage Shrink) -- Expand the master area - , ("M-", sendMessage Expand) + , ("M-r", sendMessage Expand) -- Increment the number of windows in the master area - , ("M-", sendMessage (IncMasterN 1)) + , ("M-s", sendMessage (IncMasterN 1)) -- Deincrement the number of windows in the master area - , ("M-", sendMessage (IncMasterN (-1))) + , ("M-S-s", sendMessage (IncMasterN (-1))) -- Cycle through the available layout algorithms , ("M-", sendMessage NextLayout) + + -- Move focus with arrows + , ("M-", sendMessage $ Go R) + , ("M-", sendMessage $ Go L) + , ("M-", sendMessage $ Go U) + , ("M-", sendMessage $ Go D) + + -- Swap windows with arrows + , ("M-S-", sendMessage $ Swap R) + , ("M-S-", sendMessage $ Swap L) + , ("M-S-", sendMessage $ Swap U) + , ("M-S-", sendMessage $ Swap D) + + -- Swap the focused window and the master window + , ("C-M-", windows W.swapMaster) + -- Move focus to the master window , ("M-m", windows W.focusMaster ) -- Scratchpad , ("M-", scratchpadSpawnAction gnomeConfig { terminal = "$XTERMCMD" } ) - ] - -- Extended notation, for F keys (?) + , ("M-", scratchpadSpawnAction gnomeConfig { terminal = "$XTERMCMD" } ) + -- Swap the focused window and the master window + , ("M-S-", windows W.swapMaster) + -- Swap the focused window with the next window + , ("M-S-", windows W.swapDown ) + -- Swap the focused window with the previous window + , ("M-S-", windows W.swapUp ) + + -- Move focus to the next physical xinerama screen + , ("M-$", onPrevNeighbour W.view) + + , ("", runOrRaise "firefox" (className =? "Firefox" <||> className =? "Firefox-bin")) + , ("", spawn "thunderbird -remote \"xfeDoCommand(composeMessage)\"") + ] +-- Extended notation, for F keys (?) `additionalKeys` [ ((modm, xK_F1), spawn "xterm") @@ -71,6 +106,30 @@ main = xmonad $ gnomeConfig -- Launch firefox or raise its window if already running , ((modm, xK_F5), spawn "nautilus --no-desktop") ] + `additionalMouseBindings` + [ + -- Move window with M-mouse1 + ((modm, 1), (\w -> focus w >> windows W.shiftMaster >> Flex.mouseWindow Flex.position w >> snapMagicMove (Just 50) (Just 50) w)) + -- Resize windows with M-mouse3 + , ((modm, 3), (\w -> focus w >> windows W.shiftMaster >> Flex.mouseWindow Flex.resize w >> snapMagicMouseResize 100 (Just 50) (Just 50) w)) + ] where rtall = ResizableTall 1 (3/100) (1/2) [] + +-- Workspace switching using first row keycodes +-- for keyboards that do not use numbers here + +-- bépo with «/» switched with +numBepoNoj = [0x22,0x3c,0x3e,0x28,0x29,0x40,0x2b,0x2d,0x2f,0x2a] +-- normal bépo +numBepo = [0x22,0xab,0xbb,0x28,0x29,0x40,0x2b,0x2d,0x2f,0x2a] +-- azerty +numAzerty = [0x26,0xe9,0x22,0x27,0x28,0x2d,0xe8,0x5f,0xe7,0xe0] + +bepoConfig = gnomeConfig { keys = bepoKeys <+> keys gnomeConfig } +bepoKeys conf@(XConfig {modMask = modm}) = M.fromList $ + [((m .|. modm, k), windows $ f i) + | (i, k) <- zip (workspaces conf) numBepoNoj, + (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]] +