xset使用详解

http://blog.sina.com.cn/s/blog_4dca847601009qhd.html


xset使用详解

 

  Xset是上层应用程序,主要用于在XWindow启动之后,对XWindow进行一些设置,在Linux中比较好的一点就是当你不知一个命令的用法时可以使用man

man xset

XSET(1)                                                                                                                                                XSET(1)

 

NAME

      xset - user preference utility for X

 

SYNOPSIS

      xset [-display display]

      [-b] [b {on|off}] [b [volume [pitch [duration]]]]

      [-bc] [bc]

      [-c] [c {on|off}] [c [volume]]

      [+dpms] [-dpms]

           [dpms standby [ suspend [off]]]     [dpms force {standby|suspend|off|on}]

      [fp=pathlist] [-fp=pathlist] [+fp=pathlist] [fp-pathlist][fp+pathlist]

      [fp default] [fp rehash]

      [-led [integer]] [+led [integer]]

      [led {on|off}]

      [mouse [accel_mult[/accel_div] [threshold]]] [mouse default]

      [p pixel color]

      [-r [keycode]]  [r [keycode]] [r {on|off}] [r ratedelay [rate]]

      [s [length [period]]] [s {blank|noblank}] [s {expose|noexpose}] [s{on|off}] [s default] [s activate] [s reset]

      [q]

 

DESCRIPTION

      This program is used to set various user preference options of thedisplay.

 

OPTIONS

      -display display

              This option specifies the server to use; see X(7).

 

      b   The  boption controls bell volume, pitch and duration. This option accepts up to three numerical parameters, a precedingdash(-), or a “on/off” flag.  Ifno               parameters are given, or the “on” flag is used, the system defaultswill be used.  If the dash or “off” are given, thebell will be turned off.  If only onenumerical  parameter  is given,the bell volume will be set to that value, as a percentage of itsmaximum.  Likewise, the second numerical parameterspecifies the bell pitch, in hertz, and the third numericalparameter specifies the duration in milliseconds. Note that not allhardware can vary the bellcharacteris              tics.  The X server will set the characteristicsof the bell as closely as it can to the user’s specifications.

      bc  The bc option controls bug compatibility modein the server, if possible; a preceding dash(-) disables the mode,otherwise the mode is enabled.  Various pre-R4clients pass illegal values in some protocol requests, and pre-R4servers did not correctly generate errors in thesecases.  Such clients, when run againstan  R4  server, will  terminate abnormally  or  otherwise fail tooperate correctly.  Bug compatibility modeexplicitly reintroduces certain bugs into the X server, so thatmany such clients can still be run.  This modeshould be used with care; new application development should bedone with this mode  disabled.

The server must support the MIT-SUNDRY-NONSTANDARD protocolextension in order for this option to work.

 

      c   The c  option controls  key click.   This option can take anoptional value, a preceding dash(-), or an “off”flag.  If no parameter or the “on” flagis              given, the system defaults will be used. If the dash or “off”flagis used, keyclick will be disabled.  If a valuefrom 0 to 100 is given, it is used to indicate volume, as apercentage of the maximum.  The X server will setthe volume to the nearest value that the hardware can support.

 

      -dpms   The -dpms option disablesDPMS (Energy Star) features.

 

      +dpms   The +dpms option enablesDPMS (Energy Star) features.

 

      dpms flags...

      The  dpms option allows the DPMS (Energy Star)parameters to be set.  The option can take up tothree numerical values, or the “force”flag followed by a DPMSstate.  The “force” flags forces the server toimmediately switch to the DPMS state specified. The DPMS state can be one of ‘standby’ or ‘suspend’ , ‘off’,‘on’  When  numerical values aregiven, they set the inactivity period (in units of seconds) beforethe three modes are activated.  The first valuegiven is for the “standby”mode, the second is for the“suspend”mode, and the third is for the“off”mode.  Setting these values implicitlyenables the DPMS features. A value of zero disables a particularmode.

 

