Monday, December 22, 2008

对Linux美化的一点点总结

一开始用Linux完全就是被可以自由更改整个系统的优点所折服。一直对Matrix有种着迷感,喜欢那种复古的绿色,于是一开始Linux的界面被自己做成Matrix的样子,很有成就感,包括Gnome KDE Fluxbox都被我成功的Matrixal过。之后出来Compiz Fusion又开始折腾特效,这一路走下来系统界面变换了无数次,但是大部分时间都用在这个上面了,前一段时间看RHCE认证觉得自己应该很Easy就过了,可是刚做的RHCE自我测试让我发现自己错了。用了三年Linux换了很多的发行版却只能在认证测试中得到21分,听人说要70分才可能过。唉,不过现在发现还不算晚,主要想告诉各位学习Linux一定要分清主次,不要浪费时间做没用的事情。这里是谈总结的,总得谈点界面美化的经验。
众所周知学习Linux需要很强的英语知识,一方面是命令都是英语的,另一方面国人在Linux汉化方面的工作做得很不够,包括国产Linux一样如此。系统里面中英文混杂的感觉很不爽,最不爽的是中文环境的Bash只能在X-windows里面正常显示,一旦系统出错进不了X了就得靠猜的了,所以玩Linux还是用英文的好,一般我的locale都会设置成这样的:
系统语言选择English (United States),这样就舒服多了。

在X的选择上我钟情于Gnome,从这点上看我就可能与Linux高手无缘。。。(以前总是看高手说自己钟情于KDE环境),Fluxbox等等资源占用率小的外壳是很帅,但是真的不方便,而且帅是仅限于系统的,如果要将美化应用到软件上就得学学QT了,应该是QT,我没有深入研究,不敢乱说。

Gnome系统美化最常用的网站当然就是大名鼎鼎的Gnome-look.org了,这个网站也是我每次重装系统后更新时必上的网站。应用GTK主题,图标包,在加上我最钟情的Conky(Conky是一个超轻量级的System Monitor软件)。我的Conky有两个,一个在顶上显示系统资源使用情况和时间等,还有一个在桌面右边显示具体系统资源占用情况,网络使用情况以及MPD播放器。给出两个config文件,想要的拿去,没时间改里面的具体内容,版权是别人的哦,我只作修改自用。

Config File 1----顶部:
# mod by uel
#avoid flicker
double_buffer yes
#no_buffers yes

#own window to run simultanious 2 or more conkys
own_window yes
own_window_transparent no
own_window_type widget
own_window_hints undecorated,sticky,skip_taskbar,skip_pager

# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0

#borders
draw_borders no
border_margin 2

#shades
draw_shades no
#draw_graph_borders yes
#draw_borders yes

#position
gap_x 1
gap_y 788
#alignment bottom_right
alignment bottom_left

#behaviour
update_interval 1

#colour
#default_color 000000
default_color D6D6D6
#default_color bfbfbf
#default_shade_color 000000
own_window_colour 202020
#draw_borders_colour 000000
#draw_graph_borders_colour 000000
#484432 95956B

#font
use_xft yes
xftfont BankGothic Md BT:pixelsize=12

#to prevent window from moving
use_spacer no
minimum_size 1278 10

