diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2015-07-03 23:53:23 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2015-07-03 23:53:23 +0200 |
commit | 8552302b1a1953248d01b45f6767c28fd73106e9 (patch) | |
tree | e834c7435e50c7f4e447fe34bb41512ef9c0ce34 | |
parent | 6d113b9213d8b3ddc694116b63c579b12eea911a (diff) | |
download | dotfiles-8552302b1a1953248d01b45f6767c28fd73106e9.tar dotfiles-8552302b1a1953248d01b45f6767c28fd73106e9.tar.gz dotfiles-8552302b1a1953248d01b45f6767c28fd73106e9.tar.bz2 dotfiles-8552302b1a1953248d01b45f6767c28fd73106e9.tar.xz dotfiles-8552302b1a1953248d01b45f6767c28fd73106e9.zip |
vali: keybinding for dwb
-rw-r--r-- | .xmonad/xmonad.hs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/.xmonad/xmonad.hs b/.xmonad/xmonad.hs index 241785a..5847488 100644 --- a/.xmonad/xmonad.hs +++ b/.xmonad/xmonad.hs | |||
@@ -46,17 +46,21 @@ import XMonad.Prompt.MySsh | |||
46 | 46 | ||
47 | import Network.HostName | 47 | import Network.HostName |
48 | 48 | ||
49 | type KeyMap = Map (ButtonMask, Button) (Window -> X ()) | ||
50 | |||
49 | data Host l1 l2 = Host | 51 | data Host l1 l2 = Host |
50 | { hName :: HostName | 52 | { hName :: HostName |
51 | , hManageHook :: ManageHook | 53 | , hManageHook :: ManageHook |
52 | , hWsp :: Integer -> WorkspaceId | 54 | , hWsp :: Integer -> WorkspaceId |
53 | , hLayoutMod :: l1 -> l2 | 55 | , hLayoutMod :: l1 -> l2 |
56 | , hKeysMod :: XConfig Layout -> (KeyMap -> KeyMap) | ||
54 | } | 57 | } |
55 | 58 | ||
56 | defaultHost = Host { hName = "unkown" | 59 | defaultHost = Host { hName = "unkown" |
57 | , hManageHook = composeOne [manageScratchTerm] | 60 | , hManageHook = composeOne [manageScratchTerm] |
58 | , hWsp = show | 61 | , hWsp = show |
59 | , hLayoutMod = id | 62 | , hLayoutMod = id |
63 | , hKeysMod = const id | ||
60 | } | 64 | } |
61 | 65 | ||
62 | --hostFromName :: (LayoutClass l1 a, LayoutClass l2 a) => HostName -> Host (l1 a) (l2 a) | 66 | --hostFromName :: (LayoutClass l1 a, LayoutClass l2 a) => HostName -> Host (l1 a) (l2 a) |
@@ -66,12 +70,19 @@ hostFromName h@("vali") = defaultHost { hName = h | |||
66 | Just str -> show i ++ " " ++ str | 70 | Just str -> show i ++ " " ++ str |
67 | Nothing -> show i | 71 | Nothing -> show i |
68 | , hLayoutMod = id | 72 | , hLayoutMod = id |
73 | , hKeysMod = \conf -> Map.union $ Map.fromList $ join $ map spawnBindings conf [ (xK_d, ["dwb", "dwb $(xclip -o)"]) | ||
74 | ] | ||
69 | } | 75 | } |
70 | where | 76 | where |
71 | workspaceNames = Map.fromList [ (1, "web") | 77 | workspaceNames = Map.fromList [ (1, "web") |
72 | ] | 78 | ] |
73 | hostFromName _ = defaultHost | 79 | hostFromName _ = defaultHost |
74 | 80 | ||
81 | spawnModifiers = [0, controlMask, shiftMask .|. controlMask] | ||
82 | spawnBindings conf (k, cmds) = zipWith (\m cmd -> ((modm .|. mod1Mask .|. m, k), spawn cmd)) spawnModifiers cmds | ||
83 | where | ||
84 | modm = XMonad.modMask conf | ||
85 | |||
75 | manageScratchTerm = resource =? "scratchpad" -?> doRectFloat $ RationalRect (1 % 16) (1 % 16) (7 % 8) (7 % 8) | 86 | manageScratchTerm = resource =? "scratchpad" -?> doRectFloat $ RationalRect (1 % 16) (1 % 16) (7 % 8) (7 % 8) |
76 | 87 | ||
77 | main = do | 88 | main = do |
@@ -244,8 +255,6 @@ myKeys' conf = Map.fromList $ | |||
244 | , ((modm .|. shiftMask, xK_l ), safeSpawn "slock" []) | 255 | , ((modm .|. shiftMask, xK_l ), safeSpawn "slock" []) |
245 | ] | 256 | ] |
246 | ++ | 257 | ++ |
247 | (join $ map spawnBindings []) | ||
248 | ++ | ||
249 | 258 | ||
250 | -- | 259 | -- |
251 | -- mod-[1..9], Switch to workspace N | 260 | -- mod-[1..9], Switch to workspace N |
@@ -264,7 +273,5 @@ myKeys' conf = Map.fromList $ | |||
264 | ] | 273 | ] |
265 | where | 274 | where |
266 | modm = XMonad.modMask conf | 275 | modm = XMonad.modMask conf |
267 | spawnModifiers = [0, controlMask, shiftMask .|. controlMask] | ||
268 | spawnBindings (k, cmds) = zipWith (\m cmd -> ((modm .|. mod1Mask .|. m, k), spawn cmd)) spawnModifiers cmds | ||
269 | 276 | ||
270 | 277 | ||