{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
module XMonad.Config.Azerty (
azertyConfig, azertyKeys, belgianConfig, belgianKeys
) where
import XMonad
import qualified XMonad.StackSet as W
import qualified Data.Map as M
azertyConfig :: XConfig (Choose Tall (Choose (Mirror Tall) Full))
azertyConfig = XConfig (Choose Tall (Choose (Mirror Tall) Full))
forall a. Default a => a
def { keys = azertyKeys <> keys def }
belgianConfig :: XConfig (Choose Tall (Choose (Mirror Tall) Full))
belgianConfig = XConfig (Choose Tall (Choose (Mirror Tall) Full))
forall a. Default a => a
def { keys = belgianKeys <> keys def }
azertyKeys :: XConfig l -> Map (ButtonMask, KeySym) (X ())
azertyKeys = [KeySym] -> XConfig l -> Map (ButtonMask, KeySym) (X ())
forall {l :: * -> *}.
[KeySym] -> XConfig l -> Map (ButtonMask, KeySym) (X ())
azertyKeysTop [KeySym
0x26,KeySym
0xe9,KeySym
0x22,KeySym
0x27,KeySym
0x28,KeySym
0x2d,KeySym
0xe8,KeySym
0x5f,KeySym
0xe7,KeySym
0xe0]
belgianKeys :: XConfig l -> Map (ButtonMask, KeySym) (X ())
belgianKeys = [KeySym] -> XConfig l -> Map (ButtonMask, KeySym) (X ())
forall {l :: * -> *}.
[KeySym] -> XConfig l -> Map (ButtonMask, KeySym) (X ())
azertyKeysTop [KeySym
0x26,KeySym
0xe9,KeySym
0x22,KeySym
0x27,KeySym
0x28,KeySym
0xa7,KeySym
0xe8,KeySym
0x21,KeySym
0xe7,KeySym
0xe0]
azertyKeysTop :: [KeySym] -> XConfig l -> Map (ButtonMask, KeySym) (X ())
azertyKeysTop [KeySym]
topRow conf :: XConfig l
conf@XConfig{modMask :: forall (l :: * -> *). XConfig l -> ButtonMask
modMask = ButtonMask
modm} = [((ButtonMask, KeySym), X ())] -> Map (ButtonMask, KeySym) (X ())
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList ([((ButtonMask, KeySym), X ())] -> Map (ButtonMask, KeySym) (X ()))
-> [((ButtonMask, KeySym), X ())]
-> Map (ButtonMask, KeySym) (X ())
forall a b. (a -> b) -> a -> b
$
[((ButtonMask
modm, KeySym
xK_semicolon), IncMasterN -> X ()
forall a. Message a => a -> X ()
sendMessage (Int -> IncMasterN
IncMasterN (-Int
1)))]
[((ButtonMask, KeySym), X ())]
-> [((ButtonMask, KeySym), X ())] -> [((ButtonMask, KeySym), X ())]
forall a. [a] -> [a] -> [a]
++
[((ButtonMask
m ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
modm, KeySym
k), (WindowSet -> WindowSet) -> X ()
windows ((WindowSet -> WindowSet) -> X ())
-> (WindowSet -> WindowSet) -> X ()
forall a b. (a -> b) -> a -> b
$ [Char] -> WindowSet -> WindowSet
f [Char]
i)
| ([Char]
i, KeySym
k) <- [[Char]] -> [KeySym] -> [([Char], KeySym)]
forall a b. [a] -> [b] -> [(a, b)]
zip (XConfig l -> [[Char]]
forall (l :: * -> *). XConfig l -> [[Char]]
workspaces XConfig l
conf) [KeySym]
topRow,
([Char] -> WindowSet -> WindowSet
f, ButtonMask
m) <- [([Char] -> WindowSet -> WindowSet
forall s i l a sd.
(Eq s, Eq i) =>
i -> StackSet i l a s sd -> StackSet i l a s sd
W.greedyView, ButtonMask
0), ([Char] -> WindowSet -> WindowSet
forall a s i l sd.
(Ord a, Eq s, Eq i) =>
i -> StackSet i l a s sd -> StackSet i l a s sd
W.shift, ButtonMask
shiftMask)]]
[((ButtonMask, KeySym), X ())]
-> [((ButtonMask, KeySym), X ())] -> [((ButtonMask, KeySym), X ())]
forall a. [a] -> [a] -> [a]
++
[((ButtonMask
m ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
modm, KeySym
key), ScreenId -> X (Maybe [Char])
screenWorkspace ScreenId
sc X (Maybe [Char]) -> (Maybe [Char] -> X ()) -> X ()
forall a b. X a -> (a -> X b) -> X b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (Maybe [Char] -> ([Char] -> X ()) -> X ())
-> ([Char] -> X ()) -> Maybe [Char] -> X ()
forall a b c. (a -> b -> c) -> b -> a -> c
flip Maybe [Char] -> ([Char] -> X ()) -> X ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust ((WindowSet -> WindowSet) -> X ()
windows ((WindowSet -> WindowSet) -> X ())
-> ([Char] -> WindowSet -> WindowSet) -> [Char] -> X ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> WindowSet -> WindowSet
f))
| (KeySym
key, ScreenId
sc) <- [KeySym] -> [ScreenId] -> [(KeySym, ScreenId)]
forall a b. [a] -> [b] -> [(a, b)]
zip [KeySym
xK_z, KeySym
xK_e, KeySym
xK_r] [ScreenId
0..],
([Char] -> WindowSet -> WindowSet
f, ButtonMask
m) <- [([Char] -> WindowSet -> WindowSet
forall s i l a sd.
(Eq s, Eq i) =>
i -> StackSet i l a s sd -> StackSet i l a s sd
W.view, ButtonMask
0), ([Char] -> WindowSet -> WindowSet
forall a s i l sd.
(Ord a, Eq s, Eq i) =>
i -> StackSet i l a s sd -> StackSet i l a s sd
W.shift, ButtonMask
shiftMask)]]