Skip to main content
Version: 2.2 (dev)

awful.input somewm-only

awful.input sets global keyboard and pointer settings. Device rules override individual pointer settings.

Usage​

local awful = require("awful")

-- Set properties
awful.input.tap_to_click = 1
awful.input.natural_scrolling = 1

-- Get properties
print(awful.input.accel_speed)

Pointer Properties​

PropertyTypeDefaultDescription
tap_to_clicknumber (0/1)-1Enable tap-to-click on touchpads
natural_scrollingnumber (0/1)-1Invert scroll direction (macOS-style)
accel_speednumber0.0Pointer acceleration (-1.0 to 1.0)
scroll_buttonnumber0Button for scroll-on-button-down
left_handednumber (0/1)-1Swap left/right mouse buttons
middle_button_emulationnumber (0/1)-1Emulate middle button with left+right
scroll_methodstringnilScroll method (see below)
accel_profilestringnilAcceleration profile (see below)
tap_and_dragnumber (0/1)-1Enable tap-and-drag
drag_locknumber (0/1)-1Enable drag lock
tap_3fg_dragnumber (0/1)-1Three-finger drag (tap 3 fingers, drag with 1)
disable_while_typingnumber (0/1)-1Disable while typing
dwtpnumber (0/1)-1Disable touchpad while trackpoint in use (ThinkPad)
scroll_button_locknumber (0/1)-1Scroll button toggle vs hold (1=toggle, 0=hold)
clickfinger_button_mapstringnilButton map for clickfinger mode (see below)
tap_button_mapstringnilButton map for tap-to-click mode (see below)
click_methodstringnilClick method: "none", "button_areas", "clickfinger"
send_events_modestringnilSend events mode: "enabled", "disabled", "disabled_on_external_mouse"

The table lists initial awful.input values before configuration. For 0/1 settings, -1 leaves the device setting untouched. It does not undo a value already applied. Unsupported settings depend on the device and installed libinput version.

Button Maps​

The tap_button_map and clickfinger_button_map settings control which mouse button is triggered by multi-finger taps/clicks:

Value1 finger2 fingers3 fingers
"lrm"LeftRightMiddle
"lmr"LeftMiddleRight

Scroll Button​

scroll_button uses Linux evdev button codes, not awful.button numbers:

ValueButton
0Do not override the scroll button
274Middle mouse button (common for TrackPoints)
275Side/thumb button (BTN_SIDE)
278Back button (BTN_BACK)

Scroll Methods​

ValueMethod
nilDo not override the method
"no_scroll"Disable scrolling
"two_finger"Two-finger scrolling
"edge"Edge scrolling
"button"Button scrolling

Acceleration Profiles​

ValueProfile
"adaptive"Adaptive (accelerates with speed)
"flat"Flat (constant speed)

Keyboard Properties​

PropertyTypeDefaultDescription
xkb_layoutstring""Keyboard layout (e.g., "us", "de", "us,ru")
xkb_variantstring""Layout variant (e.g., "dvorak", "colemak")
xkb_optionsstring""XKB options (e.g., "ctrl:nocaps")
xkb_modelstring""XKB model (e.g., "pc105")
xkb_rulesstring""XKB rules (e.g., "base")
keyboard_repeat_ratenumber25Key repeat rate (keys per second)
keyboard_repeat_delaynumber600Delay before repeat starts (milliseconds)

Repeat rate and delay are sent to clients. They do not override the keymap's per-key repeat flag. See Key Repeat.

Common XKB Options​

OptionEffect
ctrl:nocapsCaps Lock acts as Ctrl
ctrl:swapcapsSwap Caps Lock and Ctrl
compose:raltRight Alt is Compose key
grp:alt_shift_toggleAlt+Shift switches layouts
grp:win_space_toggleSuper+Space switches layouts
Layout switching in 2.1

SomeWM 2.1 does not switch layout groups through grp:* options. Use explicit keybindings instead. See Keyboard Layout Switching for workarounds.

Input Rules​

Per-device input configuration using the same { rule, properties } pattern as client rules. Rules let you apply different settings to different devices, for example enabling natural scrolling on your touchpad but not your mouse.

How Rules Work​

Each rule has a condition that matches devices and properties to apply. Rules are evaluated in order. Later matches override earlier ones per property. Properties absent from matching rules retain their global settings.

awful.input.rules = {
{ rule = { type = "touchpad" },
properties = { natural_scrolling = 1, tap_to_click = 1 } },
{ rule = { type = "pointer" },
properties = { natural_scrolling = 0, accel_profile = "flat" } },
}

Rule Conditions​

FieldTypeDescription
typestringDevice type: "touchpad" or "pointer" (mice, trackballs, trackpoints)
namestringCase-sensitive substring match against the device name (e.g., "Logitech G502")

Both fields are optional. An empty rule matches all pointer devices. When both fields are present, both must match.

Finding Device Names​

Device names are listed by:

libinput list-devices

Rule Properties​

Rules accept any pointer property listed above. Keyboard properties are not per-device and cannot be used in rules.

Per-Device Override​

awful.input.rules = {
{ rule = { type = "touchpad" },
properties = { natural_scrolling = 1 } },
{ rule = { name = "Logitech G502" },
properties = { accel_speed = -0.5, accel_profile = "flat" } },
}

Clearing Rules​

Assigning rules reapplies settings to connected devices and affects newly connected devices. Set it to nil to remove all rules:

awful.input.rules = nil

Example Configuration​

See Input devices for a complete configuration and Keyboard layouts for layout switching and NumLock. numlock is not an awful.input property in 2.1.

See Also​