gnome-screensaver replacement

My favorite screensaver is "nose man" from href="http://www.tux.org/~bagleyd/xlockmore.html">xlockmore, but
gnome screensaver seems no way to use it. I don't want to spend time
to hack gnome-screensaver's configuration, instead, I found this
alternative screen lock program - xautolock. Xautolock can lock the
screen use any lock program, so it's possible to invoke xlockmore's
binary "xlock" with whatever mode you like.

Xautolock also has a cool feature, it can lock the screen when the
mouse is over a screen corner with a customized delay.

To install:

$ sudo apt-get install xlockmore xautolock

Here are the arguments to call xautolock, logged here to prevent read
the long man page again.

# replace gnome-screensaver, lock screen if idle for 5 minutes, or
# mouse over a corner for 3 seconds
#
msg="All money go my home :-)"
/usr/bin/xautolock \
-corners ++++ -cornerdelay 3 -cornerredelay 30 \
-time 5 -locker "/usr/bin/xlock -mode nose -message '$msg'" &

Put this to /etc/rc.local (for ubuntu), it will be
executed by /etc/rc2.d/S99rc.local on boot up.
Since it's an X11 program, it could be started only after a user logged in
to X. To start it automatically for gnome X manager, use session manager
tool to add an entry is a handy way, "System" -> "Preference" ->
"Sessions".

Also, you can create a shortcut point to command xautolock
-locknow
to lock the screen immediately.

Goodbye, gnome-screensaver.

$ killall gnome-screensaver
$ sudo apt-get remove gnome-screensaver

Apr 15, 2008 at 10:23pm | 1 Comment
Tags: , and

qtconfig 可调整 Qt 应用程序界面风格

Ubuntu 中默认的 Qt 应用程序界面很丑陋,装 qt3-qtconfig 这个包,就可用 qtconfig 这个 GUI 的工具来调整 QT 应用程序的界面风格,Qterm、Skype 这类程序的窗口可以漂亮很多。

qtconfig

Nov 11, 2006 at 4:06am | 0 Comments
Tags:

Ubuntu 上自动 mount NIS 用户的主目录

Ubuntu 6.06 LTS,在 NIS 网络中不能自动 mount 主目录实在不方便,今天读了一下 automount(8),/etc/init.d/autofs 和 /etc/auto.net 终于把它弄出来了。关键是用 program 这种形式来运行 automount,对应 的 program 程序要根据输入的 key 输出它的 mount option,mount point 和 mount entry,在 auto home 的情形下 key 当然应该用用户名。

步骤如下:

先建立一个脚本 /etc/auto.home:

#!/bin/bash

[ -z "$1" ] && exit 1

user=$1
options="-fstype=nfs,hard,intr,nodev,nosuid,nonstrict,async"

info=$(ypcat -k auto.home | grep -w ^$user) || exit 1
# username [options] nfsdir
set -- $info

if [ -n "$3" ]; then
options="$options,$2"
nfsdir="$3"
else
nfsdir="$2"
fi

echo $options / $nfsdir

加上执行权限 chmod +x /etc/auto.home,很重要!

/etc/auto.home user123 测试一下,输出应该类似这样才对:
-fstype=nfs,hard,intr,nodev,nosuid,nonstrict,async / home1.prc:/global/export/home1/user123

然后执行 automount --timeout=30 /home program /etc/auto.home
ls /home/user123 试一下,应该能列出目录,表示工作正常。

杀掉刚才这个进程,在 /etc/auto.mater 中加入一行

/home   /etc/auto.home

然后 /etc/init.d/autofs restart 就 OK 了。

Update on Mar 16, 2007:现在知道了有直接支持这个 NIS 映射自动加载的设置,man auto.master 就有了。只需要先执行 ypcat -k auto.master 得到映射表,如 /home 对应 auto.home,再在 /etc/auto.master 里加上一行 /home yp:auto.home 即可实现 /home 目录的自动加载。另外,上面这个脚本也不是没有用,它是通用办法,可以自己控制自动加载的行为。

Sep 15, 2006 at 12:52am | 0 Comments
Tags: , and

One line fix accepted

昨天没去参加 Novell 在海洋馆举行的 SUSE Linux 宣传活动,据说是大名鼎鼎的 suzhe 讲的,有点后悔。打开信箱发现了一个安慰:前段时间为 ubuntu gdm 做的一个 bugfix
今天进到 gdm 2.15.9 了。虽然只是一个 one line fix,但是查到根源还不是那么容易滴~,要不这么容易重现的 bug
怎么晾在那两个月之久都没人解决呢。嘿嘿,虚荣一下。

