Personal tools

Installing xmonad log applet

From HaskellWiki

(Difference between revisions)
Jump to: navigation, search
m (Installing haskell dependencies)
(Configuring xmonad to write to the applet)
 
(16 intermediate revisions by 4 users not shown)
Line 7: Line 7:
 
This page explains how to install and configure xmonad-log-applet-1.0
 
This page explains how to install and configure xmonad-log-applet-1.0
 
(or the git version which is currently identical but configured to install
 
(or the git version which is currently identical but configured to install
to locations compatible with ubuntu karmic.)
+
to lib/gnome-applets rather than libexec.)
 
===Distro packages===
 
Currently none AFAIK. (18 Jan 2010)
 
   
 
===Preparing for the install===
 
===Preparing for the install===
 
This is a highly experimental application that's seen very little testing. However, it's also small, simple, and unlikely to break other parts of your system. From here on in I'll assume you're comfortable installing unsupported gnome components outside your package manager's control. Unfortunately, so far as I know they must be installed to locations owned by gnome.
 
This is a highly experimental application that's seen very little testing. However, it's also small, simple, and unlikely to break other parts of your system. From here on in I'll assume you're comfortable installing unsupported gnome components outside your package manager's control. Unfortunately, so far as I know they must be installed to locations owned by gnome.
   
