Showing posts with label C. Show all posts
Showing posts with label C. Show all posts

Sunday, December 18, 2011

An unscientific comparision of different tiling window managers

I was intrigued by tiling window managers and decided to try using them. If you don't know what they are, here's the wikipedia page - http://en.wikipedia.org/wiki/Tiling_window_manager

I spent Saturday installing and trying them on out on my ubuntu box. Since I run ubuntu on a virtual box, unity is very sluggish. I explored StumpWM, DWM, Bluetile and finally Awesome.

StumpWM

I started with StumpWM because I drawn by its implementation. Its implemented in Common Lisp and that was very interesting to me. It means we can change stuff around and they will instantly appear and be accessible.

DWM

DWM is the granddaddy of all Tiling Window Managers. Its the antithesis of StumpWM because nothing is configurable. You want to change something? Modify the code and rebuild it.

Bluetile

Bluetile is very user friendly. Its built on top of xmonad but the key difference is that unlike xmonad you don't have to install a full Haskell development environment. Configuration is limited to a few items only. 

Awesome

And finally Awesome. What can I say? Its really awesome! Highly configurable, with a number of layouts, themes and yet quite thin.

Implementation

  1. StumpWM - Common Lisp. This makes is very configurable and changes are instantaneous. Unfortunately you need to download and install a CL implementation and a couple of libraries.
  2. DWM - Straight up C. Less than 2000 lines of code. 
  3. Bluetile - Haskell. 
  4. Awesome - C and Lua. Lua makes configuration easy and that part of the Awesome if very well documented. 

Dynamic or Manual

  1. StumpWM - Manual. It means you need to place windows by yourself. After trying the others, I found this to be a little painful because the point of tiling is productivity. If you have to set things up yourself, then you lose that part.
  2. DWM - Dynamic.  It sets up the layout for you
  3. Bluetile - Dynamic with a couple of different layouts to choose from. Its also very easy to switch between the layouts
  4. Awesome - Dynamic with a number of different layouts and tiling algorithms. 

Conclusion

  1. StumpWM - I didn't like it that much unfortunately because placement is manual and it seems very "raw". Its very closely tied to Emacs and Screen philosophy and so even the prefix key by default is CTRL-T. The best part is that it uses CL and so, you can change things, add new commands/shortcuts without restarting stuff. The sky's the limit for the things you can do, but its elitist in the sense you need to understand common lisp to do that. Its not a problem for me but that may not appeal to everyone.
  2. DWM - Very minimal. As long as you don't fight the flow its great. Unfortunately, I had to read the code to understand what the different shortcut keys. I even uninstalled it because I didn't know how to start. Once I read the code, I found that dmenu is tied to Mod4 (Windows Key) + P, then things started to work. One funny thing though was that firefox didn't show up. Looks like it doesn't play nice with firefox and so, I suspect it will not play nice with other GUI driven applications
  3. Bluetile - Super easy to get started with. Sadly, there is not much configuration that you can and so, its more like a demo for tiling rather. Plays nice with gnome as well. I wanted to install xmonad once I saw it but didn't want to download and install a bunch of stuff that I wouldn't use. If you are a haskeller, then go to xmonad directly, There's even a configuration available to make it look like bluetile.
  4. Awesome - I found this to be the best. Awesome is a fork of dwm with the explicit idea of configuration.Tons of layouts and plus it understands and implements several Freedesktop standards. So, it plays nice with gnome and you get menu integration as well. Only part I didn't like was the name because it makes googling difficult. Its the only one in the list for which the first hit on Google isn't the windowing manager. I also found that resizing didn't work. I'm not sure why but didn't spend time on it. Googling also showed up another person complaining about the same thing but no solution.
So,  I liked Awesome in the end. Its newbie friendly. The only real grouse is that you can't google for it easily. Bluetile is also very nice. DWM and StumpWM is more tuned for the power users. I really like the small size of dwm and the dynamic configuration of stumpwm but those points in themselves don't sell.

Once you use tiling for windows, there's no going back. One note of caution though. Other than Awesome and DWM, the others don't work with lightdm's menu without tweaking on Ubuntu 11.10. In all cases, you lose the panel (unless you install it yourself and its no longer part of GNOME 3).

Wednesday, September 28, 2011

Language fads

R-Bloggers has a post about hipster programming languages where they talk about the emergence of Clojure, Scala and Coffeescript.

While I'm not really experienced in any one of them, I wonder about what's the venerable languages that these cool cats are missing. C is a must for the embedded system work that I do for sure and what is cool is often size reduction. In an environment where every byte counts and memory access is key, C remains king.

Now if we can get more lisp or scheme usage in the embedded world.

Wednesday, October 28, 2009

The difference between FILE* and FD

Obviously using fopen, fwrite etc... is a little bit easier especially since you don't have to keep track of the location in the stream, using plain old open, write etc.. also have their uses.

Consider this.. I want to write a test case which writes to a file over and over again. The idea is to write x bytes to the file, seek to 0, and repeat.

Problem is that this will not work when you use FILE pointers. It will work most times, except when the file itself has to be created. In which case, using seek to 0 does nothing, because every fwrite will automatically seek to the end of the file. So, fopen a new file will always open it in append mode.

Thursday, October 08, 2009

Its my baby

Started implementing my own stack based language. I have played a bit with factor and liked it, so I decided to base some things from it. I also have started to read a little more on forth and have now understood how some basic constructs can be created. Especially useful is jonesforth. The code is a must read!

So, the design goals I have in mind are as follows.

  1. Must be in embeddable in C. My main goal here is to be like Lua. A small library that you can call from C. The main users of this language would be hardcode C programmers esp. on embedded linux and embedded linux system testers. 
  2. Must be written in ANSI C. Factor implementation has moved to C++ and also has a lot work going on in creating a fast and optimizing VM. I don't have that goal, as I want to be able to port my language very quickly to different hardware. The easiest way to port? Just recompile. Obviously, you lose out on some performance, but that's ok. The target audience will code most of the fast bits in C anyways.
  3. Must be simple. System testers should be able to use this language very quickly to write small tests. The main part of the test application itself would be written in C, but the scripting part would be in this language.
  4. Support for quotations, sequences. Ideas from Factor (and lisp) and good ones too!
  5. Reader macros would primarily be from C. 

So far, I have the basic language working. It supports numbers, strings and quotations. You can define your own "words" and run them. There is a "if" control structure and a "loop" control structure. The implementation is still very buggy though. 

Will keep posting as I progress.