LinuxCommandLibrary

xset

Control X server settings (display, input)

TLDR

Disable the screensaver

$ xset s off
copy

Disable the bell sound
$ xset b off
copy

Set the screensaver to start after 60 minutes of inactivity
$ xset s 3600 3600
copy

Disable DPMS (Energy Star) features
$ xset -dpms
copy

Enable DPMS (Energy Star) features
$ xset +dpms
copy

Query information on any X server
$ xset -display :[0] q
copy

SYNOPSIS

xset [options] [argument]

Common Usage Examples:
xset q
xset s 600 300
xset dpms force off
xset m 5 2
xset -b

PARAMETERS

q
    Queries and prints the current settings of all controllable aspects, including bell, keyboard, mouse, screen saver, and DPMS.

b [volume [pitch [duration]]]
    Controls the keyboard bell. volume (0-100), pitch (Hz), duration (ms). Use -b or b off to disable the bell, b on to enable it.

c [volume]
    Controls the key click. volume (0-100). Use -c or c off to disable key click, c on to enable it.

m [acceleration [threshold]]
    Controls mouse acceleration and threshold. acceleration is a multiplier (e.g., 2/1 for double speed), threshold is the number of pixels the mouse must move before acceleration begins.

s [timeout [blanking]]
    Controls the screen saver. timeout (seconds) before activation. blanking can be on (blank screen), off (no blanking), or prefer blanking. Use s on to enable, s off to disable, and s default to restore defaults.

fp [path]
    Sets the font search path. fp default restores the default path. fp+ [path] adds to the path, fp- [path] removes from the path.

r [keycode]
    Controls keyboard auto-repeat. r on enables auto-repeat for all keys. r off disables for all keys. r [keycode] disables auto-repeat for a specific keycode.

dpms [option]
    Controls Display Power Management Signaling (DPMS). Options include on (enable), off (disable), activate, deactivate, force standby|suspend|off, and setting timeouts (standby [suspend [off]] in seconds).

led [integer]
    Controls keyboard LEDs. led on [integer] turns on a specific LED (e.g., 3 for Caps Lock). led off [integer] turns off an LED.

DESCRIPTION

xset is a utility for the X Window System that allows users to query and set various user preference options of the X server. It can control aspects like keyboard auto-repeat, bell volume and pitch, mouse acceleration and threshold, screen saver timeout and blanking, font search paths, and display power management (DPMS) settings.

xset is commonly used to customize the X environment for a user's session, often run from a user's ~/.xinitrc or ~/.xprofile script. It provides a command-line interface to configure options that might otherwise require graphical tools or direct server configuration, making it valuable for minimalist setups, scripting, or troubleshooting.

CAVEATS

Changes made with xset are session-specific and will be lost when the X server restarts or the session ends. To make settings persistent, commands must be placed in startup scripts (e.g., ~/.xinitrc or desktop environment autostart). xset requires a running X server to function. Some settings might be overridden by modern desktop environments or display managers.

PERSISTENT CONFIGURATION

As xset changes are temporary, lasting only for the current X session, to make settings persistent across reboots or new sessions, the xset commands are typically placed in user startup scripts. Common locations include ~/.xinitrc (for users starting X with startx) or ~/.xprofile (often sourced by display managers like GDM, LightDM, SDDM).

X RESOURCES VS. XSET

It's important to distinguish between settings controlled by xset and settings configured via X resources. xset manages server-wide behaviors like mouse acceleration, screen saver, and bell characteristics. X resources (typically defined in ~/.Xresources or ~/.Xdefaults) are used by individual X applications to customize their appearance and behavior (e.g., font sizes, color schemes for terminals or text editors). xset does not manage X resources.

HISTORY

xset has been a fundamental part of the X Window System since its early days, providing command-line control over core X server user preferences. It predates many modern desktop environments and was crucial for users to customize their X server behavior directly from shell scripts. While graphical configuration tools in comprehensive desktop environments (like GNOME and KDE) now handle many of these settings, xset remains a valuable tool for minimalist setups, scripting automation, and troubleshooting scenarios where direct X server interaction is needed.

SEE ALSO

xrandr(1), xdpyinfo(1), xmodmap(1), xkbcomp(1), setxkbmap(1)

Copied to clipboard