Skip to main content
Version: 1.4

somewm-client Reference somewm-only

IPC command-line tool for controlling SomeWM. This is SomeWM's equivalent to AwesomeWM's awesome-client, but uses a different protocol and command set.

Usage

somewm-client <command> [arguments...]

General Commands

CommandDescription
pingCheck if SomeWM is running
versionShow SomeWM version
eval <code>Evaluate Lua code and return result

Client Commands

Commands for window management. Client IDs are simple integers (1, 2, 3...) assigned when windows open. IDs increment but don't reuse within a session, and reset when the compositor restarts.

CommandDescription
client listList all clients (windows)
client focus <id>Focus client by ID
client close <id>Close client by ID
client minimize <id>Minimize client
client maximize <id>Maximize client
client fullscreen <id>Toggle fullscreen
client floating <id>Toggle floating
client ontop <id>Toggle always-on-top
client sticky <id>Toggle sticky (visible on all tags)

Tag Commands

CommandDescription
tag listList all tags
tag view <name>View tag by name
tag viewidx <n>View tag by index (1-based)

Screen Commands

CommandDescription
screen listList all screens
screen focus <n>Focus screen by index

Input Commands

Commands for input device configuration.

CommandDescription
input <property>Get input property value
input <property> <value>Set input property value

Available properties: tap_to_click, tap_and_drag, drag_lock, tap_3fg_drag, natural_scrolling, disable_while_typing, dwtp, left_handed, middle_button_emulation, scroll_method, scroll_button, scroll_button_lock, click_method, send_events_mode, accel_profile, accel_speed, tap_button_map, clickfinger_button_map, keyboard_repeat_rate, keyboard_repeat_delay, xkb_layout, xkb_variant, xkb_options, numlock

note

These commands set global input defaults. Per-device rules configured via awful.input.rules take priority over global settings. See awful.input Reference for details.

Screenshot Commands

CommandDescription
screenshotTake full screenshot
screenshot <filename>Save screenshot to file

Session Commands

CommandDescription
lockLock the session

Test Mode

Spawn a nested somewm under your current Wayland or X11 session so you can iterate on rc.lua without touching your real desktop. Each instance has its own name (defaults to test); the rest of the verbs target the named instance.

CommandDescription
test start [opts]Spawn a sandboxed nested somewm. See options below.
test stop [--name N]Stop the named instance and remove its state dir.
test list [--json]List running instances. Connects to each socket; stale entries are flagged.
test run [--name N] -- CMDSpawn a command inside the nested instance (it inherits the right WAYLAND_DISPLAY).
test eval [--name N] LUAEvaluate Lua inside the nested instance, like eval but pointed at the named socket.
test reload [--name N]Reload the nested instance's config.
test logs [--name N] [-f]Print or follow the nested instance's log.

test start options

OptionDescription
--config FILEPath to the rc.lua to load. If omitted, the nested somewm follows its normal lookup.
--name NAMEInstance name. Default test. 1 to 64 characters from [A-Za-z0-9._-], no leading .. Each instance gets its own state dir at $XDG_RUNTIME_DIR/somewm-test/<name>/.
--host wayland|x11|headlessOuter compositor type. Defaults to wayland if WAYLAND_DISPLAY is set; otherwise required. headless skips display nesting (no window opens) and is used by CI harnesses; typically paired with WLR_RENDERER=pixman.
--keybinds auto|inhibit|remap|noneHow keys reach the nested somewm. auto tries the shortcut inhibitor protocol and falls back to Mod4 -> Mod1 remap if the host doesn't support it.
--no-markerSkip the wibar marker textbox (cosmetic only).
--forceReplace an already-running instance with the same name.

The status block printed on success reports whether the outer compositor accepted the shortcut inhibitor request. test start waits up to 30 seconds for the nested compositor's IPC socket to respond to a ping before giving up; if rc.lua fails to load, the orchestrator detects the FATAL: line in the log and surfaces it instead of leaving the call hanging. See Testing with a nested compositor for the workflow.

Environment variables

Set by somewm-client test on the nested compositor:

VariablePurpose
SOMEWM_TEST_NAMEInstance name. Compositor reads this to know it is a test instance and to load the keybind-remap shim.
SOMEWM_TEST_STATE_DIRAbsolute path to the per-instance state directory. The compositor writes keybinds_status here.
SOMEWM_TEST_KEYBINDS_MODEOne of auto, inhibit, remap, none. Mirrors --keybinds.
SOMEWM_TEST_KEYBINDS_REMAPSet to 1 when the orchestrator decides to fall back to Mod4 -> Mod1 remap. The Lua shim reads this.
SOMEWM_SOCKETAbsolute path to the per-instance IPC socket so subsequent somewm-client test ... calls reach the right compositor.
XDG_RUNTIME_DIROverridden to <state-dir>/runtime so the nested compositor's Wayland socket does not collide with the host's.
WLR_BACKENDS, WLR_RENDERER, WLR_X11_OUTPUTS, WLR_WL_OUTPUTSSelected based on --host.

Read by somewm-client test:

VariablePurpose
SOMEWM_BINARYPath to the somewm binary to launch. Defaults to somewm on $PATH. Use this to nest a local build (SOMEWM_BINARY=./build/somewm somewm-client test start ...) without make install.
SOMEWM_TEST_KEEP_FAILEDIf set to any value, the orchestrator preserves the state directory after a failed start instead of cleaning it up. The log at <state-dir>/log survives so you can read it.

State directory layout

Each instance owns $XDG_RUNTIME_DIR/somewm-test/<name>/:

FileContents
pidSingle line: the nested compositor's PID.
logCombined stdout + stderr of the nested compositor.
ipc.sockUnix domain socket the orchestrator and somewm-client test ... connect to.
runtime/Per-instance XDG_RUNTIME_DIR. Contains the nested compositor's wayland-N socket.
infoKey-value snapshot for scripts. Keys: name, pid, host, display, config, started_at, keybinds_mode, keybinds_status, wl_socket_name, no_marker.
keybinds_statusSingle line written by the nested compositor: active, unavailable, or not-applicable.

test stop and the failed-start path both remove the directory unless SOMEWM_TEST_KEEP_FAILED is set.

Exit codes

The test subcommands use a richer exit-code set than the generic codes at the bottom of this page:

CodeMeaning
0Success.
1Usage error (bad flag, missing argument, invalid --name).
2An instance with the same --name is already running. Pass --force to replace it.
3Named instance not found (stop, run, eval, reload, logs).
4IPC failure (could not connect to the instance's socket, or the read/write failed).
5Process/system error (fork failed, the nested compositor exited before the socket came up, FATAL: in the startup log).
6Filesystem error (could not create the state directory, write the pidfile, or remove the state directory).

These let scripts and CI tell "already running" from "not found" from "the compositor crashed on startup" without parsing stderr.

See also: Test Mode (concepts) for the why and when, and Workflows for the full set of recipes.

Test mode is inspired by AWMTT, a similar nested-compositor testing tool for AwesomeWM.

Examples

# Check connection
somewm-client ping

# List windows
somewm-client client list
# Output:
# id=1 title="Firefox" class="firefox" tags=1 floating=false
# id=2 title="Terminal" class="Alacritty" tags=1 floating=false

# Focus window by ID
somewm-client client focus 1

# Enable tap-to-click
somewm-client input tap_to_click 1

# Evaluate Lua
somewm-client eval "return client.focus and client.focus.name"

# View tag 3
somewm-client tag viewidx 3

# Lock the session
somewm-client lock

Exit Codes

CodeMeaning
0Success
1Connection failed
2Command failed
3Invalid arguments

See Also