bépo keyboards workspace switching, additional shortcuts

This commit is contained in:
nojhan 2012-05-04 11:36:49 +02:00
commit 6b696da9c7

View file

@ -8,7 +8,11 @@ import XMonad.Actions.CycleWS
import XMonad.Layout.ResizableTile import XMonad.Layout.ResizableTile
import XMonad.Actions.WindowGo import XMonad.Actions.WindowGo
import XMonad.Util.Scratchpad (scratchpadSpawnAction, scratchpadManageHook, scratchpadFilterOutWorkspace) 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 XMonad.StackSet as W
import qualified Data.Map as M import qualified Data.Map as M
@ -22,12 +26,12 @@ main = xmonad $ gnomeConfig
, focusedBorderColor = "#ffbb00" , focusedBorderColor = "#ffbb00"
, borderWidth = 3 , borderWidth = 3
-- Switch workspaces with default first azerty row instead of plain numbers -- 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 -- add a fullscreen tabbed layout that does not avoid covering
-- up desktop panels before the desktop layouts -- up desktop panels before the desktop layouts
-- desktopLayoutModifiers still allow toggling panel visibility -- desktopLayoutModifiers still allow toggling panel visibility
, layoutHook = desktopLayoutModifiers( simpleTabbed ||| rtall ) , layoutHook = windowNavigation( desktopLayoutModifiers( simpleTabbed ||| rtall ) )
} }
-- Simple notation ala emacs -- Simple notation ala emacs
`additionalKeysP` `additionalKeysP`
@ -43,25 +47,56 @@ main = xmonad $ gnomeConfig
-- Got to workspaces -- Got to workspaces
, ("M-b p", prevWS ) , ("M-b p", prevWS )
, ("M-b n", nextWS ) , ("M-b n", nextWS )
, ("C-M-<Left>", prevWS )
, ("C-M-<Right>", nextWS )
-- Move windows among workspaces -- Move windows among workspaces
, ("M-u <Left>", shiftToPrev ) , ("M-u <Left>", shiftToPrev )
, ("M-u <Right>", shiftToNext ) , ("M-u <Right>", shiftToNext )
-- Shrink the master area -- Shrink the master area
, ("M-<Left>", sendMessage Shrink) , ("M-S-r", sendMessage Shrink)
-- Expand the master area -- Expand the master area
, ("M-<Right>", sendMessage Expand) , ("M-r", sendMessage Expand)
-- Increment the number of windows in the master area -- Increment the number of windows in the master area
, ("M-<Up>", sendMessage (IncMasterN 1)) , ("M-s", sendMessage (IncMasterN 1))
-- Deincrement the number of windows in the master area -- Deincrement the number of windows in the master area
, ("M-<Down>", sendMessage (IncMasterN (-1))) , ("M-S-s", sendMessage (IncMasterN (-1)))
-- Cycle through the available layout algorithms -- Cycle through the available layout algorithms
, ("M-<Return>", sendMessage NextLayout) , ("M-<Return>", sendMessage NextLayout)
-- Move focus with arrows
, ("M-<Right>", sendMessage $ Go R)
, ("M-<Left>", sendMessage $ Go L)
, ("M-<Up>", sendMessage $ Go U)
, ("M-<Down>", sendMessage $ Go D)
-- Swap windows with arrows
, ("M-S-<Right>", sendMessage $ Swap R)
, ("M-S-<Left>", sendMessage $ Swap L)
, ("M-S-<Up>", sendMessage $ Swap U)
, ("M-S-<Down>", sendMessage $ Swap D)
-- Swap the focused window and the master window
, ("C-M-<Return>", windows W.swapMaster)
-- Move focus to the master window -- Move focus to the master window
, ("M-m", windows W.focusMaster ) , ("M-m", windows W.focusMaster )
-- Scratchpad -- Scratchpad
, ("M-<Space>", scratchpadSpawnAction gnomeConfig { terminal = "$XTERMCMD" } ) , ("M-<Space>", scratchpadSpawnAction gnomeConfig { terminal = "$XTERMCMD" } )
, ("M-<XF86Calculator>", scratchpadSpawnAction gnomeConfig { terminal = "$XTERMCMD" } )
-- Swap the focused window and the master window
, ("M-S-<Return>", windows W.swapMaster)
-- Swap the focused window with the next window
, ("M-S-<Down>", windows W.swapDown )
-- Swap the focused window with the previous window
, ("M-S-<Up>", windows W.swapUp )
-- Move focus to the next physical xinerama screen
, ("M-$", onPrevNeighbour W.view)
, ("<XF86HomePage>", runOrRaise "firefox" (className =? "Firefox" <||> className =? "Firefox-bin"))
, ("<XF86Mail>", spawn "thunderbird -remote \"xfeDoCommand(composeMessage)\"")
] ]
-- Extended notation, for F keys (?) -- Extended notation, for F keys (?)
`additionalKeys` `additionalKeys`
[ [
((modm, xK_F1), spawn "xterm") ((modm, xK_F1), spawn "xterm")
@ -71,6 +106,30 @@ main = xmonad $ gnomeConfig
-- Launch firefox or raise its window if already running -- Launch firefox or raise its window if already running
, ((modm, xK_F5), spawn "nautilus --no-desktop") , ((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 where
rtall = ResizableTall 1 (3/100) (1/2) [] 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)]]