Tag Archives: Linux

Conky configuration file

A couple of months ago I put on an article about conky, a lightweight application to monitor your system/hardware status.
Here is my new configuration file, this is not actually mine, I took it from the archlinux forum and changed it to fit with my needs.

background yes

use_xft yes
xftfont DejaVu Sans:size=8

update_interval 1
total_run_times 0
double_buffer yes
text_buffer_size 1024

own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

minimum_size 185 768
maximum_width 185

draw_shades no
use_spacer yes
default_color white

alignment top_right
gap_x 12
gap_y 30

no_buffers no
net_avg_samples 2

override_utf8_locale yes
if_up_strictness address

color0 7bb7ef
color1 c8e4fd
color2 ffffff

SYSTEM ${hr 2}
${voffset 2}${font OpenLogos:size=16}B${font} Kernel: ${alignr}${kernel}
${font StyleBats:size=16}A${font} CPU: ${cpu cpu1}% ${alignr}${cpubar cpu1 8,60}
${font StyleBats:size=16}g${font} RAM: $memperc% ${alignr}${membar 8,60}
${font Webdings:size=16}~${font} Battery: ${battery_percent BAT0}% ${alignr}${battery_bar 8,60 BAT0}
${font StyleBats:size=16}q${font} Uptime: ${alignr}${uptime}
${voffset 4}${font Pie charts for maps:size=14}7${font} ${voffset -5}HDD:${alignr}${fs_used /}/${fs_size /}

