轻量级桌面 openbox + tint2 + conky + stalonetray + pcmanfm + xcompmgr

openbox+tint2+pnmixer+conky=轻量级archlinux桌面环境设置备忘
缘起
机器上的Ubuntu 12.04有一段时间没有使用了,最近在用的时候发现频繁死机的情况,开始以为是unity的原因,于是换成了gnome3,然而好景不长很快又频繁死机了。作为一个懒得折腾的人,还是重装系统最省事了。想来想去,还是装了archlinux。
设置
安装过程不必细说,arch的wiki上有详细的说明。这里只是简单的记录下配置过程。
网络配置
使用wicd替换了默认的netctl

systemctl stop netctl
systemctl disable netctl
pacman -S wicd wicd-gtk
systemctl start wicd
systemctl enable wicd

并在~/.config/openbox/autostart中加入wicd-gtk -t &
图形界面
图形界面我选择了轻量级的openbox。
pacman -S openbox
然后是openbox配置的一系列工具
openbox主题及设置工具
pacman -S openbox-themes obconf
openbox右键菜单我选用了AUR的obmenu-generator,其动态菜单(pipe menu)功能尤其方便,在安装了新的软件后也无需重新设置右键菜单。
yaourt -S obmenu-generator
快捷键编辑工具obkey和菜单编辑工具obmenu
pacman -S obkey obmenu
安装轻量级登录管理器slim
pacman -S slim
桌面环境
面板使用了tint2,在启动脚本中添加tint2 &
yaourt -S tint2-svn tint2-themes tint2wizard
尽管安装了tint2的设置工具,我目前使用的依然是tint2的默认主题,因为基本上能满足我的需求:)。
其他的面板工具可以尝试下fbpanel、wbar、xfce4-panel等,总有一款panel适合你。
音量控制使用了pnmixer,在启动脚本中加入pnmixer &
yaourt -S pnmixer
轻量级监控工具conky及conky配置生成工具conky-colors
yaourt -S conky conky-colors
在启动脚本中加入/usr/share/conkycolors/bin/conkyStart &
壁纸工具使用了nittrogen
pacman -S nittrogen
选择壁纸后在启动脚本中加入nitrogen --restore &
阴影工具使用了compton-git
yaourt -S compton-git
在启动脚本中加入compton -cC -f -i 1.0 -e 1.0 -o 1.0 -r 6 -l -9 -t -9 -I 0.05 -O 0.05 -D 2 -G -b &
其他工具
文件管理器 pacman -S pcmanfm
看图工具 pacman -S geeqie gpicview
图片编辑 pacman -S gimp
浏览器 pacman -S chromium
输入法 pacman -S fcitx fcitx-googlepinyin
在~/.xinitrc中加入

export LANG=zhCN.UTF-8
export LCALL="zhCN.UTF-8"
export XMODIFIERS=@im=fcitx
export GTKIMMODULE=fcitx
export QTIM_MODULE=fcitx

并在启动脚本中加入fcitx &
文字编辑工具 yaourt -S kingsoft-office
pdf阅读器 yaourt -S mupdf apvlv
屏幕保护程序 yaourt -S xscreensaver


*****************************************************************************
轻量级桌面 openbox + tint2 + conky + stalonetray + pcmanfm + xcompmgr

轻量级桌面果然很难弄..还好我之前是用gnome的比较起来会简单一点
首先是安装需要的软件了
sudo aptitude install openbox obconf obmenu conky stalonetray pcmanfm xcompmgr 
tint2我是编译安装对的
首先到tint2 google code下载源码 
http://code.google.com/p/tint2/
然后
 
cd /home/wdstudio/Desktop/tint2-0.9
./configure  
make
sudo make install
安装完毕了
暂时需要的软件就有了
logout在登录时选则openbox-session
不用在~/.xinitrc里加入exec openbox-session这么麻烦反正我们有gdm...
到这里就进入openbox了,看起来很糟糕
首先先调用pcmanfm , 是用来代替nautilus的,虽然我很喜欢nautilus 不过貌似nautilus 和openbox经常打架就换轻量级的pcmanfm
恩,让pcmanfm每次都启动的话要在~/.config/openbox/autostart.sh中添加
( sleep 2 && pcmanfm -d ) &
忘记哪里找来的语句了,和大多数人都不一样... 记得sleep 2 &&是让openbox和要启动的程序有一些缓冲时间 pcmanfm -d 则是让pcmanfm在后台运行 每行结束都要加上 &
各位自己去折腾一下pcmanfm把,壁纸等都能用他设定了
# update-mime-database /usr/share/mime
# update-desktop-database
这两行很重要,不然会丢失所有的文件关联
这个时候的openbox还很简略没有成型
不过没关系从终端运行obmenu就可以定制openbox的右键了
obconf是openbox的设定可以换主题等
sudo aptitude install openbox-themes安装主题,当然gnome-look等地方还有很多好看的主题
 