To compile the applet you will require a new enough gnu toolchain, libc, some additional C development files, and the applet source. To run it you will need xmonad, xmonad-contrib, ghc, and the hackage DBus package. If you have extremely limited disk space it's possible to build the applet on another host and simply install it on the small device, however that's outside the scope of this discussion.
+
To compile the applet you will require a new enough gnu toolchain, libc, some additional C development files, and the applet source. To run it you will need xmonad, xmonad-contrib, ghc, and the [http://hackage.haskell.org/package/DBus hackage DBus package]. If you have extremely limited disk space it's possible to build the applet on another host and simply install it on the small device, however that's outside the scope of this discussion.
  +
  +
So once you've made up your mind regarding these requirements, acquire the version of xmonad log applet source code that best meets your needs:
   
 
====Choosing an applet version====
 
====Choosing an applet version====
Line 27: Line 27:
 
/usr/lib/gnome-applets/null_applet
 
/usr/lib/gnome-applets/null_applet
   
Get the applet source of your choice by downloading and unpacking the tarball, or git cloning the git tree from the links on [http://uhsure.com/xmonad-log-applet.html the project web page].
+
Get the applet source of your choice by downloading and unpacking the tarball, or git cloning the git tree from the links on [http://uhsure.com/xmonad-log-applet.html the xmonad-log-applet web page].
   
 
===Installing C dependencies===
 
===Installing C dependencies===
Make sure you have a gnu toolchain, i.e. gcc, autotools and friends. (Install build-essential). Also install gnome-panel, libdbus1, libdbus-glib-1, and libpanel-applet-2 if you don't have them already. In debian land the libs will have -dev appended, i.e. libdbus1-dev, etc.
+
Make sure you have a gnu toolchain, i.e. ''gcc, autotools and friends''. (Install build-essential). Also install ''gnome-panel, libdbus1, libdbus-glib-1, and libpanel-applet-2'' if you don't have them already. In debian land the libs will have -dev appended, i.e. libdbus1-dev, etc.
   
 
===Installing haskell dependencies===
 
===Installing haskell dependencies===
You need the [http://hackage.haskell.org/package/DBus DBus] package from hackage. If you don't already have it, install the cabal-install tool by following the instructions in the cabal-install section of the
+
You need the [http://hackage.haskell.org/package/dbus dbus] package from hackage. If you don't already have it, install the cabal-install tool by following the instructions in the cabal-install section of the
[http://xmonad.org/intro.html xmonad install page]. Then run
+
[http://xmonad.org/intro.html xmonad install page]. You may also need libxml2 to install dbus on newer Ubnuntu distributions (eg: Ubuntu-12.10). You can get these by
  +
sudo apt-get install libxml2-dev
 
cabal update
 
cabal update
cabal install DBus
+
cabal install dbus
   
 
===Installing the applet===
 
===Installing the applet===
  +
In a terminal change to the directory containing the log applet source. If you need to modify any of the installation paths in the Makefile.in file edit it first before running the commands to configure and build the applet.
  +
  +
Once the Makefile.in paths are correct for your system, run the configure script for perticular panel you are interested in (eg: gnome2, gnome3, mate, xfce4) by using <tt>"--with-panel="</tt> option:
  +
  +
me@here xmonad-log-applet-1.0 $ ./configure --with-panel=gnome3
  +
  +
If you missed installing any of the C dependencies, or they installed to a non-standard location, the configure script will spit out an error telling what component it can't find and what it suggests you do about it. Fix it and re-try ./configure till it completes successfully. Here are few dependencies that you may have to install on Ubuntu-12-10 for gnome3:
  +
  +
me@here sudo apt-get install libglib2.0-dev libdbus-glib-1-dev libpanel-applet-4-dev
  +
  +
Now run the following commands to build and install the applet, applet server and its icon:
  +
  +
me@here xmonad-log-applet-1.0 $ make
  +
... <several lines of output>
  +
  +
me@here xmonad-log-applet-1.0 $ sudo make install
  +
... <output explaining what got installed where>
  +
  +
Now to check that it installed correctly, run the following command to restart your gnome-panel:
  +
  +
me@here ~ $ gnome-panel --replace &
  +
  +
Now you should be able to add the applet to your gnome-panel. (Until xmonad is sending it data it will just say "Waiting for XMonad" but at this point it should be visible in your applet list and add to the panel without errors.)
  +
  +
If instead you get errors, the most likely things to go wrong would be bad or mismatched install paths, for example the applet tried to install to the wrong directory or one that doesn't exist at all. Also if you edited Makefile.in yourself make sure that the applet install path matches in both the server and the applet lines.
   
 
===Configuring xmonad to write to the applet===
 
===Configuring xmonad to write to the applet===
  +
The goal here is to merge your existing xmonad.hs with [https://github.com/alexkay/xmonad-log-applet/blob/master/xmonad.hs the sample xmonad.hs] from the log applet website.
  +
  +
Probably simplest is to begin with the sample xmonad.hs, ensure it's working with your applet, and then bit by bit merge in your extra modifications to layoutHook, keybindings, etc. while leaving its main actions prior to running xmonad, and its logHook as in the sample. Then customize the logHook PP fields as you normally would to get the look you want, but using pangoColor formatting instead of dzen or xmobar colors.
  +
  +
If you want to work the other way around by modifying your existing xmonad.hs, your goal is to wrap everything you currently have in your version of 'main = ' to make use of the log-applet sample xmonad file's withConnection and getWellKnownName code, and modify your logHook ppOutput to use the dbus writer and error handling code.
   
 
===Trouble===
 
===Trouble===

Latest revision as of 11:27, 28 October 2013

awick has created a gnome-panel applet to read and display xmonad logHook output, which frees gnome-panel users from the need to run an additional status bar to display xmonad information such as workspaces, titles, etc. See xmonad-log-applet for the project home page.

This page explains how to install and configure xmonad-log-applet-1.0 (or the git version which is currently identical but configured to install to lib/gnome-applets rather than libexec.)

Contents

[edit] 1 Preparing for the install

This is a highly experimental application that's seen very little testing. However, it's also small, simple, and unlikely to break other parts of your system. From here on in I'll assume you're comfortable installing unsupported gnome components outside your package manager's control. Unfortunately, so far as I know they must be installed to locations owned by gnome.

To compile the applet you will require a new enough gnu toolchain, libc, some additional C development files, and the applet source. To run it you will need xmonad, xmonad-contrib, ghc, and the hackage DBus package. If you have extremely limited disk space it's possible to build the applet on another host and simply install it on the small device, however that's outside the scope of this discussion.

So once you've made up your mind regarding these requirements, acquire the version of xmonad log applet source code that best meets your needs:

[edit] 1.1 Choosing an applet version

Typically distros install gnome applets either to a libexec directory or to lib/gnome-applets. If your system uses libexec you will want to use the stable tarball build, if your system (like ubuntu karmic) uses lib/gnome-applets use the git version. For other setups you will need to edit the Makefile.in to match your install paths before running the configure script (see #Installing the applet).

To find your applet path, you can use locate, slocate, find, etc. with some applet you know was installed with your gnome-panel:

then@there $ # this system would use stable build tarball
then@there $ slocate gnome-keyboard-applet
/usr/libexec/gnome-keyboard-applet
now@here $ # this system would use git version
now@here $ locate null_applet
/usr/lib/gnome-applets/null_applet

Get the applet source of your choice by downloading and unpacking the tarball, or git cloning the git tree from the links on the xmonad-log-applet web page.

[edit] 2 Installing C dependencies

Make sure you have a gnu toolchain, i.e. gcc, autotools and friends. (Install build-essential). Also install gnome-panel, libdbus1, libdbus-glib-1, and libpanel-applet-2 if you don't have them already. In debian land the libs will have -dev appended, i.e. libdbus1-dev, etc.

[edit] 3 Installing haskell dependencies

You need the dbus package from hackage. If you don't already have it, install the cabal-install tool by following the instructions in the cabal-install section of the xmonad install page. You may also need libxml2 to install dbus on newer Ubnuntu distributions (eg: Ubuntu-12.10). You can get these by

sudo apt-get install libxml2-dev
cabal update
cabal install dbus

[edit] 4 Installing the applet

In a terminal change to the directory containing the log applet source. If you need to modify any of the installation paths in the Makefile.in file edit it first before running the commands to configure and build the applet.

Once the Makefile.in paths are correct for your system, run the configure script for perticular panel you are interested in (eg: gnome2, gnome3, mate, xfce4) by using "--with-panel=" option:

me@here xmonad-log-applet-1.0 $ ./configure --with-panel=gnome3

If you missed installing any of the C dependencies, or they installed to a non-standard location, the configure script will spit out an error telling what component it can't find and what it suggests you do about it. Fix it and re-try ./configure till it completes successfully. Here are few dependencies that you may have to install on Ubuntu-12-10 for gnome3:

me@here sudo apt-get install libglib2.0-dev libdbus-glib-1-dev libpanel-applet-4-dev

Now run the following commands to build and install the applet, applet server and its icon:

me@here xmonad-log-applet-1.0 $ make
... <several lines of output>

me@here xmonad-log-applet-1.0 $ sudo make install
... <output explaining what got installed where>

Now to check that it installed correctly, run the following command to restart your gnome-panel:

me@here ~ $ gnome-panel --replace &

Now you should be able to add the applet to your gnome-panel. (Until xmonad is sending it data it will just say "Waiting for XMonad" but at this point it should be visible in your applet list and add to the panel without errors.)

If instead you get errors, the most likely things to go wrong would be bad or mismatched install paths, for example the applet tried to install to the wrong directory or one that doesn't exist at all. Also if you edited Makefile.in yourself make sure that the applet install path matches in both the server and the applet lines.

[edit] 5 Configuring xmonad to write to the applet

The goal here is to merge your existing xmonad.hs with the sample xmonad.hs from the log applet website.

Probably simplest is to begin with the sample xmonad.hs, ensure it's working with your applet, and then bit by bit merge in your extra modifications to layoutHook, keybindings, etc. while leaving its main actions prior to running xmonad, and its logHook as in the sample. Then customize the logHook PP fields as you normally would to get the look you want, but using pangoColor formatting instead of dzen or xmobar colors.

If you want to work the other way around by modifying your existing xmonad.hs, your goal is to wrap everything you currently have in your version of 'main = ' to make use of the log-applet sample xmonad file's withConnection and getWellKnownName code, and modify your logHook ppOutput to use the dbus writer and error handling code.

[edit] 6 Trouble

Check .xsession-errors for info from gnome-panel, xmonad, dbus, bonobo, etc. Try #xmonad on irc.freenode.net or the xmonad mailing list for help. Please pastebin or attach your xmonad.hs and what version of xmonad/xmonad-contrib you are using.