fp= path,...

     The  fp=  sets the  font  path to the entries given in the path argument.  Theentries are interpreted by the server, not by theclient.  Typically theyare              directory names or font server names, but the interpretation isserver-dependent.

      fp default

              The default argument causes the font path to be reset to theserver’s default.

      fp rehash

              The rehash argument resets the font path to its current value,causing the server to reread the font databases in the current fontpath. This isgenerally              only used when adding new fonts to a font directory (after runningmkfontdir to recreate the font database).

      -fp or fp-

              The -fp and fp- options remove elements from the current fontpath.  They must be followed by a comma-separatedlist of entries.

 

      +fp or fp+

              This +fp and fp+ options prepend and append elements to the currentfont path, respectively.  They must be followed bya comma-separated list of entries.

 

      led    The  led option  controls the  keyboard LEDs.   This controls the turningon or off of one or all of the LEDs.  It acceptsan optional integer, apreceding              dash(-) or an “off”flag.  If no parameter or the“on”flag is given, all LEDs are turned on.  If apreceding dash or the flag “off”is given, all LEDs are turnedoff.   If a value between 1 and32 is given, that LED will be turned on or off depending on theexistence of a preceding dash.  A common LED whichcan be controlled is the “Caps Lock” LED.  “xsetled 3” would turn led #3 on. “xset -led 3” would turn itoff.  The particular LED values may refer todif              ferent LEDs on different hardware.

 

      mouse   The  moption controls the mouse parameters; it may be abbreviated to‘m’.The parameters for the mouse are ‘acceleration’and‘threshold’  Theacceleration              can be specified as an integer, or as a simplefraction.  The mouse, or whatever pointer themachine is connected to, will go ‘acceleration’ times as fast whenit travels more than  ‘threshold’ pixels in a short time. This way, the mouse can be usedfor precise alignment when it is moved slowly, yet it can be set totravel across the screen in a flick of the wrist whendesired.  One or both parameters for the m optioncan be omitted, but if only one is given,it              will be interpreted as the acceleration.  If noparameters or the flag ‘default’is used, the system defaults willbe set.

 

      p   The  p option  controls pixel colorvalues.  The parameters are the color map entrynumber in decimal, and a color specification.  Theroot backgroundcolors              may be changed on some servers by altering the entries forBlackPixel and WhitePixel.  Although these areoften 0 and 1, they need not be.  Also, a servermay choose to allocate those colors privately, in which case anerror will be generated.  The map entry must notbe a read-only color, or an error will result.

 

      r      The  r option controls the autorepeat. Invokingwith "-r", or "r off", will disable autorepeat, whereas "r", or "ron" will enable autorepeat. Following the "-r" or "r" option withan integer keycode between 0 and 255 will disable or enableautorepeat on that key respectively, but only if it makessense  for  theparticular  keycode.  Keycodesbelow 8 are not typically valid for this command. Example: "xset -r 10" will disable autorepeat for the "1" key onthe top row

of an IBM PC keyboard.

If the server supports the XFree86-Misc extension, or the XKBextension, then a parameter of ‘rate’ is accepted and should befollowed by zero, one or two numeric values. The first specifiesthe delay before autorepeat starts and the second specifies therepeat rate.  In the case that the server supportsthe XKBextension, the delay is the number of milliseconds beforeautorepeat starts, and the rate is the number of repeats persecond.  If the rate or delay isnot              given, it will be set to the default value.

 

      s  The s option lets you set the screen saverparameters.  This option accepts up to twonumerical parameters, a ‘blank/noblank’flag, an‘expose/noexpose’flag, an ‘on/off’ flag, an ‘activate/reset’ flag,or the ‘default’ flag. If no parameters or the ‘default’ flag isused, the system will be set to its default screen savercharacteristics.   The ‘on/off’flags simply turn the screen saver functions on oroff.  The ‘activate’ flag forces activation ofscreen saver  even if the screen saver had beenturned off.  The ‘reset’ flag forces deactivationof screen saver if it is active.  The ‘blank’ flagsets the preference to blank the video (if the hardware can do so)rather than display a background pattern, while ‘noblank’ sets thepreference to display a pattern rather than blank thevideo.  The ‘expose’ flag sets the preference toallow window exposures (the server can freely discard windowcontents), while ‘noexpose’ setsthe              preference to disable screen saver unless the server can regeneratethe screens without causing exposure events.  Thelength and period parameters for the  screen saverfunction determines how long the server must be inactive for screensaving to activate, and the period to change the background patternto  avoid  burnin.  The arguments are specified inseconds.  If only one numerical parameter isgiven, it will be used for the length.

      q   The q option gives youinformation on the current settings.

 

  有人肯定看到这一大堆的英文已经晕头转向了,还是希望有人把它汉化一下的,下面我来做一下汉化的工作,有一些解释都是我自己的理解有可能会不正确,希望哪天如果有人参考的话,发现明显的错误给予指出。

 

首先

-display根据英文字面的意思是指出是哪个display在跑这个Xserver,不过我试了好多次想用这个选项,还是没有成功,所以具体怎么用还是不知道。

-b打开和关闭电脑的嘟嘟的提示音,比如我们打开文件的是否,出错的时候发出的声音。但是听音乐还是可以照常听的

xset b on

xset b off

如果xset后面跟的是一个数值,哪默认提示音是打开的,并且它的音量就是此数值/100*最大音量。

 

-bc 关闭调试版本兼容机制

bc 打开调试版本兼容机制

xset –bc

xset bc

 

c 控制键盘的按键声

关闭/打开

xset c on

xset c off

 

dpms

xset –dpms 关闭电源之星