# Run the system-wide support stuff
. $GLOBALAUTOSTART
# feh --bg-scale /home/wdstudio/Pictures/Wallpaper/wallpaper_0150.jpg &
#xcompmgr
if which xcompmgr > /dev/null; then
xcompmgr -Ss -n -Cc -fF -I-10 -O-10 -D1 -t-3 -l-4 -r4 &
fi
(sleep 2 && conky ) &
(sleep 2 && /usr/local/bin/tint2 ) &
(sleep 2 && pcmanfm -d ) &
# (sleep 2 && nautilus --no-desktop ) &
( sleep 2 && stalonetray ) &
#( sleep 2 && /usr/bin/dmenu_run & ) &
( sleep 2 && dropbox ) &
( sleep 2 && gnote ) &
这是我的autostart.sh

关于openbox的快捷键就要手动编辑了
vi ~/.config/openbox/rc.xml
找到<keyboard>部分
快捷键的编写其实很见到找到规律就好了
最长见的有
<keybind key="KEY">
<action name="Execute"
<execute>command</execute>
</action>
</keybind>
KEY代表你要的快捷键
command就是指令了
比如
    <keybind key="A-t">
      <action name="Execute">
        <execute>gnome-terminal</execute>
      </action>
    </keybind>
    <keybind key="W-e">
      <action name="Execute">
        <execute>pcmanfm ~</execute>
      </action>
    </keybind>
一个是terminal的一个是pcmanfm的
具体可以看http://openbox.org/wiki/Help:Actions
之后就是tint2了在上面的autostart.sh里面已经看到tint2自动启动了
tint2的配置文件在./config/tint2/tint2rc
怎么配置打架自己着墨吧

autostart.sh里面的xcompmgr -Ss -n -Cc -fF -I-10 -O-10 -D1 -t-3 -l-4 -r4 &
就是调用xcompmgr让窗口出现阴影效果,关于xcompmgr的具体我自己都不清楚,等下去google了

conky就不用多说了, ( sleep 2 && conky ) & 搞定,如此简单
附上我的配置
background yes
# Use Xft?
use_xft yes
xftfont Comic Sans MS:size=8

use_spacer top_right

# Update interval in seconds
update_interval 1

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

# Create own window instead of using desktop (required in nautilus)
own_window  yes
own_window_transparent yes
own_window_type widget
own_window_hints undecorate,sticky,skip_taskbar,skip_pager 

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

# Minimum size of text area
#minimum_size 280 5

maximum_width 150

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Stippled borders?
stippled_borders 0

# border margins
border_margin 5

# border width
border_width 0

# Default colors and also border colors
default_color 4d4d4d
#default_shade_color white
#default_outline_color black
own_window_colour 262626

# Text alignment, other possible values are commented
#alignment top_left
alignment top_right
#alignment bottom_left
#alignment bottom_right

# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 5
gap_y 5

# Subtract file system buffers from used memory?
no_buffers yes

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

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

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

TEXT
${font OpenLogos:size=26}      B
${color 8F8F8F}${alignc 23}${font DotMatrix:size=16}      ${time %k:%M}
${font}${color EE6363}${alignc}${voffset -10}${time %B} ${time %Y}

${color 7C96B0}${font DejaVu Sans Mono:size=6}${execpi 300 DJS=`date +%_d`; cal | sed '1d' | sed '/./!d' | sed 's/$/                     /' | fold -w 21 | sed -n '/^.{21}/p' | sed 's/^/${alignc} /' | sed /" $DJS "/s/" $DJS "/" "'${color 98AE68}'"$DJS"'${color 8F8F8F}'" "/}${font}

${color 7C96B0}Kernel:${color 8F8F8F}${alignr}$kernel
${color 7C96B0}UpTime:${color 8F8F8F}${alignr}$uptime
${color 7C96B0}CPU : ${color 8F8F8F}${alignr}AMD X4 630
${color 7C96B0}Core One:${color 8F8F8F}${alignr}${cpu cpu1}% ${color EE6363}
#${color 7C96B0}Core 1 temp:${color EE6363}${alignr}${execi 20 sensors it8718-isa-0290 |grep temp1 |cut -c15-16}°C
${color 262626}${cpugraph cpu1 20,85 262626 1E1E1E} 
${color 7C96B0}Core Two:${color 8F8F8F}${alignr}${cpu cpu2}% ${color EE6363}
#${color 7C96B0}Core 2 temp:${color EE6363}${alignr}${execi 20 sensors it8718-isa-0290 |grep temp2 |cut -c15-16}°C
${color 262626}${cpugraph cpu2 20,85 262626 1E1E1E} 
${color 7C96B0}Ram:${color 8F8F8F}${alignr}$mem
${color 1A1A1A}${membar 3,85}