From: SebastienBacher < ubuntu>
Reply-To: Bug 48876 <4887unchpad.net>
To: dotway at gmaom
Date: Aug 16, 2006 11:44 PM
Subject: [Bug 48876] Re: gnome-session fails when "alias ls='ls
--color'" in .profile

Fixed to edgy with this upload:

 gdm (2.15.9-0ubuntu2) edgy; urgency=low
 .
  * debian/Xsession:
    - specify "ls" path, fix gnome-session
not starting due to some parsing
      issues for people
using an ls="ls --color" alias to their profile,
      thanks to Matthew
Wang <dotway at gmaom> from tracking it and
      suggesting the
change (Ubuntu: #48876)

** Changed in: gdm (Ubuntu)
      Status: Fix
Committed => Fix Released

--
gnome-session fails when "alias ls='ls --color'" in .profile
https://launchpad.net/bugs/48876

Email地址做了处理,相信不会有 spam 智能到能识别 at 同时还能解析 javascript。

Aug 17, 2006 at 8:31pm | 1 Comment
Tags:

为 ubuntu 做了点微小的贡献

周五下班前遇到一个怪问题,gnome-session 突然启动失败,日志文件里也看不出问题根源。今天在家决心把它调试出来。过程很是费劲,首先要用 vpn 连到公司网络,然后 SecureCRT 登陆上公司机器,安装 x11vnc,还得一个 X Server 才能在公司机器上运行 X 程序,不想折腾 X-win32 或别的了,自己 VMware 里面也装了 ubuntu,启动 X 然后从里面 ssh -X 过去就可以启用 X11 Forwarding了。光这些还不行,x11vnc 是启动不了,因为用户还没有登陆,需要设置 gdm 自动登陆用户。运行 /usr/sbin/gdmsetup 可以设置自动登陆,后来发现还可以直接修改 /etc/gdm/gdm.conf-custom,增加这样一段(后面注释掉的三行是超时自动登陆的设置):

[daemon]
AutomaticLoginEnable=true
AutomaticLogin=username
#TimedLoginEnable=true
#TimedLoginDelay=10
#TimedLogin=username

然后重启 gdm,不停用 w 命令观察,果然看到用户正在自动登陆,执行的命令是 /etc/gdm/Xsession,接下来应该就是失败了弹出对话框了,因为正常的应该是执行到 /usr/bin/gnome-session。打开 /etc/gdm/Xsession 看了看,太多没耐心看,在第一行 #!/bin/sh 后面加 -x 参数,然后在第一条命令前加

exec 1>/tmp/x.log
exec 2>&1

再重启 gdm,看 /tmp/x.log,看到

++ '[' '!' -d /etc/X11/Xsession.d ']'
+++ /bin/ls -F --color /etc/X11/Xsession.d
++ for F in '$(ls $1)'
++ expr '^[[0m^[[0m20xorg-common_process-args^[[0m' : '[[:alnum:]_-]\+$'
++ for F in '$(ls $1)'
++ expr '^[[0m30xorg-common_xresources^[[0m' : '[[:alnum:]_-]\+$'
...

哈哈,看到那些 ^[[0m 控制字符我就明白了,问题在于 ls 被 alias 成了 '/bin/ls -F --color' 了,颜色控制字符搞的鬼。想不到大牛也能犯这种低级错误啊 :)。再读了一下,脚本会读取 /etc/profile 和 $HOME/.profile,如果它们中任一个设了那种 --color 的 alias,就会导致这个失败,我的情况正好是 /etc/profile 中设置了,很土吧?

Fix 就很简单了,把 ls 改成绝对路径 /bin/ls 就行了。

想到解决过程的麻烦,我决定到 bug 数据库里面去报一报,查了一下,果然有人遇到过,并且报告了,但没有解决到点子上,于是心情很爽的添加 comments。

Bug #48876: gnome-session fails when "alias ls='ls --color'" in .profile
Bug #45951 (duplicate)

Aug 6, 2006 at 5:30am | 0 Comments
Tags: and

 1

Tags

Blogroll

Fairy World | STUPiD | 阅微草堂 | ShelleX | 流浪五天