xset +dpms 打开电源之星,主要用来省电的

xset dpms 后面可以有三个参数的时间分别为(standby,suspend,off)

例如可以这样写

xset dpms 0 0 30这样写就会在30s后关闭显示屏,进入省电模式。

同时这个选项还可以这样写

xset dpmsforce[standby|suspend|on|off]

可以强制进入以上四个模式

fp 虽然Xorg缺省已经支持了相当丰富的字体,但是还是有可能需要安装新的字体,例如某种中文字体。XWindow的字体应该在配置文件中设置其搜寻路径,但在启动XWindow之后,也可以使用xset命令来重新设置字体的搜寻路径。

xset fp+ :增加一个字体搜寻目录。

xset fp- :删除一个字体搜寻目录。

xset fp= :重新设置字体搜寻目录。

xset fprehash:更改某个字体目录中的内容后,强迫系统刷新字体搜寻路径。

可以使用‘xset’使用工具来修改当前会话的字体路径。用命令 xsetfp 来设置字体路径;把新元素添加到前面使用 xset +fp,而添加到后面使用xset fp+。例如,

$ xset +fp /usr/local/fonts/Type1$ xset fp+ /usr/local/fonts/bitmap

反过来,从字体的路径的前面删除一个元素使用‘xset-fp’,而从后面删除使用‘xset fp-’。

 

Lcd 可以用来控制键盘上的Led灯主要有

xset -lcd

xset +lcd

在我的键盘上只有第三个灯在亮ScrollLock,其它两个都不能通过这个来控制,但是根据它上面说描述的好像键盘上所有的灯都可以控制的,但是我在实际的操作过程中,发现好像就只有第三个可以控制

 

Mouse这一选项是用来鼠标加速的,就跟windows有一个配置鼠标移动速度的很像

xset m 100/1 4

等同于xset m 100 4

不过这个要慎重设,虽然没有什么后果,但是100后鼠标移动速度超快根本看不到鼠标。

 

P它说这一项是用来控制像素值的,但是我设置了后没有什么效果不知道为什么

xset p 0

界面颜色无任何效果

 

 

r用来设置键盘上重复按键的,可以这么解释,我们平常按住一个键的话比如长按1,在输入处会出现很多的1,但是如果使用

xset  roff则此时无论你长按什么键,它都只会出来一次,比如长按1,它只会出来一个1

还可以针对某一特定的值

xset –r10就是将键盘上长按1的效果去掉了,其它的都还有长按的效果的。

xset –r11就是将键盘上长按2的效果去掉了,其它的都还有长按的效果的。以此类推

它还有一些功能设置,比如按多就可以算是一个重复按键,你可以设置1s,2s(不过这种情况要在加载了Xserver的扩展moduleXKB extension后才会有的功能)

 

 

s这个选项和screen saver有关,根据我的理解screensave的意思是屏保的意思,与前面的dpms有点相像,同样具有省电的功能,总共有几个选项exposure可以屏保,noexposure不能屏保,屏保的时间可以使用

xset s 10这样的形式来确定,单位是s,如果没有对其进行操作10s后进入屏保

xset s expose

xset s noexpose

bank和nobank是用来确定屏保的画面

xset s blank (屏保后画面为黑色的)

xset snoblank(屏保后画面是一个图案,我的是一个X)

 

q这个选项没有什么其它的参数

xset –q 用来显示我们上面配置的参数如下:

Keyboard Control:

  autorepeat: on    key clickpercent: 0    LEDmask:  00000002

  autorepeat delay: 500    repeatrate:  30

  autorepeating keys:  00ffffffdffffbbf

                       fadfffdfffdfe5ef

                       ffffffffffffffff

                       ffffffffffffffff

  bellpercent: 50    bellpitch: 400    bellduration:  100

Pointer Control:

 acceleration: 2/1   threshold:  4

Screen Saver:

  preferblanking: yes    allowexposures:  yes

 timeout: 10   cycle:  600

Colors:

  defaultcolormap: 0x20   BlackPixel: 0   WhitePixel:  65535

Font Path:/root/.gnome2/share/cursor-fonts,/usr/share/fonts/X11/misc,/usr/share/fonts/X11/100dpi/:unscaled,/usr/share/fonts/X11/75dpi/:unscaled,/usr/share/fonts/X11/Type1,/usr/share/fonts/X11/100dpi,/usr/share/fonts/X11/75dpi,/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType,/root/.gnome2/share/fonts

Bug Mode: compatibility modeis disabled

DPMS (EnergyStar):

  Standby:0    Suspend:0    Off:0

  DPMS isEnabled

  Monitor isOn

File paths:

  Configfile:  /etc/X11/xorg.conf

  Modulespath: /usr/lib/xorg/modules

  Logfile:    /var/log/Xorg.0.log


你可能感兴趣的:(Linux)