Español English

Saturday 17 October 2015

How to install Xmonad in Arch Linux/Manjaro (2/2)

Now it is time to talk about my personal configuration in Xmonad. I will show pieces of the configuration file and I will explain what they mean (no worries, we will not go into Haskell details) and I will show some pictures if needed.
   
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.

Wednesday 14 October 2015

Como instalar Xmonad en Arch Linux/Manjaro (1/2)

En éste post hablaré sobre como instalar Xmonad y usarlo con mis ficheros de configuración personales para hacerlo funcionar. Recuerda que los videos están hechos con asciinema. Eso significa que puedes copiar texto del video!!

Primer paso es añadir el repositorio archlinuxfr a el fichero /etc/pacman.conf e instalar yaourt.

Instala xmonad, xmobar, dmenu, zsh, git, feh entre otras cosas que son necesarias.

Clona el repositorio dot-files desde mi repositorio en GitHub y activa SLiM como login manager.

Una vez te autentiques en el sistema deberías ver algo parecido a esto:

Hay muchos ficheros de configuración que han sido usados para hacer funcionar esto. Además, sería muy costoso y extenso explicar cada uno de ellos, pero si la gente muestra interes, en alguno o en todos ellos, crearé otra entrada explicandolos.


En el siguiente post hablaré sobre my configuración de Xmonad y como usarlo. Si quieres ver un avance de lo que veremos en el proximo post puedes hechar un vistazo a el fichero ~/.xmonad/xmonad.hs

Para finalizar. Ultimamente he estado jugando un poco con DWM, otro tiling window manager, de suckless.org. Haré una entrada explicando como usarlo y porque creo que es muy interesante.

Monday 12 October 2015

How to install Xmonad in Arch Linux/Manjaro (1/2)

In this post I will talk about how to install Xmonad and use my personal configuration files to make it run. Remember the videos are made with asciinema. That means you can copy from the video!!

First step is adding archlinuxfr repo to the /etc/pacman.conf file and installing yaourt.

Install xmonad, xmobar, dmenu, zsh, git, feh and all other needed stuff.

Gather dot-files from my repository in GitHub and enable SLiM as login manager.

Once you log into the system you should see something like:

There are plenty of configuration files put in place to make it run. Therefore, it will be so long to explain each of them, but if people are interested in some or all of them I will make another entry explaining them.

In the next post I will talk about the configuration I have in Xmonad and how to use it. If you want to see something in advance have a look to the file ~/.xmonad/xmonad.hs

Finally, recently I have been playing with DWM, another tiling window manager, from suckless.org. I will make another entry in the future explaining about it, because I think is really interesting.