[FAQFlow #1]: XMonad

WTF is a FAQFlow? See [1] in the footnotes at the end of this post.

XMonad is a window manager for unix systems written in Haskell. This is a introductory post on how to use it.

First things first: grab XMonad. You might either install it manually or use the package manager from your system. Got it? Nice. Now prepare yourself to start it. How to do that? It depends.

If you’re using X11 with a display manager, you probably know how to proceed. If, instead, you don’t use a DM, the simplest way today is to put

exec xmonad

at the end of your ~/.xinitrc file. Now just run startx.

Now it’s complaining time!

  1. xmonad is lightweight but ghc (haskell compiler) is way too big (> 400MB+), do I really need it? Yes, you do, at least if you really want get the most out of xmonad. This is part of the game. If you already play with haskell, this won’t be a problem for you; however, if you don’t, read more about GHC here, and you’ll see there is a good reason for it to be that big.
  2. I just started xmonad. But there is nothing on my screen, it is blank all over the place! Help!!!? This is normal. Xmonad is lightweight! There is nothing fancy to get into your way. If you think that there should be lots of widgets, desktop icons and such things out there, maybe you should get used to a easier tiling window manager first. i3 is a good choice.
  3. Okay, I’m fine. But how do I open a terminal? Mod+Shift+Enter. Mod is usually the Alt key, but it can be changed to the windows key later on.

Bootstrapping

Yay, now we have a terminal. What’s next? xmonad(1), of course! I mean, see the man page of xmonad.

  1. How to change workspaces? Wait…xmonad has workspaces, right? Yes. Mod-1, Mod-2…and so on.
  2. How to change layouts? Mod-Space. It will cycle through the three (default) available layouts.

Now you know how to use xmonad. This post ends here, goodbye.

No, seriously, let’s dig up a little bit.

3. I don’t like xterm! It is way too ugly! Can I change the default terminal emulator?

Of course, bro! For that, we will need to create a config file for xmonad. By default, its place is ~/.xmonad/xmonad.hs. So, let’s go:

mkdir ~/.xmonad
cd ~/.xmonad
vim xmonad.hs

Now it should look like:

import XMonad

main = xmonad defaultConfig
    {
        -- set your terminal. Examples: konsole, gnome-terminal, urxvt
        terminal = "urxvt"
    }

We just entered some haskell code. The file is pretty self-describing at this point, right? I’ll just say that lines beginning with “–” are comments. Now just change “urxvt” for your favorite terminal emulator and run xmonad –recompile. This will make ghc compile the xmonad.hs source file. Do a “ls” now and you’ll see the good results — that is, supposing the compilation was successful.

Now is the time to restart xmonad. Run xmonad –restart. And now close your current terminal emulator and open a new one again (Mod-Shift-Enter). Done, now you have a pretty terminal [2].

This post will have a continuation.

Footnotes

[1]: A new way I’m trying to both document and teach new (introdutory(?)) skills or tutorials to people in this blog. The word is a portmanteau of “FAQ” (frequently asked questions) and workflow.

[2]: This is not a complaint per se; of course, one might just customize ~/.Xresources to get a nice looking xterm(1). But most people either don’t even know what a Xresources file is, or don’t bother about creating one once they found out its purpose.

Advertisements
[FAQFlow #1]: XMonad

i3 window manager

I’m a huge fan of the i3 tiling window manager. It was the first ‘simple’ window manager I tried, and it is still my favorite one. It eases the management of your windows, is optimized for keyboard control, and maximizes all the space you have available, thus being a nice option for laptop users.

i3 is packaged for most Linux and BSD distributions. You just have to install it through your package manager, then enjoy simplicity and agility. In this post I’ll share a couple of configurations and tweaks I use for my day-to-day computing and programming tasks on i3.

First thing: the statusbar. My preferred one is i3blocks. A statusbar should be easy to config and tweak, and should not be bloated. Only the information you really care about should be displayed on it. Colors are also welcome, as they are a good design practice. Essential blocks include the battery of your laptop, the system load, the current date and time, and whether you are connected to the web or not. I also like to have a block which displays my current network speed (download/upload) and another one for system memory and swap. Optional things include volume and the currently playing song.

Second thing: the background of your desktop. You’ll rarely see it, but it is nice to have something other than a black background fill color. feh is the best wallpaper setter for i3. A simple

feh --bg-scale '/home/thiago/Pictures/wallpaper.jpg'

sets your background image, and creates a $HOME/.fehbg shell script,
which you can run to reload your wallpaper later on.

Third thing: a i3lock which blurs the current view of your desktop is
very nice. I like i3lock-wrapper from i3-extras repository by
ashinkarov, available on GitHub. There are other interesting
things there.

j4-make-config is great for managing i3-themes, in the case you dislike the default one. It is available on http://www.j4tools.org/.

Workspace management should be simple, so I don’t use names for them. Just numbers. When you use names, it becomes annoying when a given

window is not in the proper workspace. While you can force them to go
its proper place in your i3 config file, this process is more automatic
than I need and it keeps getting in my way, so I decided it is better
not to give names to my workspaces.

If you use dual monitors, xrandr is your best friend. I like to have
the following aliases in my shell rc file:

alias xrandr-t-hdmi-connect="xrandr --output LVDS1 --primary --output HDMI1 --auto --left-of LVDS1"
alias xrandr-t-hdmi-disconnect="xrandr --output HDMI1 --off"
alias xrandr-t-hdmi-mirror="xrandr --output LVDS1 --primary --auto --output HDMI1 --auto --same-as LVDS1"

arandr also helps when you need something a bit more advanced.

Those set of configs makes me happy on i3. There are several more i3
customizations you can do, and I’ll leave a couple of references
here. Other ones were already mentioned through the post.

Having a good window manager, the next step is to achieve a good shell
environment (urxvt + tmux + zsh). More on that later.

i3 window manager

Journal #7: economizando um pouco de bateria no Linux

Bateria = paranoia. Não parece correto, do ponto de vista de um usuário [e] no que diz respeito a design, que ele fique se preocupando excessivamente com a taxa de bateria que seus dispositivos consomem. Mas, pelo menos em 2013, essa realidade ainda está distante de ser mudada, ao menos no que diz respeito a smartphones, tablets e laptops (futuros usuários de smart watches talvez não tenham esse problema…). Eu sou obrigado a dizer que usuários de Mac **talvez** não tenham esse problema (shame on me por mencionar a Apple no primeiro parágrafo). Eu não posso garantir, mas aparentemente esses dispositivos têm um quê de especial no que diz respeito a bateria. Pelo menos o Jeff (do Stack Overflow) confirma isso.

Como todo post da série journal, não espere um tutorial explícito: aqui eu vou apenas descrever algumas coisas que eu fiz/faço para economizar um pouco das minhas baterias. Elas são 100% corretas? Não necessariamente (podem até ser que gastem mais bateria do que o normal, mas eu espero que não =P). Elas são seguras? Depende do quanto você é disposto a se arriscar. Na hora do apelo, “não mexa em algo que já está funcionando”. No final das contas, podem simplesmente fazer parte de um efeito placebo. A intuição humana é algo em que não se pode confiar. A única forma de realmente garantir que essas coisas funcionam é através de medidas e/ou de uma avaliação específica. Muito bem, agora que você já leu esse disclaimer, continue a ler se achou que essas firulas são para você.

Continue reading “Journal #7: economizando um pouco de bateria no Linux”

Journal #7: economizando um pouco de bateria no Linux

Journal #6: Ah, orgulho

Às vezes é difícil inquietar-se. Em relação a distros de Linux, nunca me inquietei até ter encontrado uma que realmente me agradasse: Arch Linux. Agora eu percebi que estou insatisfeito em relação a Window Managers. Recentemente, estive com Cinnamon, depois com Openbox, depois XFCE. Mas percebi que não estou satisfeito com nenhuma dessas. Agora inicio a minha jornada com o Awesome WM.

Ademais: acho que vou voltar a usar o Chrome. Talvez seja melhor ser apenas parcialmente paranoico e preocupado com privacidade. Afinal, é realmente difícil querer 100% anônimo na rede enquanto se tem um blog pessoal e enquanto se usa uma conta pública e real do Facebook e do Google. Vou voltar a usar também o Google. Startpage, você foi um bom companheiro.

Ah, abandonar novamente a mania de usar o Plank…

Journal #6: Ah, orgulho