#mpd
mpd_host localhost
mpd_port 6600
# ${offset -22}
##Mpd: ${color E8BCA7}${font}${mpd_smart}
##Swap: ${color E8BCA7}${font} ${swap} ${color 292929}
## Home: ${color E8BCA7}${font}${fs_free /home}
##${color E8BCA7}${time %A, %d %B}
##${color} Mpd: ${color E8BCA7}${font}${mpd_smart}${color 292929} ${color E8BCA7}${color}
TEXT
${voffset -1} Cpu1: ${color 9AB7DC}${cpu cpu1}% ${color 292929} ${color}Cpu2:${color 9AB7DC} ${cpu cpu2}% ${color 292929}<${color} P: ${color BB4E3F}${font}${processes}${color} R: ${color 7FBB3F}${font}${running_processes}${color 292929} ${color} Mem: ${color E8BCA7}${font}${mem}${color}${color 292929} ${color} Uptime: ${color 8D41CC}${font}${uptime_short}${color 292929} ${color E8BCA7}${font}${downspeed wlan0} Kb/s ${color} ${totaldown wlan0} down${color 292929} ${color} ${color E8BCA7}${upspeed wlan0} Kb/s ${color} ${totalup wlan0} up${color 292929} ${color}Main: ${color E8BCA7}${font}${fs_free /} ${color} ${color 292929} ${color}Temp: ${color D3BE4C}${font}${acpitemp}${color}C ${color 292929} ${alignr}${color}${time %A, %d %B} ${color E8BCA7}${time %H:%M}

Config File 2----桌面:
# set to yes if you want Conky to be forked in the background
background no

cpu_avg_samples 2
net_avg_samples 2

out_to_console no

#own window to run simultanious 2 or more conkys
own_window yes
own_window_transparent yes
own_windows_type widget
own_window_hints undecorated,sticky,skip_taskbar,skip_pager

# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0

#borders
draw_borders no
border_margin 1

#font
use_xft yes
xftfont BankGothic Md BT:pixelsize=12

#behaviour
update_interval 1

#colour
#default_color 000000
default_color D6D6D6
#default_color bfbfbf
#default_shade_color 000000
own_window_colour 202020
#draw_borders_colour 000000
#draw_graph_borders_colour 000000
#484432 95956B
# Text alpha when using Xft
xftalpha 0.8

#on_bottom no


# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area
minimum_size 260 5
maximum_width 300

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Stippled borders?
stippled_borders no

# border margins
border_margin 4

# border width
border_width 1

# Default colors and also border colors
default_color white
default_shade_color white
default_outline_color white

# Text alignment, other possible values are commented
#alignment top_left
#minimum_size 10 10
gap_x 20
gap_y 40
alignment top_right
#alignment bottom_left
#alignment bottom_right

# Gap between borders of screen and text

# Add spaces to keep things from moving about? This only affects certain objects.
use_spacer no

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# none, xmms, bmp, audacious, infopipe (default is none)
#xmms_player bmp

# boinc (seti) dir
# seti_dir /opt/seti

