From 922f8c79c4cd5b67f5c0cb53545aee906f939d16 Mon Sep 17 00:00:00 2001 From: afonsofrancof Date: Sun, 29 Jan 2023 02:19:56 +0000 Subject: [PATCH] [MINOR] Some small updates to dotfiles , getting ready for arch-config 2 --- .config/xmobar/.gitignore | 2 + .config/xmonad/.gitignore | 4 +- .config/xmonad/build | 2 +- .config/xmonad/lib/Colors/Teal.hi | Bin 0 -> 2204 bytes .config/xmonad/lib/Colors/Teal.o | Bin 0 -> 8368 bytes .config/xmonad/xmonad.hs | 233 +++++++++++++++++++ .config/xmonad/xmonad.lhs | 375 ------------------------------ 7 files changed, 238 insertions(+), 378 deletions(-) create mode 100644 .config/xmonad/lib/Colors/Teal.hi create mode 100644 .config/xmonad/lib/Colors/Teal.o create mode 100644 .config/xmonad/xmonad.hs delete mode 100644 .config/xmonad/xmonad.lhs diff --git a/.config/xmobar/.gitignore b/.config/xmobar/.gitignore index 44b0c0c..1766297 100644 --- a/.config/xmobar/.gitignore +++ b/.config/xmobar/.gitignore @@ -1 +1,3 @@ +.stack-work +stack.* xmobar-git diff --git a/.config/xmonad/.gitignore b/.config/xmonad/.gitignore index 61a1cbf..a98e9dc 100644 --- a/.config/xmonad/.gitignore +++ b/.config/xmonad/.gitignore @@ -3,7 +3,7 @@ .ghc.* .stack-work stack.* -xmonad -xmonad-contrib +xmonad-git +xmonad-contrib-git xmonad.hi xmonad.o diff --git a/.config/xmonad/build b/.config/xmonad/build index bdca5e8..0df4fe0 100755 --- a/.config/xmonad/build +++ b/.config/xmonad/build @@ -1,7 +1,7 @@ # ~/.config/xmonad/build #!/bin/sh exec stack ghc -- \ - --make xmonad.lhs \ + --make xmonad.hs \ -i \ -ilib \ -fforce-recomp \ diff --git a/.config/xmonad/lib/Colors/Teal.hi b/.config/xmonad/lib/Colors/Teal.hi new file mode 100644 index 0000000000000000000000000000000000000000..a4328bd41d14e6f483f302fab411434d43d4ade4 GIT binary patch literal 2204 zcmaJ>dsGx<6u-mHiYU1F&a~1r&1|QA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Md~U)20(4@tLI3~& literal 0 HcmV?d00001 diff --git a/.config/xmonad/xmonad.hs b/.config/xmonad/xmonad.hs new file mode 100644 index 0000000..c57e96a --- /dev/null +++ b/.config/xmonad/xmonad.hs @@ -0,0 +1,233 @@ +{-# OPTIONS_GHC -Wno-deprecations #-} + +import XMonad +import XMonad.Util.EZConfig (additionalKeysP,removeKeysP) +import XMonad.Hooks.DynamicLog +import XMonad.Util.Loggers (logLayoutOnScreen, logTitleOnScreen, shortenL, wrapL, xmobarColorL) +import XMonad.Hooks.SetWMName +import XMonad.Actions.SpawnOn +import XMonad.Hooks.StatusBar +import qualified XMonad.StackSet as W +import XMonad.Hooks.EwmhDesktops +import XMonad.Util.Run +import Data.Maybe (fromJust) +import XMonad.Hooks.ManageDocks +import XMonad.Hooks.ManageHelpers +import Data.Monoid +import Colors.Teal +import System.Exit +import XMonad.Util.SpawnOnce +import XMonad.Layout.Spacing +import XMonad.Hooks.WindowSwallowing +import qualified XMonad.StackSet as W +import qualified Data.Map as M + +myTerminal = "alacritty" +myTextEditor = "nvim" +myWebBrowser = "firefox" + +myFocusFollowsMouse :: Bool +myFocusFollowsMouse = True + +myClickJustFocuses :: Bool +myClickJustFocuses = False + +windowCount :: X (Maybe String) +windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset + +myNormalBorderColor = "#008080" +myFocusedBorderColor = "#01F9C6" + +myBorderWidth = 2 + +myWorkspaces = ["main","web","text","code","social","mail"] + +myWorkspaceIndices = M.fromList $ zipWith (,) myWorkspaces [1..] + +myModMask = mod4Mask + +myKeys :: [(String, X ())] +myKeys = + [ ("M-x" ,spawn myTerminal ) + , ("M-p", spawn "rofi -show drun") + , ("M-s", spawn "selected=$(ls ~/scripts/|rofi -dmenu -p \"Run: \") && bash ~/.config/rofi/scripts/$selected") + , ("M-b", spawn myWebBrowser) + , ("", spawn "flameshot gui") + , ("", spawn "pamixer set --toggle-mute") + , ("", spawn "pamixer -d 5") + , ("", spawn "pamixer -i 5") + ,("", spawn "lux -a 10%") + ,("", spawn "lux -s 10%") + ,("M-n", spawn $ myTerminal ++ " -e nmtui") + , ("M-q", kill) + , ("M-S-", sendMessage NextLayout) + , ("M-", windows W.focusDown) + , ("M-", windows W.focusUp ) + , ("M-m", windows W.focusMaster ) + , ("M-", windows W.swapMaster) + , ("M-h", sendMessage Shrink) + , ("M-l", sendMessage Expand) + , ("M-t", withFocused $ windows . W.sink) + , ("M-S-u", io (exitWith ExitSuccess)) + , ("M-u", spawn "xmonad --recompile; xmonad --restart") + ] + ++ + [("M-" ++ m ++ (show k), windows $ f i) + | (i, k) <- zip myWorkspaces [1..] + , (f, m) <- [(W.greedyView, "0"), (W.shift, "S-")]] + ++ + [("M-" ++ m ++ key, screenWorkspace sc >>= flip whenJust (windows . f)) + | (key, sc) <- zip ["w", "e", "r"] [0..] + , (f, m) <- [(W.view, "0"), (W.shift, "S-")]] + +myRemoveKeys = ["M-S-","M-S-p","M-S-c","M-","M-n","M-S-q"] +myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $ + [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w + >> windows W.shiftMaster)) + , ((modm, button2), (\w -> focus w >> windows W.shiftMaster)) + , ((modm, button3), (\w -> focus w >> mouseResizeWindow w + >> windows W.shiftMaster))] + +myLayout = avoidStruts(tiled ||| Mirror tiled ||| Full) + where + tiled = Tall nmaster delta ratio + nmaster = 1 + ratio = 1/2 + delta = 3/100 + +myManageHook = composeAll + [ className =? "MPlayer" --> doFloat + , className =? "Gimp" --> doFloat + , resource =? "desktop_window" --> doIgnore + , className =? "QjackCtl" --> doFloat + , resource =? "kdesktop" --> doIgnore + , className =? "firefox" --> doShift (myWorkspaces !! 1) + , className =? "Code" --> doShift (myWorkspaces !! 3) + , className =? "discord" --> doShift (myWorkspaces !! 4) + , title =? "JetBrains Toolbox" --> doShift (myWorkspaces !! 3) + , className =? "main" --> doFloat + , className =? "Mailspring" --> doShift (myWorkspaces !! 5) + , className =? "Xmessage" --> doFloat + , title =? "Steam - News" --> doFloat + , title =? "Friends List" --> doFloat + , isFullscreen --> doFullFloat] + +myEventHook = ewmhDesktopsEventHook +myStartupHook = do + spawnOnce "pasystray" + spawnOnce "nitrogen --restore &" + spawnOnce "playerctld" + spawnOnce "picom &" + spawnOnce "optimus-manager-qt" + setWMName "LG3D" + spawnOnce "nm-applet" + spawnOnce "mailspring" + spawnOnce("xsetroot -cursor_name left_ptr") + spawn ("killall trayer ;sleep 1 && trayer --monitor 0 --edge top --align right --widthtype request --padding 7 --iconspacing 12 --SetDockType true --SetPartialStrut true --expand true --transparent true --alpha 0 --tint 0x2B2E37 --height 26 --distance 5 &") + spawnOn "web" myWebBrowser + spawnOn "main" myTerminal + +myStatusBarSpawner :: Applicative f => ScreenId -> f StatusBarConfig +myStatusBarSpawner (S s) = do + pure $ statusBarPropTo ("_XMONAD_LOG_" ++ show s) + ("xmobar -x " ++ show s ++ " ~/.config/xmobar/xmobarrc" ++ show s) + (pure $ myXmobarPP (S s)) + + +myXmobarPP :: ScreenId -> PP +myXmobarPP s = def + { ppSep = "" + , ppWsSep = "" + , ppCurrent = xmobarColor cyan "" . const wsIconFull + , ppVisible = xmobarColor grey4 "" . const wsIconFull + , ppVisibleNoWindows = Just (xmobarColor grey4 "" . const wsIconFull) + , ppHidden = xmobarColor grey2 "" . const wsIconHidden + , ppHiddenNoWindows = xmobarColor grey2 "" . const wsIconEmpty + , ppUrgent = xmobarColor orange "" . const wsIconFull + , ppOrder = \(ws : _ : _ : extras) -> ws : extras + , ppExtras = [ wrapL " " " " $ layoutColorIsActive s (logLayoutOnScreen s) + ,titleColorIsActive s (shortenL 81 $ logTitleOnScreen s) + ] + } + where + wsIconFull = " \xf111 " + wsIconHidden = " \xf111 " + wsIconEmpty = " \xf10c " + titleColorIsActive n l = do + c <- withWindowSet $ return . W.screen . W.current + if n == c then xmobarColorL cyan "" l else xmobarColorL grey3 "" l + layoutColorIsActive n l = do + c <- withWindowSet $ return . W.screen . W.current + if n == c then wrapL "" l else wrapL "" l + + +myConfig = def + { + terminal = myTerminal, + focusFollowsMouse = myFocusFollowsMouse, + clickJustFocuses = myClickJustFocuses, + borderWidth = myBorderWidth, + modMask = myModMask, + workspaces = myWorkspaces, + normalBorderColor = myNormalBorderColor, + focusedBorderColor = myFocusedBorderColor, + -- keys = myKeys, + layoutHook = spacingWithEdge 10 $ myLayout, + manageHook = manageSpawn <+> myManageHook <+> manageHook def, + handleEventHook = myEventHook <+> fullscreenEventHook <+> swallowEventHook (className=?"Alacritty") (return True) , + startupHook = myStartupHook} + +main :: IO () +main = do + xmonad . ewmh . ewmhFullscreen . dynamicSBs myStatusBarSpawner . docks $ additionalKeysP (removeKeysP myConfig myRemoveKeys) myKeys + +help :: String +help = unlines ["The default modifier key is 'alt'. Default keybindings:", + "", + "-- launching and killing programs", + "mod-Shift-Enter Launch xterminal", + "mod-p Launch dmenu", + "mod-Shift-p Launch gmrun", + "mod-Shift-c Close/kill the focused window", + "mod-Space Rotate through the available layout algorithms", + "mod-Shift-Space Reset the layouts on the current workSpace to default", + "mod-n Resize/refresh viewed windows to the correct size", + "", + "-- move focus up or down the window stack", + "mod-Tab Move focus to the next window", + "mod-Shift-Tab Move focus to the previous window", + "mod-j Move focus to the next window", + "mod-k Move focus to the previous window", + "mod-m Move focus to the master window", + "", + "-- modifying the window order", + "mod-Return Swap the focused window and the master window", + "mod-Shift-j Swap the focused window with the next window", + "mod-Shift-k Swap the focused window with the previous window", + "", + "-- resizing the master/slave ratio", + "mod-h Shrink the master area", + "mod-l Expand the master area", + "", + "-- floating layer support", + "mod-t Push window back into tiling; unfloat and re-tile it", + "", + "-- increase or decrease number of windows in the master area", + "mod-comma (mod-,) Increment the number of windows in the master area", + "mod-period (mod-.) Deincrement the number of windows in the master area", + "", + "-- quit, or restart", + "mod-Shift-q Quit xmonad", + "mod-q Restart xmonad", + "mod-[1..9] Switch to workSpace N", + "", + "-- Workspaces & screens", + "mod-Shift-[1..9] Move client to workspace N", + "mod-{w,e,r} Switch to physical/Xinerama screens 1, 2, or 3", + "mod-Shift-{w,e,r} Move client to screen 1, 2, or 3", + "", + "-- Mouse bindings: default actions bound to mouse events", + "mod-button1 Set the window to floating mode and move by dragging", + "mod-button2 Raise the window to the top of the stack", + "mod-button3 Set the window to floating mode and resize by dragging"] + diff --git a/.config/xmonad/xmonad.lhs b/.config/xmonad/xmonad.lhs deleted file mode 100644 index fc591a4..0000000 --- a/.config/xmonad/xmonad.lhs +++ /dev/null @@ -1,375 +0,0 @@ -\documentclass[a4paper]{article} -\usepackage[a4paper,left=3cm,right=2cm,top=2.5cm,bottom=2.5cm]{geometry} -%include polycode.fmt -\title{\Huge{XMonad config}} -\author{\Huge{Afonso Franco}} - -\begin{document} -\maketitle -\newpage -\tableofcontents -\pagebreak - -\subsection{Imports} -\begin{code} - {-# OPTIONS_GHC -Wno-deprecations #-} - - import XMonad - import XMonad.Util.EZConfig (additionalKeysP,removeKeysP) - import XMonad.Hooks.DynamicLog - import XMonad.Util.Loggers (logLayoutOnScreen, logTitleOnScreen, shortenL, wrapL, xmobarColorL) - import XMonad.Hooks.SetWMName - import XMonad.Actions.SpawnOn - import XMonad.Hooks.StatusBar - import qualified XMonad.StackSet as W - import XMonad.Hooks.EwmhDesktops - import XMonad.Util.Run - import Data.Maybe (fromJust) - import XMonad.Hooks.ManageDocks - import XMonad.Hooks.ManageHelpers - import Data.Monoid - import Colors.Teal - import System.Exit - import XMonad.Util.SpawnOnce - import XMonad.Layout.Spacing - import XMonad.Hooks.WindowSwallowing - import qualified XMonad.StackSet as W - import qualified Data.Map as M -\end{code} - -\subsection{Config Values} -\subsubsection{App Variables} -\begin{code} - myTerminal = "alacritty" - myTextEditor = "nvim" - myWebBrowser = "firefox" -\end{code} - -\subsubsection{Window/Workspace Variables} - Whether focus follows the mouse pointer. - ->myFocusFollowsMouse :: Bool ->myFocusFollowsMouse = True - - Whether clicking on a window to focus also passes the click to the window - ->myClickJustFocuses :: Bool ->myClickJustFocuses = False - ->windowCount :: X (Maybe String) ->windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset - ->myNormalBorderColor = "#008080" ->myFocusedBorderColor = "#01F9C6" - ->myBorderWidth = 2 - ->myWorkspaces = ["main","web","text","code","social","mail"] ->myWorkspaceIndices = M.fromList $ zipWith (,) myWorkspaces [1..] - - -\subsubsection{Keybindings} - ->myModMask = mod4Mask ->myKeys :: [(String, X ())] ->myKeys = - - launch a terminal - -> [ ("M-x" ,spawn myTerminal ) - - launch rofi - -> , ("M-p", spawn "rofi -show drun") -> , ("M-s", spawn "selected=$(ls ~/scripts/|rofi -dmenu -p \"Run: \") && bash ~/.config/rofi/scripts/$selected") - - launch web browser - -> , ("M-b", spawn myWebBrowser) - - -Screenshot - -> , ("", spawn "flameshot gui") - -AUDIO CONTROLS - -> , ("", spawn "pamixer set --toggle-mute") -> , ("", spawn "pamixer -d 5") -> , ("", spawn "pamixer -i 5") - -brightness controls - -> ,("", spawn "lux -a 10%") -> ,("", spawn "lux -s 10%") - -network manager - -> ,("M-n", spawn $ myTerminal ++ " -e nmtui") - - close focused window - -> , ("M-q", kill) - - Reset the layouts on the current workspace to default - -> , ("M-S-", sendMessage NextLayout) - - Move focus to the next window - -> , ("M-", windows W.focusDown) - - Move focus to the previous window - -> , ("M-", windows W.focusUp ) - - Move focus to the master window - -> , ("M-m", windows W.focusMaster ) - - Swap the focused window and the master window - -> , ("M-", windows W.swapMaster) - - Shrink the master area - -> , ("M-h", sendMessage Shrink) - - Expand the master area - -> , ("M-l", sendMessage Expand) - - Push window back into tiling - -> , ("M-t", withFocused $ windows . W.sink) - - Quit xmonad - -> , ("M-S-u", io (exitWith ExitSuccess)) - - Restart xmonad - -> , ("M-u", spawn "xmonad --recompile; xmonad --restart") -> ] -> ++ - - Switch Worskapce with Windows + [1..6]. Shift window adding Shift key. - -> [("M-" ++ m ++ (show k), windows $ f i) -> | (i, k) <- zip myWorkspaces [1..] -> , (f, m) <- [(W.greedyView, "0"), (W.shift, "S-")]] -> ++ - - Switch Screen with Windows + [w,e,r]. Shift window adding Shift key. - -> [("M-" ++ m ++ key, screenWorkspace sc >>= flip whenJust (windows . f)) -> | (key, sc) <- zip ["w", "e", "r"] [0..] -> , (f, m) <- [(W.view, "0"), (W.shift, "S-")]] - -Default Keys to be removed - ->myRemoveKeys = ["M-S-","M-S-p","M-S-c","M-","M-n","M-S-q"] - -Mouse bindings: default actions bound to mouse events - ->myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $ - -mod-button1, Set the window to floating mode and move by dragging - -> [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w -> >> windows W.shiftMaster)) - -mod-button2, Raise the window to the top of the stack - -> , ((modm, button2), (\w -> focus w >> windows W.shiftMaster)) - -mod-button3, Set the window to floating mode and resize by dragging - -> , ((modm, button3), (\w -> focus w >> mouseResizeWindow w -> >> windows W.shiftMaster))] - - -\subsubsection{Mousebindings} - ->myLayout = avoidStruts(tiled ||| Mirror tiled ||| Full) -> where - -default tiling algorithm partitions the screen into two panes - -> tiled = Tall nmaster delta ratio - -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 - -\subsubsection{Manage Windows Hook} -\begin{code} - myManageHook = composeAll - [ className =? "MPlayer" --> doFloat - , className =? "Gimp" --> doFloat - , resource =? "desktop_window" --> doIgnore - , className =? "QjackCtl" --> doFloat - , resource =? "kdesktop" --> doIgnore - , className =? "firefox" --> doShift (myWorkspaces !! 1) - , className =? "Code" --> doShift (myWorkspaces !! 3) - , className =? "discord" --> doShift (myWorkspaces !! 4) - , title =? "JetBrains Toolbox" --> doShift (myWorkspaces !! 3) - , className =? "main" --> doFloat - , className =? "Mailspring" --> doShift (myWorkspaces !! 5) - , className =? "Xmessage" --> doFloat - , title =? "Steam - News" --> doFloat - , title =? "Friends List" --> doFloat - , isFullscreen --> doFullFloat] -\end{code} - -\subsubsection{Event Hook} - ->myEventHook = ewmhDesktopsEventHook - -\subsubsection{Startup Hook} -\begin{code} - myStartupHook = do - spawnOnce "pasystray" - spawnOnce "nitrogen --restore &" - spawnOnce "playerctld" - spawnOnce "picom &" - spawnOnce "optimus-manager-qt" - setWMName "LG3D" - spawnOnce "nm-applet" - spawnOnce "mailspring" - spawnOnce("xsetroot -cursor_name left_ptr") - spawn ("killall trayer ;sleep 1 && trayer --monitor 0 --edge top --align right --widthtype request --padding 7 --iconspacing 12 --SetDockType true --SetPartialStrut true --expand true --transparent true --alpha 0 --tint 0x2B2E37 --height 26 --distance 5 &") - spawnOn "web" myWebBrowser - spawnOn "main" myTerminal - -\end{code} - - -\subsection{Xmobar} - - -\begin{code} - - myStatusBarSpawner :: Applicative f => ScreenId -> f StatusBarConfig - myStatusBarSpawner (S s) = do - pure $ statusBarPropTo ("_XMONAD_LOG_" ++ show s) - ("xmobar -x " ++ show s ++ " ~/.config/xmobar/xmobarrc" ++ show s) - (pure $ myXmobarPP (S s)) - - - myXmobarPP :: ScreenId -> PP - myXmobarPP s = def - { ppSep = "" - , ppWsSep = "" - , ppCurrent = xmobarColor cyan "" . const wsIconFull - , ppVisible = xmobarColor grey4 "" . const wsIconFull - , ppVisibleNoWindows = Just (xmobarColor grey4 "" . const wsIconFull) - , ppHidden = xmobarColor grey2 "" . const wsIconHidden - , ppHiddenNoWindows = xmobarColor grey2 "" . const wsIconEmpty - , ppUrgent = xmobarColor orange "" . const wsIconFull - , ppOrder = \(ws : _ : _ : extras) -> ws : extras - , ppExtras = [ wrapL " " " " $ layoutColorIsActive s (logLayoutOnScreen s) - ,titleColorIsActive s (shortenL 81 $ logTitleOnScreen s) - ] - } - where - wsIconFull = " \xf111 " - wsIconHidden = " \xf111 " - wsIconEmpty = " \xf10c " - titleColorIsActive n l = do - c <- withWindowSet $ return . W.screen . W.current - if n == c then xmobarColorL cyan "" l else xmobarColorL grey3 "" l - layoutColorIsActive n l = do - c <- withWindowSet $ return . W.screen . W.current - if n == c then wrapL "" l else wrapL "" l - -\end{code} - - -\subsection{Config Binding} -\begin{code} - myConfig = def - { - terminal = myTerminal, - focusFollowsMouse = myFocusFollowsMouse, - clickJustFocuses = myClickJustFocuses, - borderWidth = myBorderWidth, - modMask = myModMask, - workspaces = myWorkspaces, - normalBorderColor = myNormalBorderColor, - focusedBorderColor = myFocusedBorderColor, - -- keys = myKeys, - layoutHook = spacingWithEdge 10 $ myLayout, - manageHook = manageSpawn <+> myManageHook <+> manageHook def, - handleEventHook = myEventHook <+> fullscreenEventHook <+> swallowEventHook (className=?"Alacritty") (return True) , - startupHook = myStartupHook} -\end{code} - -\subsection{Main} -\begin{code} - main :: IO () - main = do - xmonad . ewmh . ewmhFullscreen . dynamicSBs myStatusBarSpawner . docks $ additionalKeysP (removeKeysP myConfig myRemoveKeys) myKeys -\end{code} - -\subsection{Default Bindings} -\begin{code} - help :: String - help = unlines ["The default modifier key is 'alt'. Default keybindings:", - "", - "-- launching and killing programs", - "mod-Shift-Enter Launch xterminal", - "mod-p Launch dmenu", - "mod-Shift-p Launch gmrun", - "mod-Shift-c Close/kill the focused window", - "mod-Space Rotate through the available layout algorithms", - "mod-Shift-Space Reset the layouts on the current workSpace to default", - "mod-n Resize/refresh viewed windows to the correct size", - "", - "-- move focus up or down the window stack", - "mod-Tab Move focus to the next window", - "mod-Shift-Tab Move focus to the previous window", - "mod-j Move focus to the next window", - "mod-k Move focus to the previous window", - "mod-m Move focus to the master window", - "", - "-- modifying the window order", - "mod-Return Swap the focused window and the master window", - "mod-Shift-j Swap the focused window with the next window", - "mod-Shift-k Swap the focused window with the previous window", - "", - "-- resizing the master/slave ratio", - "mod-h Shrink the master area", - "mod-l Expand the master area", - "", - "-- floating layer support", - "mod-t Push window back into tiling; unfloat and re-tile it", - "", - "-- increase or decrease number of windows in the master area", - "mod-comma (mod-,) Increment the number of windows in the master area", - "mod-period (mod-.) Deincrement the number of windows in the master area", - "", - "-- quit, or restart", - "mod-Shift-q Quit xmonad", - "mod-q Restart xmonad", - "mod-[1..9] Switch to workSpace N", - "", - "-- Workspaces & screens", - "mod-Shift-[1..9] Move client to workspace N", - "mod-{w,e,r} Switch to physical/Xinerama screens 1, 2, or 3", - "mod-Shift-{w,e,r} Move client to screen 1, 2, or 3", - "", - "-- Mouse bindings: default actions bound to mouse events", - "mod-button1 Set the window to floating mode and move by dragging", - "mod-button2 Raise the window to the top of the stack", - "mod-button3 Set the window to floating mode and resize by dragging"] -\end{code} -\end{document}