Conky

Conky là chương trình cho phép hiển thị thông tin hệ thống trên hệ thống Window X (hệ thống Window X cung cấp môi trường đồ họa thân thiện hơn cho người sử dụng, so với môi trường dòng lệnh trước đây), bao gồm CPU, RAM, HDD, nhiệt độ CPU, cùng một số widgets hữu ích khác.


Trong bài này mình sẽ giới thiệu cách cài đặt và cấu hình Conky trên Ubuntu sử dụng conky-colors, một chương trình với nhiều scripts có sẵn giúp cho việc cấu hình Conky dễ dàng hơn.

Bước 1: Cài đặt conky và conky-colors
Trong terminal, gõ lệnh:

$sudo apt-get install conky-all

Bạn cũng cần cài một số gói khác phục vụ cho việc hiển thị thông tin hệ thống:

$sudo apt-get install python-statgrab python-keyring ttf-ubuntu-font-family hddtemp curl lm-sensors
$sudo chmod u+s /usr/sbin/hddtemp
$sudo sensors-detect # bạn chọn Yes cho tất cả

conky-colors hiện tại đã có version 7.0.4, bạn có thể download tại đây.
Giải nén ra thư mục conkycolors, trong terminal, gõ lệnh sau để cài đặt conky-colors:

$make
$sudo make install

Quá trình cài đặt hoàn tất.

Bước 2: Cấu hình conky
Conky cung cấp khá nhiều objects và variables, bạn có thể tìm hiểu tại: Conky objects, Conky variables
file cấu hình conky mặc định

background no
border_width 1
cpu_avg_samples 2
default_color white
default_outline_color white
default_shade_color white
draw_borders no
draw_graph_borders yes
draw_outline no
draw_shades no
use_xft yes
xftfont DejaVu Sans Mono:size=12
gap_x 5
gap_y 60
minimum_size 5 5
net_avg_samples 2
no_buffers yes
out_to_console no
out_to_stderr no
extra_newline no
own_window yes
own_window_class Conky
own_window_type desktop
stippled_borders 0
update_interval 1.0
uppercase no
use_spacer none
show_graph_scale no
show_graph_range no

TEXT
${scroll 16 $nodename – $sysname $kernel on $machine | }
$hr
${color grey}Uptime:$color $uptime
${color grey}Frequency (in MHz):$color $freq
${color grey}Frequency (in GHz):$color $freq_g
${color grey}RAM Usage:$color $mem/$memmax – $memperc% ${membar 4}
${color grey}Swap Usage:$color $swap/$swapmax – $swapperc% ${swapbar 4}
${color grey}CPU Usage:$color $cpu% ${cpubar 4}
${color grey}Processes:$color $processes ${color grey}Running:$color $running_processes
$hr
${color grey}File systems:
/ $color${fs_used /}/${fs_size /} ${fs_bar 6 /}
${color grey}Networking:
Up:$color ${upspeed eth0} ${color grey} – Down:$color ${downspeed eth0}
$hr
${color grey}Name PID CPU% MEM%
${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}

Để thông tin hệ thống hiển thị đẹp mắt trên màn hình desktop, bạn phải mất khá nhiều thời gian cho file cấu hình Conky. Conky-colors ra đời với nhiều tùy chọn và scripts có sẵn phần nào giải quyết được khó khăn trên. Bạn chỉ cần chạy conky-colors cùng một số tùy chọn, nó sẽ tự sinh file cấu hình conky cho bạn. Chẳng hạn với dòng lệnh sau

conky-colors --theme=gnome-noble --lang=en --cpu=4 --network --hd=default --pidgin

file cấu hình conky được tạo ra với theme noble, ngôn ngữ tiếng Anh, CPU 4 nhân, hiển thị thông tin mạng, kèm với widget pidgin.
Để thấy các tùy chọn của conky-colors, trong terminal gõ lệnh

$conky-colors --help

Thiết lập tùy chọn cho conky-colors, chẳng hạn như sau:

conky-colors --theme=gnome-brave --lang=en --cpu=2 --cputemp --network --hd=default --battery --photord --clock=modern --calendar --gmail --user= --passwd= --bbcweather=1135 --ubuntu

Sau khi thiết lập tùy chọn, gõ lệnh sau để khởi động conky:

conky -c ~/.conkycolors/conkyrc

Conky modes

conky-colors cung cấp một số modes cho bạn lựa chọn: board, rings, cairo, sls, slim, default.

Chẳng hạn để chạy mode sls, bạn cần cấu hình thông tin thời tiết từ dịch vụ xoap của weather.com. Vào trang http://www.weather.com/services/xmloap.html
đăng ký một tài khoản, log-in, bạn thấy có dòng XML data feed, chọn Edit, điền các thông tin vào form. Sau khi hoàn tất, bạn sẽ nhận được một email từ weather.com, trong đó có 2 thông tin quan trọng nhất là: Partner ID và License key. Mở file

/usr/share/conkycolors/.conkyForecast.config

điển các thông tin cần thiết với Partner ID và license key đã được cung cấp. Copy file này vào thư mục ~/ => done.
Cấu hình lm-sensors: trong terminal gõ lệnh

$sudo sensors-detect ## trả lời yes cho tất cả yêu cầu

Chạy conky-colors

$conky-colors --sls --gmail --user= --passwd= --theme=brave --cpu=2 --cputemp --clock=modern --ubuntu
conky -c ~/.conkycolors/conkyrc

Kết quả thu được:

Để conky chạy khi khởi động:
Mở Startup Applications => add startup program => name: conky => command: ~/…/bin/conkyStartup –cái này nằm trong thư mục conkycolors mà bạn đã giải nén ra trước đó
=> done.

Chúc các bạn thành công!
N. Huy

Advertisement

One thought on “Conky

  1. mac fonts says:

    Good day very cool site!! Guy .. Excellent .. Wonderful .. I’ll bookmark your blog and take the feeds additionally?I’m happy to search out numerous helpful information right here in the submit, we’d like develop more techniques on this regard, thanks for sharing. . . . . .

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s