setxkbmap在rc.local启动时没有运行

我想跑

setxkbmap -option caps:escape 

在Kubuntu 15.04中的/etc/init.d/下的rc.local文件中,无论我把它放在哪里,开始或结束,或者在它前面有exec,它都没有运行。 基本上,我希望能够运行gvim with caps作为转义,我真的不想把它放到.bashrc中,因为每次打开终端都会运行(不必要)而且我希望能够在没有首先打开bash的情况下运行gvim,并且仍然使用大写作为转义。

此命令在命令行中正常工作。

整个rc.local看起来像这样:

 #! /bin/sh ### BEGIN INIT INFO # Provides: rc.local # Required-Start: $all # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: # Short-Description: Run /etc/rc.local if it exist ### END INIT INFO /usr/bin/setxkbmap -option caps:escape PATH=/sbin:/usr/sbin:/bin:/usr/bin . /lib/init/vars.sh . /lib/lsb/init-functions do_start() { if [ -x /etc/rc.local ]; then [ "$VERBOSE" != no ] && log_begin_msg "Running local boot scripts (/etc/rc.local)" /etc/rc.local ES=$? [ "$VERBOSE" != no ] && log_end_msg $ES return $ES fi } case "$1" in start) do_start ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) ;; *) echo "Usage: $0 start|stop" >&2 exit 3 ;; esac 

难道我做错了什么? 还有什么办法可以得到相同的结果吗? 我没有运行Unity,因此compizconfig将无法运行。

在实际的X GUI会话启动之前,不要认为在名称中运行任何带有“x”的程序是有用的。

把它放入’启动应用程序’(或在KDE中调用它)。