NETWORK ${hr 2}
${if_up wlan0}
${voffset -6}${font PizzaDudeBullets:size=14}O${font} Up: ${upspeed wlan0} ${alignr}${upspeedgraph wlan0 8,60 F57900 FCAF3E}
${voffset 4}${font PizzaDudeBullets:size=14}U${font} Down: ${downspeed wlan0} ${alignr}${downspeedgraph wlan0 8,60 F57900 FCAF3E}
${voffset 4}${font PizzaDudeBullets:size=14}N${font} Upload: ${alignr}${totalup wlan0}
${voffset 4}${font PizzaDudeBullets:size=14}T${font} Download: ${alignr}${totaldown wlan0}
${voffset 4}${font PizzaDudeBullets:size=14}Z${font} Signal: ${alignr}${wireless_link_bar 8,60 wlan0}
${voffset 4}${font PizzaDudeBullets:size=14}a${font} Local Ip: ${alignr}${addr wlan0}
${voffset 4}${font PizzaDudeBullets:size=14}b${font} Public Ip: ${alignr}${execi 3600 curl http://riivo.eu/php/ip.php}
${if_up eth0}
${voffset -6}${font PizzaDudeBullets:size=14}O${font} Up: ${upspeed eth0} ${alignr}${upspeedgraph eth0 8,60 F57900 FCAF3E}
${voffset 4}${font PizzaDudeBullets:size=14}U${font} Down: ${downspeed eth0} ${alignr}${downspeedgraph eth0 8,60 F57900 FCAF3E}
${voffset 4}${font PizzaDudeBullets:size=14}N${font} Upload: ${alignr}${totalup eth0}
${voffset 4}${font PizzaDudeBullets:size=14}T${font} Download: ${alignr}${totaldown eth0}
${voffset 4}${font PizzaDudeBullets:size=14}a${font} Local Ip: ${alignr}${addr eth0}
${voffset 4}${font PizzaDudeBullets:size=14}b${font} Public Ip: ${alignr}${execi 3600 curl http://riivo.eu/php/ip.php}
${font PizzaDudeBullets:size=14}4${font} Network Unavailable

${voffset 6}${color #e5e5e5}${top name 1}${alignr}${top cpu 1}%
${color #c4c4c4}${top name 2}${alignr}${top cpu 2}%
${color #a3a3a3}${top name 3}${alignr}${top cpu 3}%
${color #828282}${top name 4}${alignr}${top cpu 4}%
${color #505050}${top name 5}${alignr}${top cpu 5}%
${color white}${alignc}${font styleBats:size=14}K${font}

${color white}MEM MANAGER ${hr 2}
${color #e5e5e5}${top_mem name 1}${alignr}${top_mem mem 1}%
${color #c4c4c4}${top_mem name 2}${alignr}${top_mem mem 2}%
${color #a3a3a3}${top_mem name 3}${alignr}${top_mem mem 3}%
${color #828282}${top_mem name 4}${alignr}${top_mem mem 4}%
${color #505050}${top_mem name 5}${alignr}${top_mem mem 5}%
${color white}${alignc}${font styleBats:size=14}U${font}

${color white}DATE ${hr 2}
${alignc 35}${font Arial Black:size=26}${time %H:%M}${font}
${alignc}${time %A %d %B}

Enhance native looking of Netbeans on Linux

Netbeans is an IDE that I use to develop Java softwares but, if you have already launched this software on Linux you may have noticed that the font rendering and the global UI aren’t that good, and it is not comfortable to work in an environment like that.

I am talking about the ugly Swing’s default theme and more especially the lack of a decent font rendering. Fortunately, you can fix those issues with options. You have to passed those arguments when you are launching Netbeans.

First of all, we will see the options needed to fix the fonts:

netbeans -J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=on

If you try it now, I bet you will like the fonts, it is much better. Second of all, the GUI well I should called it the Look & Feel of the software. We will change the Swing L&F to your current GTK L&F:

netbeans --laf com.sun.java.swing.plaf.gtk.GTKLookAndFeel

And you are done, you should now have something like that (depends on your GTK theme of course, but it does not look like a foolish software anymore).

It is important to know that you should put those options in the netbeans.conf file which contains a variable with all the options netbeans should load on startup. It depends on the installation folder of netbeans but in my case the location of this file is /usr/share/netbeans/etc/netbeans.conf. Edit this file and add the options to the netbeans_default_option variable. It should looks like that:

netbeans_default_options="-J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=
on --laf com.sun.java.swing.plaf.gtk.GTKLookAndFeel"

Hardware monitoring under Linux with Conky

Conky is a system monitor software available under GNU/Linux and FreeBSD. It allows you to display many information about your computer’s resources (CPU or RAM usage, HDD free space, temperatures, battery, network traffic and so on). Below an example of conky running on my computer.

As you can see you can display those information directly onto your desktop. You have the ability to customize each and every part of it: colors, alignments, fonts, borders and of course (as I mentioned before) what information.

The configuration of conky is done in a simple text file which will be located in your personal folder: ~/.conkyrc but first things first, you will have to install it. Most likely your distribution will include a package so the installation will be very easy for you (use apt-get on debian based system, emerge on gentoo, pacman on arch, etc).

# pacman -S conky

Now you can start the configuration of conky from scratch or you can use a default configuration file (provided with the package):

$ vi ~/.conkyrc
$ cp /etc/conky/conky.conf ~/.conkyrc

The configuration is straight forward, you have to use conky’s variables to get the correct information. For instance if you want to display the uptime of your computer you can use the $uptime variable. A list of conky’s variables is available on this wiki.

Once your configuration is done just type the conky command to see if everything is fine.
You also have the ability to launch conky on startup. For instance I am using Fluxbox so if I want to automatically start conky on startup I just add the following line in my ~/.fluxbox/startup file:

conky & #do not forget to launch it in background with &

You can download the .conkyrc file I am currently using right here.

Convert a video (avi, mpg, wmv, …) to flv with ffmpeg on Linux

If you want to publish a video on the Internet you will probably want to reduce the size of your video.
A full HD video in avi format will be too heavy and totally inappropriate for streaming, this is where the Flash technology shows its power.

Flash is used all over the place on the Internet for audio & video streaming, you keep good video quality and a significant reduce on files’ size. Of course you will need a tool or a software to convert your video. If you are a GNU/Linux user you will most likely end up using FFmpeg.

FFmpeg is a command-line program who gives you the ability to record, stream, encode audio & video. You have a large amount of options to perfectly match your needs (consult the man for that).

The first step is to install FFmpeg. It will depend of your operating system, if you are running a Debian based distribution you can use the apt command line:

# apt-get install ffmpeg

If you are on Archlinux (my current distribution) use the pacman tool an so on:

# pacman -S ffmpeg

Now you need a simple command to encode your video into a Flash video (.flv extension), here is an example:

$ ffmpeg -i my-video.avi -f flv -b 768 -ar 22050 -ab 96 -s 720x576 my-video.flv

Lets take a look at the options:

-i it is the input file, the video we want to convert in another format
-f the output format of our video
-b it defines the bit rate of the output video (768kbit/s in our case)
-ar the audio frequency of the output video 22050 Hz in this example
-ab the audio bit rate of the output video
-s the dimension of our output video

Yes it is that simple, after the execution of the command you have your .flv video.

Of course, you can use this tool to convert video or audio in other formats (wmv to avi, avi to mpeg, whatever you want). I choose the .flv because it is such a lost of time to find a reliable solution to encode it properly.