Beginners Guide to Xmonad

  • View
    215

  • Download
    0

Embed Size (px)

Text of Beginners Guide to Xmonad

  • 7/22/2019 Beginners Guide to Xmonad

    1/25

    Xmonad Tutorial for Beginning

    Beginners DocumentationRelease 1.0

    Avery Laird

    January 11, 2014

  • 7/22/2019 Beginners Guide to Xmonad

    2/25

  • 7/22/2019 Beginners Guide to Xmonad

    3/25

    Contents

    1 Introduction to using Xmonad 3

    2 Installing Xmonad 5

    2.1 Install xmonad and some handy tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.2 Configuration and tweaking (and maybe some more installing). . . . . . . . . . . . . . . . . . . . . 5

    3 Configuring Xmobar 7

    3.1 Final thoughts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

    4 Configuring Stalonetray 9

    4.1 What Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    5 Configuring Xmonad.hs 11

    5.1 Xmonad file structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

    5.2 Configure Xmonad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

    6 The .xsessionrcFile 13

    6.1 Further Tweaks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    7 Wallpaper 15

    8 Handling External Media 17

    9 Power Management in xmonad 19

    10 Indices and tables 21

    i

  • 7/22/2019 Beginners Guide to Xmonad

    4/25

    ii

  • 7/22/2019 Beginners Guide to Xmonad

    5/25

    Xmonad Tutorial for Beginning Beginners Documentation, Release 1.0

    If you are wanting to get started with using Xmonad, but are new to ubuntu or unix-like systems and/or new to setting

    up window manager environments yourself, this is the tutorial for you. It will not go into great depth for the sake of

    simplicity, but I will cite some other sources where you can find the more complicated explanations.

    Contents:

    Contents 1

  • 7/22/2019 Beginners Guide to Xmonad

    6/25

  • 7/22/2019 Beginners Guide to Xmonad

    7/25

    CHAPTER 1

    Introduction to using Xmonad

    The most important thing to understand about Xmonad is that it was created as a barebones, no distractions window

    manager. Because of this, there is a lot of customization and tweaking involved to get a working environment you

    are completely happy with. This may seem like a downside. However, consider the control one now has over their

    desktop environment the skys the limit. If having to get your hands dirty crafting some custom code seems like a

    daunting task, thats understandable. But, everyone has to start somewhere, and if youre interested in some seriousdesktop overhaul then heres the place to start.

    I created this tutorial because I realized that there was a gap in Xmonad documentation. There existed copy-and-paste

    docs that explained nothing, or lengthy explanatory docs that, unforunately, didnt have anything to copy-and-paste!

    Thats why I created the tutorial for beginning beginners its half explanation and half code samples to get you

    started. If youre ready, lets get toInstalling Xmonad.

    3

  • 7/22/2019 Beginners Guide to Xmonad

    8/25

    Xmonad Tutorial for Beginning Beginners Documentation, Release 1.0

    4 Chapter 1. Introduction to using Xmonad

  • 7/22/2019 Beginners Guide to Xmonad

    9/25

    CHAPTER 2

    Installing Xmonad

    When installing xmonad, pretty much any package manager will do. You can even compile from source, but if youre

    reading the beginning beginners guide to xmonad, I would recommend against that unless you follow an extremely

    clear guide (likethis). I use APT for package management.

    2.1 Install xmonad and some handy tools

    Install xmonad and dmenu:

    sudo apt-get install xmonad suckless-tools xscreensaver

    The package suckless-tools installs dmenu on my latest version of ubuntu just fine. Older versions may have

    to install dwm-tools instead, and other distros might have to search for dmenu as a separate package. Dmenu is a

    bit of a must-have for getting started, because it allows the execution of applications easily, as well see later. If you

    decide for some reason later on that dmenu is not for you, its easily uninstallible however I recommend that you get

    started with dmenu. The xscreensaverpackage will be used later on, with handling lock screens.

    2.2 Configuration and tweaking (and maybe some more installing)

    If you were to login using xmonad right now, you would be greeted with an entirely black screen. For the sake of

    simplicity, lets hold off on that just yet and do a bit more housework first. Next were going to install xmobar, a handy

    status bar popular among xmonad users. Like before, Im going to use APT to install:

    sudo apt-get install xmobar

    Once again, xmonad would still show us a nice black screen. Like pretty much anything in xmonad, xmobar requires

    some hefty configuration to start looking pretty. That configuration is supplied by a file in your home directory,

    ~/.xmobarrc. You might have to create it, or it may already be there. If its not there, do touch ~/.xmobarrc,

    and use any text editor you like to make the nessecary changes. I prefer vim for small things like this. With that done,

    lets move on to the next section.

    5

    http://xmonad.org/intro.htmlhttp://xmonad.org/intro.html
  • 7/22/2019 Beginners Guide to Xmonad

    10/25

    Xmonad Tutorial for Beginning Beginners Documentation, Release 1.0

    6 Chapter 2. Installing Xmonad

  • 7/22/2019 Beginners Guide to Xmonad

    11/25

    CHAPTER 3

    Configuring Xmobar

    Heres whats inside my.xmobarrc:

    Config { font = "-*-Fixed-Bold-R-Normal-*-13-*-*-*-*-*-*-*"

    , borderColor = "black"

    , border = TopB

    , bgColor = "black", fgColor = "grey"

    , position = TopW L 100

    , commands = [ Run Weather "CYVR" ["-t","C","-L","18","-H","25","--normal","gr

    , Run Network "eth0" ["-L","0","-H","32","--normal","green","--high",

    , Run Network "eth1" ["-L","0","-H","32","--normal","green","--high",

    , Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10

    , Run Memory ["-t","Mem: %"] 10

    , Run Swap [] 10

    , Run Com "uname" ["-s","-r"] "" 36000

    , Run Date "%a %b %_d %Y %H:%M:%S" "date" 10

    , Run StdinReader

    ]

    , sepChar = "%"

    , alignSep = "}{", template = "%StdinReader% | %cpu% | %memory% * %swap% }{%date%| %e

    }

    Whoa, thats a lot of options! Lets break it down line by line:

    , borderColor = "black": Defines xmobars border colour as black.

    , border = TopB: Draws a border at the top of xmobars window. Black in this case, as defined in the previous

    setting.

    , bgColor = "black": Defines xmobars background colour as black.

    , fgColor = "grey": Defines the default font colour as grey.

    , position = TopW L 94: Defines the position of xmobar as the top of the screen, on the left hand side, taking

    up 100% of width of the screen.

    , commands = []: This defines a list of commands, or things to do when xmobar starts up. All of the newlines

    starting with a comma andRun define different ways of getting information from different areas of the system, and

    how to display that information on the bar.

    , sepChar = "%": Character to be used for indicating commands in the output template. (% is the default any-

    ways).

    , alignSep = "}{": The characters that define which commands in the output template are aligned left, and

    which are aligned right. Any commands on the left side of a } are aligned to the left side, and any on the right side of

    7

  • 7/22/2019 Beginners Guide to Xmonad

    12/25

    Xmonad Tutorial for Beginning Beginners Documentation, Release 1.0

    a{ are aligned to the right side. This will make a bit more sense in the next (and final) explanation.

    , template = "%StdinReader% | %cpu% | %memory% * %swap% }{%date%|

    %eth0% - %eth1% | %uname% | %CYVR% ": This one may not be immediately obvious at first glance.

    Basically, this is a template to define how the data retrieved by the various commands we ran earlier should be

    displayed. Going from left to right, it says that the data from StdinReader, CPU usage, memory usage and swap

    usage should be shown on the left. Now we see here our friends the curly braces; as I explained before, they say that

    all that data should be on the left hand side. On the right hand side is the date (in orange, as defined by the

    tags), the download and upload speeds, kernel name and the temperature. I live in Vancouver, hence CYVR. Youll

    have to change that value to your area code.

    3.1 Final thoughts

    You may not understand completely how the configuration file works at first, however give it time and slowly it will

    start to make sense. As we continue to delve deeper into the xmonad universe, the various connections between files

    will become more and more easy to follow. I promise! On we go to configuring stalonetray.

    8 Chapter 3. Configuring Xmobar

  • 7/22/2019 Beginners Guide to Xmonad

    13/25

    CHAPTER 4

    Configuring Stalonetray

    Stalonetray is a small stand-alone tray, nice easy and simple to use. Its installed with a simp