Skip to main content
MangoWCMangoWC

IPC

Control MangoWC programmatically using mmsg.

Introduction

MangoWC includes a powerful IPC (Inter-Process Communication) tool called mmsg. This allows you to query the window manager's state, watch for events, and execute commands from external scripts.

Basic Usage

The general syntax for mmsg is:

mmsg [options] [arguments]

Options

FlagDescription
-qQuit MangoWC.
-gGet values (tags, layout, focused client).
-sSet values (switch tags, layouts).
-wWatch mode (streams events as JSON).
-OGet all output (monitor) information.
-TGet number of tags.
-LGet all available layouts.
-oSelect output (monitor).
-tGet/set selected tags (set with [+-^.]).
-lGet/set current layout.
-cGet title and appid of focused client.
-vGet visibility of statusbar.
-mGet fullscreen status.
-fGet floating status.
-dDispatch an internal command.
-xGet focused client geometry.
-eGet the name of the last focused layer.
-kGet current keyboard layout.
-bGet current keybind mode.
-AGet scale factor of monitor.

Examples

Tag Management

You can perform arithmetic on tags using the -t flag with -s (set).

# Switch to Tag 1
mmsg -t 1

# Add Tag 2 to current view (Multiview)
mmsg -s -t 2+

# Remove Tag 2 from current view
mmsg -s -t 2-

# Toggle Tag 2
mmsg -s -t 2^

Layouts

Switch layouts programmatically. Layout codes: S (Scroller), T (Tile), G (Grid), M (Monocle), K (Deck), VS (Vertical Scroller), VT (Vertical Tile), CT (Center Tile).

# Switch to Scroller
mmsg -l "S"

# Switch to Tile
mmsg -l "T"

Dispatching Commands

Any command available in config.conf keybindings can be run via IPC.

# Close the focused window
mmsg -d killclient

# Resize window by +10 width
mmsg -d resizewin,+10,0

# Toggle fullscreen
mmsg -d togglefullscreen

# Disable a monitor power
mmsg -d disable_monitor,eDP-1

Monitoring & Status

Use -g or -w to build custom status bars or automation scripts.

# Watch for all message changes
mmsg -w

# Get all message without watch
mmsg -g

# Watch focused client appid and title
mmsg -w -c

# Get all available outputs
mmsg -O

# Get all tags message
mmsg -g -t

# Get current focused client message
mmsg -g -c

# Get current keyboard layout
mmsg -g -k

# Get current keybind mode
mmsg -g -b

Tag Message Format

  • State: 0 → none, 1 → active, 2 → urgent

Example output:

MonitorTag NumberTag StateClients in TagFocused Client
eDP-1tag 2010
Monitoroccupied tags maskactive tags maskurgent tags mask
eDP-11460

Virtual Monitors

You can create headless outputs for screen mirroring or remote desktop access (e.g., Sunshine/Moonlight).

# Create a virtual output
mmsg -d create_virtual_output

# Configure it (set resolution)
wlr-randr --output HEADLESS-1 --pos 1920,0 --mode 1920x1080@60Hz

# Destroy all virtual outputs
mmsg -d destroy_all_virtual_output

On this page