#${color 7C96B0}Public Ip:${color EE6363}${alignr}${execi 1 ~/.scripts/ip.sh}  ${color EE6363}|${color}  ${color EE6363}
${color 7C96B0}Public Ip:  ${execi 3600 wget -O - http://whatismyip.org/ | tail}
${color 98AE68}${font PizzaDude Bullets:size=10}N${font}${color EE6363}${alignr}${upspeed eth0}KB/s
${color 262626}${upspeedgraph eth0 20,85 1E1E1E 1A1A1A}
${color 7C96B0}Total: ${color 8F8F8F}${totalup eth0}
${color 98AE68}${font PizzaDude Bullets:size=10}T${font}${color EE6363}${alignr}${downspeed eth0}KB/s
${color 262626}${downspeedgraph eth0 20,85 1E1E1E 1A1A1A}
${color 7C96B0}Total: ${color 8F8F8F}${totaldown eth0}

${color 98AE68}Disk IO:${color EE6363} ${alignr 4}$diskio
#${color 7C96B0}Main HardDisk Temp:${color EE6363}${alignr}${execi 300 nc localhost 7634 | cut -c23-24;} °C
${color 262626}${diskiograph 20,85 1E1E1E 1A1A1A}
${color 7C96B0}WDSTUDIO:${color 8F8F8F}${alignr}${fs_free /home/wdstudio/}
${color 1A1A1A}${fs_bar 3,85 /home/wdstudio/}
${color 7C96B0}File:${color 8F8F8F}${alignr}${fs_free /media/File/}
${color 1A1A1A}${fs_bar 3,85 /media/File/}
${color 7C96B0}Data:${color 8F8F8F}${alignr}${fs_free /media/Data/}
${color 1A1A1A}${fs_bar 3,85 /media/Data/}
${color 7C96B0}eMule:${color 8F8F8F}${alignr}${fs_free /media/eMule/}
${color 1A1A1A}${fs_bar 3,85 /media/eMule/}

${color 7C96B0}PROCESSES ${hr 2}
${color 7C96B0}NAME             ${goto 110}PID${goto 138}CPU%${goto 175}MEM%
${color 7C96B0}${top name 1}    ${goto 105}${top pid 1}${goto 138}${top cpu 1}${goto 175}${top mem 1}
${color 7C96B0}${top name 2}    ${goto 105}${top pid 2}${goto 138}${top cpu 2}${goto 175}${top mem 2}
${color 7C96B0}${top name 3}    ${goto 105}${top pid 3}${goto 138}${top cpu 3}${goto 175}${top mem 3}
${color 7C96B0}${top name 4}    ${goto 105}${top pid 4}${goto 138}${top cpu 4}${goto 175}${top mem 4}
${color 7C96B0}${top name 5}    ${goto 105}${top pid 5}${goto 138}${top cpu 5}${goto 175}${top mem 5}

#quod libet ${hr 2}

# ${voffset 4}${alignc 35}${font Buttons and Switches JL:size=26}wd${font}
#${voffset 7}${execi 7 quodlibet --print-playing '<title>'}
#${alignc 35} - ${execi 7 quodlibet --print-playing '<artist>'}

#Banshee ${hr 2}
#${voffset 7}${exec banshee-1 --query-title}
#${alignc 35}  -- ${exec banshee-1 --query-artist}
#${exec banshee-1 --query-track-number}
# ${exec banshee-1 --query-album}
#${exec banshee-1 --query-position}
我的.conkyrc坑坑洼洼的,大家不要介意
stalonetray是系统托盘,既然不在gnome了就没有gnome-panel了
用stalonetray来代替,配置文件在~/.stalonetrayrc
第一件是就是透明
transparent true
geometry 124x24+3-3
icon_gravity NW
window_layer bottom 
sticky true
这是我的配置

继续使用gtk主题和图标是我遇到最大的麻烦了,应该是安装lxappearance,gtk-chtheme就能解决问题的,可是我的图标被固定了不能换,自己写.gtkrc-2.0也不可以.gtkrc.mine也不可以
我就想到更简单的方法了,直接调用gnome-panel来换
$ gnone-panel
换好了在kill掉
$ pkill gnome-panel

以前习惯用gnome-do了,换到openbox当然什么都要light
那就上dmenu , 这个确实折腾了很长时间
( sleep 2 && dmenu_run & ) & 细心的人注意到了,dmenu_run 后面还有一个 &
配合  
 <keybind key="W-space">
      <action name="Execute">
        <command>dmenu_run</command>
      </action>
    </keybind>
刚刚好达到gnome-do的效果
忘记说了W代表Super,A代表Alt,C代表Ctrl,小的字母才是A-Z

不能忘记gnome下的Alt+F2 ,代替他的是gmrun
快捷键怎么写大家应该都知道了把

还有一个很重要的,那就是关于openbox的关机等脚本
感谢tony3322提供的脚本
cd /usr/local/bin
vi powerdown

#!/bin/bash
ans=$(zenity --list --title "Make your choice" --text "What should I do?"
--radiolist --column "Choice" --column "Action"
reboot reboot logout logout poweroff poweroff);
echo $ans
case $ans in
'reboot')
echo "reboot"
sudo reboot
;;
'logout')
echo "logout"
killall openbox
;;
'poweroff')
echo "poweroff"
sudo poweroff
;;
esac
保存起来
sudo chmod a+x powerdown
sudo visudo
添加
%users ALL=NOPASSWD: /sbin/halt
ALL ALL=NOPASSWD:/sbin/poweroff
ALL ALL=NOPASSWD:/sbin/reboot


在obmenu里面添加

差不多就是这样了
以后想到什么在添加把
最后附上截图





 
原文地址:https://www.cnblogs.com/huapox/p/3516155.html