# Possible variables to be used:
#
# Variable Arguments Description
# acpiacadapter ACPI ac adapter state.
# acpifan ACPI fan state
# acpitemp ACPI temperature.
# adt746xcpu CPU temperature from therm_adt746x
# adt746xfan Fan speed from therm_adt746x
# battery (num) Remaining capasity in ACPI or APM
# battery. ACPI battery number can be
# given as argument (default is BAT0).
# buffers Amount of memory buffered
# cached Amount of memory cached
# color (color) Change drawing color to color
# cpu CPU usage in percents
# cpubar (height) Bar that shows CPU usage, height is
# bar's height in pixels
# downspeed net Download speed in kilobytes
# downspeedf net Download speed in kilobytes with one
# decimal
# exec shell command Executes a shell command and displays
# the output in torsmo. warning: this
# takes a lot more resources than other
# variables. I'd recommend coding wanted
# behaviour in C and posting a patch :-).
# execi interval, shell Same as exec but with specific interval.
# command Interval can't be less than
# update_interval in configuration.
# fs_bar (height), (fs) Bar that shows how much space is used on
# a file system. height is the height in
# pixels. fs is any file on that file
# system.
# fs_free (fs) Free space on a file system available
# for users.
# fs_free_perc (fs) Free percentage of space on a file
# system available for users.
# fs_size (fs) File system size
# fs_used (fs) File system used space
# hr (height) Horizontal line, height is the height in
# pixels
# i2c (dev), type, n I2C sensor from sysfs (Linux 2.6). dev
# may be omitted if you have only one I2C
# device. type is either in (or vol)
# meaning voltage, fan meaning fan or temp
# meaning temperature. n is number of the
# sensor. See /sys/bus/i2c/devices/ on
# your local computer.
# kernel Kernel version
# loadavg (1), (2), (3) System load average, 1 is for past 1
# minute, 2 for past 5 minutes and 3 for
# past 15 minutes.
# machine Machine, i686 for example
# mails Mail count in mail spool. You can use
# program like fetchmail to get mails from
# some server using your favourite
# protocol. See also new_mails.
# mem Amount of memory in use
# membar (height) Bar that shows amount of memory in use
# memmax Total amount of memory
# memperc Percentage of memory in use
# new_mails Unread mail count in mail spool.
# nodename Hostname
# outlinecolor (color) Change outline color
# pre_exec shell command Executes a shell command one time before
# torsmo displays anything and puts output
# as text.
# processes Total processes (sleeping and running)
# running_processes Running processes (not sleeping),
# requires Linux 2.6
# shadecolor (color) Change shading color
# stippled_hr (space), Stippled (dashed) horizontal line
# (height)
# swapbar (height) Bar that shows amount of swap in use
# swap Amount of swap in use
# swapmax Total amount of swap
# swapperc Percentage of swap in use
# sysname System name, Linux for example
# time (format) Local time, see man strftime to get more
# information about format
# totaldown net Total download, overflows at 4 GB on
# Linux with 32-bit arch and there doesn't
# seem to be a way to know how many times
# it has already done that before torsmo
# has started.
# totalup net Total upload, this one too, may overflow
# updates Number of updates (for debugging)
# upspeed net Upload speed in kilobytes
# upspeedf net Upload speed in kilobytes with one
# decimal
# uptime Uptime
# uptime_short Uptime in a shorter format
#
# seti_prog Seti@home current progress
# seti_progbar (height) Seti@home current progress bar
# seti_credit Seti@hoome total user credit


# variable is given either in format $variable or in ${variable}. Latter
# allows characters right after the variable and must be used in network
# stuff because of an argument
#${font Dungeon:style=Bold:pixelsize=10}I can change the font as well
#${font Verdana:size=10}as many times as I choose
#${font Perry:size=10}Including UTF-8,
# stuff after 'TEXT' will be formatted on screen
#${font Grunge:size=12}${time %a %b %d}${alignr -25}${time %k:%M}
#mpd
mpd_host localhost
mpd_port 6600


##${color a4a4a4}${alignc 2}${font DejaVu Sans Mono:size=18}${execi 1 ~/.conky/scripts/mpd.awk}
TEXT

