Label Cloud

Monday, December 8, 2008

ubuntu技巧收集

如何有一个拥有显示全部安装程序的菜单?




打开应用程序菜单,你或许会疑惑:怎么有些软件没有在里面显示呢? 解释: Gnome和KDE使用freedesktop.org 最近开发的一种通用菜单格式,使得程序开发者只需要向他们的程序里加入几行文字,就可以让程序自动在菜单里出现。XFCE也使用这种标准。 不过,因为这种标准是最近才开发的,所以Ubuntu软件仓库里的很多软件包里还没有包含这种菜单信息。 好消息是Debian有自己的一套菜单系统(已经用了好几年了),所有使用apt安装的软件都会在Debian菜单里出现。你也可以在Ubuntu里使用它。 安装:
确定你启用了 universe 软件仓库
使用 synaptic 或者 apt-get 安装 menu
在终端运行: sudo update-menus 现在打开应用程序菜单,你会发现一个新的子菜单 Debian,里面包含了你安装的所以软件(deb格式)。每当一个使用debian 菜单的软件被安装了,update-menu 就会自动运行。 以上同样适用于kubuntu。Debian菜单会在K菜单里出现。 其他的桌面环境也可以使用Debian 菜单,如果不行(XFCE好像不行?),可以这样: 1 安装pdmenu 2 在终端运行 pdmenu 这样Debian菜单会在ncurses里给出。 有关menu的文档可以在以下目录找到 /usr/share/doc/menu/ 帮助页面在 /usr/share/doc/menu/html/

如何混音



为什么我在同时打开两个应用程序时不能听到声音呢? 大多数Linux初学者都遇到这样一个问题:“为什么我在同时打开两个应用程序时不能听到声音呢?”这是因为你的声卡需要“软混音”。值得庆幸的是,ALSA提供了这项功能,这使得解决这个问题并不是很难。 首先需要安装libesd-alsa0,它就在Ubuntu官方软件库中。

sudo apt-get install libesd-alsa0
然后,用sudo gedit或您喜欢的文本编辑器创建文件/etc/asound.conf(请确定您使用了sudo,因为您需要root权限):


sudo gedit /etc/asound.conf
输入一下内容并保持关闭。

pcm.card0 {
type hw
card 0
}
pcm.!default {
type plug
slave.pcm "dmixer"
}
pcm.dmixer {
type dmix
ipc_key 1025
slave {
pcm "hw:0,0"
period_time 0
period_size 1024
buffer_size 4096
periods 128
rate 44100
}
bindings {
0 0
1 1
}
}


(上面的文件可以在大多数声卡上正常运行…尽管我成功地测试了三个不同的声卡,但我还是不能确保它可以使所有声卡都能正常运行)

接下来,运行

sudo gedit /etc/esound/esd.conf
,将文件改成下面的内容:

[esd]
auto_spawn=1
spawn_options=-terminate -nobeeps -as 2 -d default
spawn_wait_ms=100
# default options are used in spawned and non-spawned mode
default_options=

然后打开您的Gnome声音控制面板并启用声音服务器,接着到多媒体系统选择控制面板,将其设成ALSA或ESD,并重启计算机。 接下来您就可以将应用程序设成使用ALSA或ESD,这样您就可以一次听到多个声音了。就算是玩着用ALSA发音的游戏并听到使用ESD的GNOME应用发出的声音也没有任何问题! 有些朋友在hoary上按照上述的方法设置却遇到了问题,他们不能在mozilla/firefox/epiphany程序中听到声音,结果我发现在启动 firefox时,程序查找libesd.so.1而系统却只有libesd.so.0,所以只要运行命令

sudo ln -s /usr/lib/libesd.so.0 /usr/lib/libesd.so.1
后就可以解决这个问题了

Increase resolution
Edit /boot/grub/menu.lst

gksudo gedit /boot/grub/menu.lst

Add vga=792 to your default boot option. Example:

titleUbuntu, kernel 2.6.10-5-k7 Default
root(hd0,0)
kernel/vmlinuz root=/dev/hde6 ro quiet splash vga=792
initrd/initrd.img
savedefault
boot


Colorize "[ ok ]"
NOTE : does not work with 5.10 Breezy. Use solution given there. (ed. 28/12/2005) EDIT : This does NOT work with the default Feisty install, it will break your boot and you will need a rescue CD to fix it, until further revised, do NOT use this on Feisty.(omegabeta 01,aug,07. NOTE : This does not work in Dapper either, so I am not sure what version this how-to is written for. For Dapper see below. We make the "[ ok ]" during bootup green

Edit /lib/lsb/init-functions
gksudo gedit /lib/lsb/init-functions

Find the log_end_msg () function, all the way at the bottom of the file and add GREEN=`$TPUT setaf 2` belowRED=`$TPUT setaf 1`
Change echo "$UP$END[ ok ]" to echo "$UP$END[ ${GREEN}ok${NORMAL} ]"
The function should look like this:

log_end_msg () {

# If no arguments were passed, return
[ -z "$1" ] && return 1

# Only do the fancy stuff if we have an appropriate terminal
# and if /usr is already mounted
TPUT=/usr/bin/tput
EXPR=/usr/bin/expr
if [ -x $TPUT ] && [ -x $EXPR ] && $TPUT hpa 60 >/dev/null 2>&1; then
COLS=`$TPUT cols`
if [ -n "$COLS" ]; then
COL=`$EXPR $COLS - 7`
else
COL=73
fi

UP=`$TPUT cuu1`
END=`$TPUT hpa $COL`
START=`$TPUT hpa 0`
RED=`$TPUT setaf 1`
GREEN=`$TPUT setaf 2`
NORMAL=`$TPUT op`
if [ $1 -eq 0 ]; then
echo "$UP$END[ ${GREEN}ok${NORMAL} ]"
else
echo -e "$UP$START $RED*$NORMAL$END[${RED}fail${NORMAL}]"
fi
else
if [ $1 -eq 0 ]; then
echo " ...done."
else
echo " ...fail!"
fi
fi
return $1
}

==Colorize Dapper [ ok ]== (Also works for Feisty) You need to edit /etc/lsb-base-logging.sh

$TPUT setaf 4 # blue
printf '[ '
$TPUT setaf 2 # green
printf ok
$TPUT setaf 4 # blue
echo ' ]'
$TPUT op # normal


Finalize
Reboot, and your resolution should be increased. Your [ ok ] messages should now be green. Credits: dudinatrix

No comments: