myTerminal = "xterm"
myWorkspaces = ["1:Main","2:Xat","3:Web","4:Music","5:Video","6", "7", "8", "9"]
myModMask = mod4Mask
In this code above we can see that xterm will be my terminal, my 9 workspaces (note that the names are strings, then you can change them as you wish) and the modMask button (using the windows button, mod4Mask, to use Xmonad actions).
myLayout = onWorkspace "2:Xat" pidginLayout $ onWorkspace "5:Video" nobordersLayout $ tiled1 ||| Mirror tiled1 ||| nobordersLayout
where
tiled1 = spacing 5 $ Tall nmaster1 delta ratio
--tiled2 = spacing 5 $ Tall nmaster2 delta ratio
nmaster1 = 1
nmaster2 = 2
ratio = 2/3
delta = 3/100
nobordersLayout = smartBorders $ Full
gridLayout = spacing 8 $ Grid
--gimpLayout = withIM (0.20) (Role "gimp-toolbox") $ reflectHoriz $ withIM (0.20) (Role "gimp-dock") Full
pidginLayout = withIM (18/100) (Role "buddy_list") gridLayout
In this part of the configuration file I am specifying what the behaviours of the different workspaces are. We can see that workspace 2:Xat will be using pidginLayout and workspace 5:Video will be using nobordersLayout. All the other workspaces will have three layouts (you can change them as you wish).After that, we can see for tiled1 the ratio of the amount of screen we want to use between the master window and the stack. Moreover, we can see how the pidginLayout and nobordersLayout are specified. Please, see below a screenshot for the pidginLayout.
Pidgin running with special layout in workspace 2:Xat |
myManageHook = composeAll
[ className =? "File Operation Progress" --> doFloat
, resource =? "desktop_window" --> doIgnore
, className =? "xfce4-notifyd" --> doIgnore
, className =? "Pidgin" --> doShift "2:Xat"
, title =? "New Tab - Google Chrome" --> doShift "3:Web"
, className =? "Firefox" --> doShift "3:Web"
, className =? "Clementine" --> doShift "4:Music"
, className =? "Vlc" --> doShift "5:Video"
]
In this piece of configuration file we can see the hooks that we want to have in the system. I think they are quite straight forward, but I would like to mention that Firefox is moved always to workspace 3:Web or Vlc is moved to workspace 5:Video.
------------------
-- Window Managing
------------------
-- Move focus to the next window
, ((mod4Mask, xK_j), windows W.focusDown)
-- Move focus to the previous window
, ((mod4Mask, xK_k), windows W.focusUp)
-- Move focus to the master window
, ((mod4Mask, xK_m), windows W.focusMaster)
-- Swap the focused window and the master window
, ((mod4Mask, xK_Return), windows W.swapMaster)
-- Swap the focused windows with the next window
, ((mod4Mask .|. shiftMask, xK_j), windows W.swapDown)
-- Swap the focused windows with the previos window
, ((mod4Mask .|. shiftMask, xK_k), windows W.swapUp)
-- Shrink the master area
, ((mod4Mask, xK_h), sendMessage Shrink)
-- Expand the master area
, ((mod4Mask, xK_l), sendMessage Expand)
This is another important piece of the configuration file. This snippet shows how to interact with the windows you have in a workspace. Let's read a few lines to see how it works. The first one is how to focus on the next window, for that we have to use the combination Win+j or to move to the previous window we have to use the combination Win+k.
-------
-- Apps
-------
-- Google Chrome
, ((mod4Mask, xK_g), spawn "google-chrome-stable")
-- Pidgin
, ((mod4Mask .|. shiftMask, xK_p), spawn "pidgin")
-- VirtualBox
, ((mod4Mask, xK_v), spawn "VirtualBox")
-- Clementine
, ((mod4Mask, xK_c), spawn "clementine")
-- VLC
, ((mod4Mask .|. shiftMask, xK_v ), spawn "vlc")
-- Terminator
, ((mod4Mask, xK_Return), spawn "terminator") -- spawn terminator terminal
-- Thunar
, ((mod4Mask, xK_t), spawn "thunar")
-- Dmenu
, ((mod4Mask, xK_p), spawn "dmenu_run")
-- Kill the focused app
, ((mod4Mask .|. shiftMask, xK_c), kill) -- kill the app
The last piece of configuration file shows how to launch applications using shortcuts. As you can see, they are as easy as the movements of the windows. To launch pidgin I will have to use Win+Shift+p or to kill the app which I am focused I will use Win+Shift+c.Finally, to apply these changes you need to compile Xmonad and restart the session. To compile your changes you only have to write in the terminal:
xmonad --recompile
That's all for today. If anyone has questions or wants more information, please, feel free to write a comment.