${color #ffffff}CPU Usage PID CPU% MEM%
${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color #ffffff} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color #ffffff} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color #ffffff} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
${color #ffffff} ${top name 5} ${top pid 5} ${top cpu 5} ${top mem 5}
${color #ffffff} ${top name 6} ${top pid 6} ${top cpu 6} ${top mem 6}
${color #ffffff} ${top name 7} ${top pid 7} ${top cpu 7} ${top mem 7}
${color #ffffff}Mem Usage
${color lightgrey} ${top_mem name 1} ${top_mem pid 1} ${top_mem cpu 1} ${top_mem mem 1}
${color #ffffff} ${top_mem name 2} ${top_mem pid 2} ${top_mem cpu 2} ${top_mem mem 2}
${color #ffffff} ${top_mem name 3} ${top_mem pid 3} ${top_mem cpu 3} ${top_mem mem 3}
${color #ffffff} ${top_mem name 4} ${top_mem pid 4} ${top_mem cpu 4} ${top_mem mem 4}
${color #ffffff} ${top_mem name 5} ${top_mem pid 5} ${top_mem cpu 5} ${top_mem mem 5}
${color #ffffff} ${top_mem name 6} ${top_mem pid 6} ${top_mem cpu 6} ${top_mem mem 6}
${color #ffffff} ${top_mem name 7} ${top_mem pid 7} ${top_mem cpu 7} ${top_mem mem 7}

${color #ffffff}Network: ${color lightgrey}${addr wlan0}

${color #ffffff}Down:${color lightgrey} ${downspeed wlan0} k/s $alignr${color #ffffff} Up:${color lightgrey} ${upspeed wlan0} k/s
${color #EEFF4F}${downspeedgraph wlan0 27,120 000000 ffffff 180} $alignr${color #EEFF4F}${upspeedgraph wlan0 27,120 000000 EEFF4F 25}
${color lightgrey}${totaldown wlan0} $alignr${color lightgrey}${totalup wlan0}

${color #ffffff}Port(s)${alignr}#Connections
${color #ffffff}Inbound: ${color lightgrey}${tcp_portmon 1 32767 count} ${color #ffffff}Outbound: ${color lightgrey}${tcp_portmon 32768 61000 count}${alignr}${color #ffffff}Total: ${color lightgrey}${tcp_portmon 1 65535 count}

${color #ffffff}Inbound Connection ${alignr} Local Service/Port${color lightgrey}
${tcp_portmon 1 32767 rhost 0} ${alignr} ${tcp_portmon 1 32767 lservice 0}
${tcp_portmon 1 32767 rhost 1} ${alignr} ${tcp_portmon 1 32767 lservice 1}
${tcp_portmon 1 32767 rhost 2} ${alignr} ${tcp_portmon 1 32767 lservice 2}
${tcp_portmon 1 32767 rhost 3} ${alignr} ${tcp_portmon 1 32767 lservice 3}
${tcp_portmon 1 32767 rhost 4} ${alignr} ${tcp_portmon 1 32767 lservice 4}


${font}${color 668ABF}${alignc}${voffset -15}${mpd_status}

${color 9AB7DC}Random:${color a4a4a4}${alignr}${mpd_random}

${color 9AB7DC}Artist:
${color a4a4a4}${mpd_artist}
${color 9AB7DC}Title:
${color a4a4a4}${mpd_title}
${color 9AB7DC}Album:
${color a4a4a4}${mpd_album}

${color a4a4a4}${mpd_elapsed}${alignr}${mpd_length}
${color 668ABF}${mpd_bar 3,85}

比如两个文件分别保存为.conkyrc_top和.conkyrc_desktop在用户目录的.conky文件夹里面。那么在/usr/local/bin/ 下面新建一个文件conky_all.
# sudo nano /usr/local/bin/conky_all

文件填入以下三行:
#!/bin/bash
conky -c ~/.conky/.conkyrc_top &
conky -c ~/.conky/.conkyrc_desktop
退出并保存。然后加入执行权限:
# sudo chmod +x /usr/local/bin/conky_all

加入到开机启动程序里面:
Main Menu >> System >> Administration >> Sessions >> Add
像这样填入:
这样就完成了,效果图:
还算可以吧,剩下的设置都很简单,就不赘述了。
总之,这只是我个人的经验,可以说单是Conky的经验,希望大家不要总把眼睛放在外在的东西上,多学点有用的东西才是第一位的。

下决心考RHCE了!

我性格中存在太大的惰性,只要不是下决心做的事情总是不会特别用心。想考RHCE已经很久了,一开始是时间不够的时候总想着学校考试为先,现在考完试了但用电脑还是不去做正事。只好下决心去做这件事了,可能会很难,但总比天天空想要好。今天做了下RHCE的自我评估测试题,共12页,似乎很差啊~!只有21分,需要进行培训。万事开头难~这个就留作通过认证考试以后看吧,Fight!
Copyright © 2006 - 2009 iCNPunk.BlogSpot.COM All rights reserved By ZerOnenOreZ & Blogger
Template Designed By iCNPunk Fixed for IE7